Fawkes API
Fawkes Development Version
|
Dynamic module loader for Linux, FreeBSD, and MacOS X. More...
#include <>>
Public Types | |
enum | ModuleFlags { MODULE_FLAGS_NONE = 0, MODULE_FLAGS_DEFAULT = 0x000E, MODULE_BIND_LAZY = 0x0001, MODULE_BIND_NOW = 0x0002, MODULE_BIND_LOCAL = 0x0000, MODULE_BIND_GLOBAL = 0x0004, MODULE_BIND_MASK = 0x0003, MODULE_BIND_DEEP = 0x0008, MODULE_NODELETE = 0x1000 } |
Flags for the loading process. More... | |
Public Member Functions | |
Module (std::string filename, ModuleFlags flags=MODULE_FLAGS_DEFAULT) | |
Constructor. More... | |
virtual | ~Module () |
Destructor. More... | |
virtual void | open () |
Open the module. More... | |
virtual bool | close () |
Close the module. More... | |
virtual void | ref () |
Increment the reference count of this module. More... | |
virtual void | unref () |
Decrease the reference count of this module. More... | |
virtual bool | notref () |
Check if there are no reference to this module. More... | |
virtual unsigned int | get_ref_count () |
Get the reference count of this module. More... | |
virtual bool | has_symbol (const char *symbol_name) |
Check if the module has the given symbol. More... | |
virtual void * | get_symbol (const char *symbol_name) |
Get a symbol from the module. More... | |
virtual std::string | get_filename () |
Get the full file name of the module. More... | |
virtual std::string | get_base_filename () |
Get the base file name of the module. More... | |
virtual bool | operator== (const Module &cmod) |
Compare to another Module instance. More... | |
Static Public Member Functions | |
static const char * | get_file_extension () |
Get file extension for dl modules. More... | |
Dynamic module loader for Linux, FreeBSD, and MacOS X.
A Module implementation for the dl dynamic loader library that comes with glibc, applicable for Linux, FreeBSD, and MacOS X Systems.
For nice reading and hints about using dynamic module loading with C++ you should have a look at http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/C++-dlopen-mini-HOWTO.html
Flags for the loading process.
fawkes::Module::Module | ( | std::string | filename, |
Module::ModuleFlags | flags = MODULE_FLAGS_DEFAULT |
||
) |
Constructor.
filename | full filename of the module |
flags | module flags |
Definition at line 64 of file module.cpp.
|
virtual |
|
virtual |
Close the module.
Definition at line 151 of file module.cpp.
|
virtual |
Get the base file name of the module.
Definition at line 289 of file module.cpp.
Referenced by fawkes::ModuleManager::close_module(), and fawkes::ModuleManager::open_module().
|
static |
Get file extension for dl modules.
Definition at line 268 of file module.cpp.
Referenced by fawkes::ModuleManager::get_module_file_extension().
|
virtual |
Get the full file name of the module.
Definition at line 278 of file module.cpp.
|
virtual |
Get the reference count of this module.
Definition at line 202 of file module.cpp.
|
virtual |
Get a symbol from the module.
symbol_name | The name of the symbol. NOTE: C++ symbols are mangled with type info and thus are not plainly available as symbol name. Use extern "C" to avoid this. Read http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/C++-dlopen-mini-HOWTO.html for more information on this topic. |
Definition at line 253 of file module.cpp.
Referenced by fawkes::BlackBoardInstanceFactory::delete_interface_instance(), fawkes::PluginLoader::get_description(), fawkes::PluginLoader::get_module_manager(), and fawkes::BlackBoardInstanceFactory::new_interface_instance().
|
virtual |
Check if the module has the given symbol.
symbol_name | The name of the symbol. NOTE: C++ symbols are mangled with type info and thus are not plainly available as symbol name. Use extern "C" to avoid this. Read http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/C++-dlopen-mini-HOWTO.html for more information on this topic. |
Definition at line 230 of file module.cpp.
Referenced by fawkes::BlackBoardInstanceFactory::delete_interface_instance(), fawkes::PluginLoader::get_description(), fawkes::PluginLoader::get_module_manager(), and fawkes::BlackBoardInstanceFactory::new_interface_instance().
|
virtual |
Check if there are no reference to this module.
Definition at line 192 of file module.cpp.
|
virtual |
Open the module.
ModuleOpenException | thrown if there was any problem while loading the module |
Definition at line 89 of file module.cpp.
References fawkes::Exception::append(), fawkes::File::is_regular(), and fawkes::ModuleOpenException::ModuleOpenException().
Referenced by fawkes::ModuleManager::open_module().
|
virtual |
Compare to another Module instance.
cmod | a reference to the other comparison instance |
Definition at line 214 of file module.cpp.
|
virtual |
Increment the reference count of this module.
Definition at line 171 of file module.cpp.
|
virtual |
Decrease the reference count of this module.
Definition at line 179 of file module.cpp.
Referenced by fawkes::BlackBoardInstanceFactory::delete_interface_instance().