RSC
0.17.1
|
Instances of this class manages plugin search path entries and plugins. More...
#include <Manager.h>
Public Member Functions | |
Manager () | |
virtual | ~Manager () |
std::vector< boost::filesystem::path > | getPath () const |
Returns the current plugin search path. More... | |
void | addPath (const boost::filesystem::path &path) |
Adds path to the list of search path entries. More... | |
std::set< PluginPtr > | getPlugins (const boost::regex ®ex=boost::regex(".*")) const |
Returns the set of known plugins, potentially filtered by name according to regular expression regex. More... | |
std::set< PluginPtr > | getPlugins (const std::string ®ex) const |
Returns the set of known plugins, filtered by name according to regular expression regex. More... | |
PluginPtr | getPlugin (const std::string &name) const |
Return the plugin designated by name. More... | |
Private Types | |
typedef std::vector< boost::filesystem::path > | PathList |
typedef std::map< std::string, PluginPtr > | PluginMap |
Private Attributes | |
logging::LoggerPtr | logger |
PathList | path |
PluginMap | plugins |
Instances of this class manages plugin search path entries and plugins.
Plugins can be retrieved as #Plugin objects, loaded and unloaded.
Plugins names are constructed from the shared library file name up to the first dot in the file name. Common shared library prefixes are stripped. E.g. libfoo.0.9.so will have the name foo.
Manager instances are not thread-safe and access needs to be synchronized.
|
private |
|
private |
rsc::plugins::Manager::Manager | ( | ) |
Definition at line 47 of file Manager.cpp.
|
virtual |
Definition at line 52 of file Manager.cpp.
void rsc::plugins::Manager::addPath | ( | const boost::filesystem::path & | path | ) |
Adds path to the list of search path entries.
path | A #boost::filesystem::path designating a directory which should be searched for plugins. |
exception | If path does not exist or is otherwise inaccessible. |
runtime_error | If the path contains a plugin which has the same plugin name as other already loaded plugins. This might also happen for two plugins in the same directory. |
Definition at line 59 of file Manager.cpp.
References rsc::plugins::Plugin::create(), logger, path, plugins, RSCINFO, and RSCTRACE.
vector< path > rsc::plugins::Manager::getPath | ( | ) | const |
Returns the current plugin search path.
Definition at line 55 of file Manager.cpp.
References path.
PluginPtr rsc::plugins::Manager::getPlugin | ( | const std::string & | name | ) | const |
Return the plugin designated by name.
name | The name of the plugin which should be returned. |
NoSuchObject | If name does not designate a plugin. |
Definition at line 147 of file Manager.cpp.
References plugins.
set< PluginPtr > rsc::plugins::Manager::getPlugins | ( | const boost::regex & | regex = boost::regex(".*") | ) | const |
Returns the set of known plugins, potentially filtered by name according to regular expression regex.
regex | A regular expression object which is matched against plugin names, causing only matching plugin to be returned. |
Definition at line 131 of file Manager.cpp.
References plugins.
Referenced by getPlugins().
set< PluginPtr > rsc::plugins::Manager::getPlugins | ( | const std::string & | regex | ) | const |
Returns the set of known plugins, filtered by name according to regular expression regex.
regex | A regular expression string which is matched against plugin names, causing only matching plugin to be returned. |
Definition at line 143 of file Manager.cpp.
References getPlugins().
|
private |
|
private |
|
private |
Definition at line 127 of file Manager.h.
Referenced by addPath(), getPlugin(), and getPlugins().