Fawkes API
Fawkes Development Version
|
This class manages plugins. More...
#include <>>
Public Member Functions | |
PluginLoader (const char *plugin_base_dir, Configuration *config) | |
Constructor. More... | |
~PluginLoader () | |
Destructor. More... | |
Plugin * | load (const char *plugin_name) |
Load a specific plugin The plugin loader is clever and guarantees that every plugin is only loaded once (as long as you use only one instance of the PluginLoader, using multiple instances is discouraged. More... | |
void | unload (Plugin *plugin) |
Unload the given plugin This will unload the given plugin. More... | |
std::string | get_description (const char *plugin_name) |
Get plugin description. More... | |
bool | is_loaded (const char *plugin_name) |
Check if a plugin is loaded. More... | |
ModuleManager * | get_module_manager () const |
Get module manager. More... | |
This class manages plugins.
With this class plugins can be loaded and unloaded. Information is kept about active plugins.
fawkes::PluginLoader::PluginLoader | ( | const char * | plugin_base_dir, |
Configuration * | config | ||
) |
Constructor.
plugin_base_dir | The base directory where to search for the shared libraries which contain the plugins |
config | Fawkes configuration |
Definition at line 129 of file loader.cpp.
fawkes::PluginLoader::~PluginLoader | ( | ) |
Destructor.
Definition at line 138 of file loader.cpp.
std::string fawkes::PluginLoader::get_description | ( | const char * | plugin_name | ) |
Get plugin description.
plugin_name | name of the plugin |
PluginLoadException | thrown if opening the plugin fails |
Definition at line 333 of file loader.cpp.
References fawkes::Module::get_symbol(), and fawkes::Module::has_symbol().
Referenced by fawkes::PluginManager::fam_event(), and fawkes::PluginManager::init_pinfo_cache().
ModuleManager * fawkes::PluginLoader::get_module_manager | ( | ) | const |
Get module manager.
This should be used rarely, but may be useful, for example, to pass specific module opening flags in some situations.
Definition at line 151 of file loader.cpp.
References fawkes::Module::get_symbol(), fawkes::Module::has_symbol(), and fawkes::Plugin::set_name().
Referenced by fawkes::PluginManager::PluginManager(), and fawkes::PluginManager::set_module_flags().
bool fawkes::PluginLoader::is_loaded | ( | const char * | plugin_name | ) |
Check if a plugin is loaded.
plugin_name | name of the plugin to chekc |
Definition at line 358 of file loader.cpp.
Referenced by fawkes::PluginManager::fam_event(), and fawkes::PluginManager::is_loaded().
Plugin * fawkes::PluginLoader::load | ( | const char * | plugin_name | ) |
Load a specific plugin The plugin loader is clever and guarantees that every plugin is only loaded once (as long as you use only one instance of the PluginLoader, using multiple instances is discouraged.
If you try to open a plugin a second time it will return the very same instance that it returned on previous load()s.
plugin_name | The name of the plugin to be loaded, the plugin name has to correspond to a plugin name and the name of the shared object that will be opened for this plugin (for instance on Linux systems opening the plugin test_plugin will look for plugin_base_dir/test_plugin.so) |
PluginLoadException | thrown if plugin could not be loaded |
ModuleOpenException | passed along from module manager |
Definition at line 211 of file loader.cpp.
References fawkes::Exception::end(), and fawkes::Exception::Exception().
Referenced by fawkes::PluginManager::load().
void fawkes::PluginLoader::unload | ( | Plugin * | plugin | ) |
Unload the given plugin This will unload the given plugin.
The plugin is destroyed with the proper destroy method from the shared object. The shared object is unloaded after the destruction of the plugin. Note that even though you may call load() multiple times per plugin you may only unload() it once! Every further access will lead to a segmentation fault. Make sure that you have closed any resources claimed by the plugin like threads, memory access etc.
plugin | The plugin that has to be unloaded |
Definition at line 376 of file loader.cpp.
Referenced by fawkes::PluginManager::load(), fawkes::PluginManager::unload(), and fawkes::PluginManager::~PluginManager().