Loads plugins from dynamic libraries (usually .so or .dll files). More...
Public Member Functions | |
PluginLoader (void) | |
Default constructor. | |
~PluginLoader (void) | |
const std::string & | setDirectory (const std::string &n) |
Set the directory from which to load the dynamic libraries containing the plugins. | |
const std::string & | getDirectory (void) |
Get the directory from which to load the dynamic libraries containing the plugins. | |
void | loadPluginList (const std::string &configFile, const std::string &dir="") |
Adds a list of plugins It is done by reading the file configFile which contains for each line a plugin name. | |
void | addPlugin (const std::string &name, const std::string &dir="") |
Adds a single plugin. | |
void | loadPlugins (void) |
Load the plugins previously added. | |
void | unloadPlugin (const std::string &plugname) |
Remove from the user memory the dynamic library related to the plugin. | |
void | unloadAllPlugins () |
Remove all the dynamic libraries related to the plugins. For non-re-entrant plugins this method HAS TO be called. | |
const std::map< std::string, std::string > | getLoadedPluginNames (void) |
const std::string & | searchPlugin (const std::string &plugname) |
Protected Attributes | |
std::string | pluginDirectory |
Directory from where the dynamic libraries are loaded. | |
std::list< std::string > | pluginNames |
List of plugin names given by their name postfixed to the directory. | |
std::map< std::string, std::string > | loadedPluginNames |
If a plugin has been loaded then this map contains the name of the plugin. | |
PluginRefMap * | pluginRefs |
Keeps a reference to the library according to the name of the plugin. |
Loads plugins from dynamic libraries (usually .so or .dll files).
The sotPluginLoader can be made to load individual plugins by specifying their filenames to addPlugin() or reading them from a configuration file (loadPluginlist). Once loaded, the plugins register themselves to the sotFactory and the related objects can subsequently be instantiated by the sotInterpretor for example.
dynamicgraph::PluginLoader::PluginLoader | ( | void | ) |
Default constructor.
dynamicgraph::PluginLoader::~PluginLoader | ( | void | ) |
void dynamicgraph::PluginLoader::addPlugin | ( | const std::string & | name, | |
const std::string & | dir = "" | |||
) |
Adds a single plugin.
const std::string& dynamicgraph::PluginLoader::getDirectory | ( | void | ) |
Get the directory from which to load the dynamic libraries containing the plugins.
const std::map< std::string,std::string > dynamicgraph::PluginLoader::getLoadedPluginNames | ( | void | ) | [inline] |
void dynamicgraph::PluginLoader::loadPluginList | ( | const std::string & | configFile, | |
const std::string & | dir = "" | |||
) |
Adds a list of plugins It is done by reading the file configFile which contains for each line a plugin name.
void dynamicgraph::PluginLoader::loadPlugins | ( | void | ) |
Load the plugins previously added.
const std::string& dynamicgraph::PluginLoader::searchPlugin | ( | const std::string & | plugname | ) |
const std::string& dynamicgraph::PluginLoader::setDirectory | ( | const std::string & | n | ) |
Set the directory from which to load the dynamic libraries containing the plugins.
void dynamicgraph::PluginLoader::unloadAllPlugins | ( | ) |
Remove all the dynamic libraries related to the plugins. For non-re-entrant plugins this method HAS TO be called.
void dynamicgraph::PluginLoader::unloadPlugin | ( | const std::string & | plugname | ) |
Remove from the user memory the dynamic library related to the plugin.
std::map< std::string,std::string > dynamicgraph::PluginLoader::loadedPluginNames [protected] |
If a plugin has been loaded then this map contains the name of the plugin.
std::string dynamicgraph::PluginLoader::pluginDirectory [protected] |
Directory from where the dynamic libraries are loaded.
std::list< std::string > dynamicgraph::PluginLoader::pluginNames [protected] |
List of plugin names given by their name postfixed to the directory.
PluginRefMap* dynamicgraph::PluginLoader::pluginRefs [protected] |
Keeps a reference to the library according to the name of the plugin.