Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usSharedLibrary.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef USSHAREDLIBRARY_H
14 #define USSHAREDLIBRARY_H
15 
16 #include <usGlobalConfig.h>
18 #include <usSharedData.h>
19 
20 #include <string>
21 
22 namespace us {
23 
24 class SharedLibraryPrivate;
25 
32 {
33 public:
34 
37 
43 
52  SharedLibrary(const std::string& libPath, const std::string& name);
53 
61  SharedLibrary(const std::string& absoluteFilePath);
62 
67 
74 
85  void Load();
86 
95  void Load(int flags);
96 
103  void Unload();
104 
113  void SetName(const std::string& name);
114 
119  std::string GetName() const;
120 
128  std::string GetFilePath(const std::string& name) const;
129 
138  void SetFilePath(const std::string& absoluteFilePath);
139 
145  std::string GetFilePath() const;
146 
154  void SetLibraryPath(const std::string& path);
155 
161  std::string GetLibraryPath() const;
162 
170  void SetSuffix(const std::string& suffix);
171 
177  std::string GetSuffix() const;
178 
186  void SetPrefix(const std::string& prefix);
187 
193  std::string GetPrefix() const;
194 
201  void* GetHandle() const;
202 
208  bool IsLoaded() const;
209 
210 private:
211 
213 
214 };
215 
216 }
217 
218 #endif // USTESTUTILSHAREDLIBRARY_H
#define MITKCPPMICROSERVICES_EXPORT
The SharedLibrary class loads shared libraries at runtime.
void Unload()
Un-loads the shared library pointed to by this SharedLibrary object.
std::string GetName() const
Gets the base name of the shared library.
void SetName(const std::string &name)
Sets the base name of the shared library. Does nothing if the shared library is already loaded or the...
void SetFilePath(const std::string &absoluteFilePath)
Sets the absolute file path of this SharedLibrary object. Using this methods with a non-empty absolut...
void Load()
Loads the shared library pointed to by this SharedLibrary object. On POSIX systems dlopen() is called...
bool IsLoaded() const
Gets the loaded/unloaded stated of this SharedLibrary object.
std::string GetPrefix() const
Gets the file name prefix of this SharedLibrary object.
SharedLibrary()
Default constructor.
SharedLibrary(const std::string &absoluteFilePath)
Construct a SharedLibrary object using an absolute file path to the shared library....
void SetSuffix(const std::string &suffix)
Sets the suffix for shared library names (e.g. .dll or .so). Does nothing if the shared library is al...
std::string GetFilePath(const std::string &name) const
Gets the absolute file path for the shared library with base name name, using the search path returne...
void SetLibraryPath(const std::string &path)
Sets a new library search path. Does nothing if the shared library is already loaded or the SharedLib...
~SharedLibrary()
Destroys this object but does not unload the shared library.
std::string GetSuffix() const
Gets the file name suffix of this SharedLibrary object.
void * GetHandle() const
Gets the internal handle of this SharedLibrary object.
void Load(int flags)
Loads the shared library pointed to by this SharedLibrary object, using the specified flags on POSIX ...
SharedLibrary(const std::string &libPath, const std::string &name)
Construct a SharedLibrary object using a library search path and a library base name.
std::string GetFilePath() const
Gets the absolute file path of this SharedLibrary object.
SharedLibrary(const SharedLibrary &other)
Copy constructor.
std::string GetLibraryPath() const
Gets the library search path of this SharedLibrary object.
SharedLibrary & operator=(const SharedLibrary &other)
Assignment operator.
void SetPrefix(const std::string &prefix)
Sets the file name prefix for shared library names (e.g. lib). Does nothing if the shared library is ...