|
Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
#include <usSharedLibrary.h>
Public Member Functions | |
| SharedLibrary () | |
| SharedLibrary (const SharedLibrary &other) | |
| SharedLibrary (const std::string &libPath, const std::string &name) | |
| SharedLibrary (const std::string &absoluteFilePath) | |
| ~SharedLibrary () | |
| SharedLibrary & | operator= (const SharedLibrary &other) |
| void | Load () |
| void | Load (int flags) |
| void | Unload () |
| void | SetName (const std::string &name) |
| std::string | GetName () const |
| std::string | GetFilePath (const std::string &name) const |
| void | SetFilePath (const std::string &absoluteFilePath) |
| std::string | GetFilePath () const |
| void | SetLibraryPath (const std::string &path) |
| std::string | GetLibraryPath () const |
| void | SetSuffix (const std::string &suffix) |
| std::string | GetSuffix () const |
| void | SetPrefix (const std::string &prefix) |
| std::string | GetPrefix () const |
| void * | GetHandle () const |
| bool | IsLoaded () const |
The SharedLibrary class loads shared libraries at runtime.
Definition at line 39 of file usSharedLibrary.h.
| us::SharedLibrary::SharedLibrary | ( | ) |
Definition at line 79 of file usSharedLibrary.cpp.
| us::SharedLibrary::SharedLibrary | ( | const SharedLibrary & | other | ) |
Definition at line 84 of file usSharedLibrary.cpp.
| us::SharedLibrary::SharedLibrary | ( | const std::string & | libPath, |
| const std::string & | name | ||
| ) |
Construct a SharedLibrary object using a library search path and a library base name.
| libPath | An absolute path containing the shared library |
| name | The base name of the shared library, without prefix and suffix. |
Definition at line 89 of file usSharedLibrary.cpp.
| us::SharedLibrary::SharedLibrary | ( | const std::string & | absoluteFilePath | ) |
Construct a SharedLibrary object using an absolute file path to the shared library. Using this constructor effectively disables all setters except SetFilePath().
| absoluteFilePath | The absolute path to the shared library. |
Definition at line 96 of file usSharedLibrary.cpp.
References SetFilePath().
| us::SharedLibrary::~SharedLibrary | ( | ) |
Destroys this object but does not unload the shared library.
Definition at line 103 of file usSharedLibrary.cpp.
| std::string us::SharedLibrary::GetFilePath | ( | const std::string & | name | ) | const |
Gets the absolute file path for the shared library with base name name, using the search path returned by GetLibraryPath().
| name | The shared library base name. |
Definition at line 184 of file usSharedLibrary.cpp.
References GetLibraryPath(), GetPrefix(), GetSuffix(), and us::PATH_SEPARATOR.
| std::string us::SharedLibrary::GetFilePath | ( | ) | const |
Gets the absolute file path of this SharedLibrary object.
Definition at line 222 of file usSharedLibrary.cpp.
Referenced by Load().
| void * us::SharedLibrary::GetHandle | ( | ) | const |
Gets the internal handle of this SharedLibrary object.
nullptr if the shared library is not loaded, the operating system specific handle otherwise. Definition at line 263 of file usSharedLibrary.cpp.
| std::string us::SharedLibrary::GetLibraryPath | ( | ) | const |
Gets the library search path of this SharedLibrary object.
Definition at line 234 of file usSharedLibrary.cpp.
Referenced by GetFilePath(), and Unload().
| std::string us::SharedLibrary::GetName | ( | ) | const |
Gets the base name of the shared library.
Definition at line 179 of file usSharedLibrary.cpp.
| std::string us::SharedLibrary::GetPrefix | ( | ) | const |
Gets the file name prefix of this SharedLibrary object.
Definition at line 258 of file usSharedLibrary.cpp.
Referenced by GetFilePath().
| std::string us::SharedLibrary::GetSuffix | ( | ) | const |
Gets the file name suffix of this SharedLibrary object.
Definition at line 246 of file usSharedLibrary.cpp.
Referenced by GetFilePath().
| bool us::SharedLibrary::IsLoaded | ( | ) | const |
Gets the loaded/unloaded stated of this SharedLibrary object.
true if the shared library is loaded, false otherwise. Definition at line 268 of file usSharedLibrary.cpp.
Referenced by SetFilePath(), SetLibraryPath(), SetName(), SetPrefix(), and SetSuffix().
| void us::SharedLibrary::Load | ( | ) |
Loads the shared library pointed to by this SharedLibrary object. On POSIX systems dlopen() is called with the RTLD_LAZY and RTLD_LOCAL flags unless the compiler is gcc 4.4.x or older. Then the RTLD_LAZY and RTLD_GLOBAL flags are used to load the shared library to work around RTTI problems across shared library boundaries.
| std::logic_error | If the library is already loaded. |
| std::runtime_error | If loading the library failed. |
Definition at line 136 of file usSharedLibrary.cpp.
| void us::SharedLibrary::Load | ( | int | flags | ) |
Loads the shared library pointed to by this SharedLibrary object, using the specified flags on POSIX systems.
| std::logic_error | If the library is already loaded. |
| std::runtime_error | If loading the library failed. |
Definition at line 113 of file usSharedLibrary.cpp.
References GetFilePath(), and us::GetLastErrorStr().
| SharedLibrary & us::SharedLibrary::operator= | ( | const SharedLibrary & | other | ) |
Definition at line 107 of file usSharedLibrary.cpp.
| void us::SharedLibrary::SetFilePath | ( | const std::string & | absoluteFilePath | ) |
Sets the absolute file path of this SharedLibrary object. Using this methods with a non-empty absoluteFilePath argument effectively disables all other setters.
| absoluteFilePath | The new absolute file path of this SharedLibrary object. |
Definition at line 190 of file usSharedLibrary.cpp.
References us::ExplicitlySharedDataPointer< T >::Detach(), IsLoaded(), and us::PATH_SEPARATOR.
Referenced by SharedLibrary().
| void us::SharedLibrary::SetLibraryPath | ( | const std::string & | path | ) |
Sets a new library search path. Does nothing if the shared library is already loaded or the SharedLibrary(const std::string&) constructor was used.
| path | The new shared library search path. |
Definition at line 227 of file usSharedLibrary.cpp.
References us::ExplicitlySharedDataPointer< T >::Detach(), and IsLoaded().
| void us::SharedLibrary::SetName | ( | const std::string & | name | ) |
Sets the base name of the shared library. Does nothing if the shared library is already loaded or the SharedLibrary(const std::string&) constructor was used.
| name | The base name of the shared library, without prefix and suffix. |
Definition at line 172 of file usSharedLibrary.cpp.
References us::ExplicitlySharedDataPointer< T >::Detach(), and IsLoaded().
| void us::SharedLibrary::SetPrefix | ( | const std::string & | prefix | ) |
Sets the file name prefix for shared library names (e.g. .dll or .so). Does nothing if the shared library is already loaded or the SharedLibrary(const std::string&) constructor was used.
| prefix | The shared library name prefix. |
Definition at line 251 of file usSharedLibrary.cpp.
References us::ExplicitlySharedDataPointer< T >::Detach(), and IsLoaded().
| void us::SharedLibrary::SetSuffix | ( | const std::string & | suffix | ) |
Sets the suffix for shared library names (e.g. lib). Does nothing if the shared library is already loaded or the SharedLibrary(const std::string&) constructor was used.
| suffix | The shared library name suffix. |
Definition at line 239 of file usSharedLibrary.cpp.
References us::ExplicitlySharedDataPointer< T >::Detach(), and IsLoaded().
| void us::SharedLibrary::Unload | ( | ) |
Un-loads the shared library pointed to by this SharedLibrary object.
| std::runtime_error | If an error occurred while un-loading the shared library. |
Definition at line 149 of file usSharedLibrary.cpp.
References us::GetLastErrorStr(), and GetLibraryPath().