|
|
The DynamicLibrary class provides a mechanism to load libraries at runtime. More...
#include <ArmarXCore/core/system/DynamicLibrary.h>
Inheritance diagram for DynamicLibrary:Public Member Functions | |
| DynamicLibrary () | |
| std::string | getErrorMessage () noexcept |
| std::filesystem::path | getLibraryFilename () noexcept |
| template<class SymbolType > | |
| SymbolType | getSymbol (const std::string &functionName) |
| Retrieves a symbol (mostly a function) from the loaded library. More... | |
| bool | isLibraryLoaded () noexcept |
| Checks if a library is currently loaded. More... | |
| void | load (std::filesystem::path libPath) |
| Loads a shared library from the specified path. More... | |
| void | reload () |
| Reloads the current library. More... | |
| void | setFlags (int newFlags) |
| Sets the shared library opening flags and reloads the library, if a library is already loaded. More... | |
| void | setUnloadOnDestruct (bool unload) |
| void | unload () |
| Unloads library. More... | |
| ~DynamicLibrary () override | |
Public Member Functions inherited from Logging | |
| SpamFilterDataPtr | deactivateSpam (float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const |
| disables the logging for the current line for the given amount of seconds. More... | |
| MessageTypeT | getEffectiveLoggingLevel () const |
| Logging () | |
| void | setLocalMinimumLoggingLevel (MessageTypeT level) |
| With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set. More... | |
| void | setTag (const LogTag &tag) |
| void | setTag (const std::string &tagName) |
| virtual | ~Logging () |
Static Public Member Functions | |
| static std::string | GetSharedLibraryFileExtension () |
Additional Inherited Members | |
Protected Member Functions inherited from Logging | |
| bool | checkLogLevel (MessageTypeT level) const |
| const LogSenderPtr & | getLogSender () const |
| Retrieve log sender. More... | |
| LogSenderPtr | loghelper (const char *file, int line, const char *function) const |
Protected Attributes inherited from Logging | |
| MessageTypeT | minimumLoggingLevel |
| SpamFilterDataPtr | spamFilter |
| LogTag | tag |
The DynamicLibrary class provides a mechanism to load libraries at runtime.
A quick usage example looks as follows:
Definition at line 49 of file DynamicLibrary.h.
| DynamicLibrary | ( | ) |
Definition at line 29 of file DynamicLibrary.cpp.
|
override |
|
noexcept |
Definition at line 182 of file DynamicLibrary.cpp.
|
noexcept |
Definition at line 176 of file DynamicLibrary.cpp.
|
static |
| SymbolType getSymbol | ( | const std::string & | functionName | ) |
Retrieves a symbol (mostly a function) from the loaded library.
The requested function needs to be exported with "extern "C"".
| SymbolType | type of the requested symbol |
| functionName | name of the requested function |
| exceptions::local::DynamicLibraryException |
Definition at line 133 of file DynamicLibrary.h.
|
noexcept |
Checks if a library is currently loaded.
Definition at line 141 of file DynamicLibrary.cpp.
Here is the caller graph for this function:| void load | ( | std::filesystem::path | libPath | ) |
Loads a shared library from the specified path.
Throws exceptions::local::DynamicLibraryException on error.
| libPath | Path to the library. Can be relative to ArmarXDataPath's paths. |
| exceptions::local::DynamicLibraryException |
Definition at line 54 of file DynamicLibrary.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void reload | ( | ) |
Reloads the current library.
Useful, if the library has changed since last loading.
| exceptions::local::DynamicLibraryException |
Definition at line 134 of file DynamicLibrary.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void setFlags | ( | int | newFlags | ) |
Sets the shared library opening flags and reloads the library, if a library is already loaded.
| newFlags | flags of ::dlopen() |
| exceptions::local::DynamicLibraryException |
Definition at line 153 of file DynamicLibrary.cpp.
Here is the call graph for this function:| void setUnloadOnDestruct | ( | bool | unload | ) |
| void unload | ( | ) |
Unloads library.
User has to make sure that all references to the symbols in this library are deleted!
| exceptions::local::DynamicLibraryException |
Definition at line 106 of file DynamicLibrary.cpp.
Here is the caller graph for this function: