The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Wrapper class around a shared library. More...
Public Member Functions | |
dynamiclib_t (const std::string &name_) | |
C'tor of the wrapper class. More... | |
virtual void * | resolve (const std::string &name_) |
Resolves the function specified by name_ and returns a pointer to it or a nullptr if the function was not found in the wrapped library. More... | |
virtual void * | resolve_checked (const std::string &name_) |
Resolves the function specified by name_ and returns a pointer to it or throws an exception if the function was not found. More... | |
virtual | ~dynamiclib_t () |
D'tor. More... | |
virtual const std::string & | getmodulename () const |
Returns unqualified filename of the wrapped library sans file suffix. More... | |
virtual const std::string & | getname () const |
Protected Member Functions | |
dynamiclib_t () | |
Default constructor. More... | |
void | load_lib (const std::string &name_) |
Loads the library specified in name_ and saves a handle in h. More... | |
Protected Attributes | |
std::string | fullname |
Fully qualified file name of the library. More... | |
std::string | modulename |
Unqualified file name of the library. More... | |
mha_libhandle_t | h |
Handle to the shared library. More... | |
Wrapper class around a shared library.
Encapsulates the OS-specific stuff of loading the shared library, resolving functions, etc... Uses the dload API on Linux/macOS and the win32 API on Windows
dynamiclib_t::dynamiclib_t | ( | const std::string & | name_ | ) |
C'tor of the wrapper class.
Takes a the the file name of a shared libary w/o the suffix as argument, searches for the library in the system-dependent standard paths for libraries and in MHA_LIBRARY_PATH. Calls load_lib for the actual work.
name_ | File name of the shared library, without suffix |
MHA_Error | if the library can not be found or can not be loaded |
|
virtual |
D'tor.
Closes the library handle.
|
protected |
Default constructor.
|
virtual |
Resolves the function specified by name_ and returns a pointer to it or a nullptr if the function was not found in the wrapped library.
name_ | Name of the function to be resolved |
Reimplemented in pluginlib_t.
|
virtual |
Resolves the function specified by name_ and returns a pointer to it or throws an exception if the function was not found.
name_ | Name of the function to be resolved |
|
inlinevirtual |
Returns unqualified filename of the wrapped library sans file suffix.
|
inlinevirtual |
|
protected |
Loads the library specified in name_ and saves a handle in h.
name_ | unqualified file name of the shared library w/o suffix |
|
protected |
Fully qualified file name of the library.
|
protected |
Unqualified file name of the library.
|
protected |
Handle to the shared library.