#include <plugin_manager.hpp>
Classes | |
class | map_type |
data type that maps identifiers to plug-in objects More... | |
Public Types | |
typedef boost::function1< void, PluginType * > | PluginRunFunction |
data type for a function that may be called by the run() method | |
typedef boost::function1 < boost::uint64_t, const PluginType * > | PluginStatFunction |
data type for a function that may be called by the getStat() method | |
Public Member Functions | |
plugin_manager (void) | |
default constructor | |
virtual | ~plugin_manager () |
default destructor | |
void | clear (void) |
clears all the plug-in objects being managed | |
bool | empty (void) const |
returns true if there are no plug-in objects being managed | |
void | add (const std::string &plugin_id, PluginType *plugin_object_ptr) |
void | remove (const std::string &plugin_id) |
void | replace (const std::string &plugin_id, PluginType *plugin_ptr) |
PluginType * | clone (const std::string &plugin_id) |
PluginType * | load (const std::string &plugin_id, const std::string &plugin_type) |
PluginType * | get (const std::string &plugin_id) |
const PluginType * | get (const std::string &plugin_id) const |
plugin_ptr< PluginType > | get_lib_ptr (const std::string &plugin_id) const |
PluginType * | find (const std::string &resource) |
void | run (PluginRunFunction run_func) |
void | run (const std::string &plugin_id, PluginRunFunction run_func) |
boost::uint64_t | get_statistic (PluginStatFunction stat_func) const |
boost::uint64_t | get_statistic (const std::string &plugin_id, PluginStatFunction stat_func) const |
Protected Attributes | |
map_type | m_plugin_map |
collection of plug-in objects being managed | |
boost::mutex | m_plugin_mutex |
mutex to make class thread-safe |
plugin_manager: used to manage a collection of plug-in objects
Definition at line 31 of file plugin_manager.hpp.
void pion::plugin_manager< PluginType >::add | ( | const std::string & | plugin_id, | |
PluginType * | plugin_object_ptr | |||
) | [inline] |
adds a new plug-in object
plugin_id | unique identifier associated with the plug-in | |
plugin_object_ptr | pointer to the plug-in object to add |
Definition at line 188 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
Referenced by pion::http::plugin_server::add_service().
PluginType * pion::plugin_manager< PluginType >::clone | ( | const std::string & | plugin_id | ) | [inline] |
clones an existing plug-in object (creates a new one of the same type)
plugin_id | unique identifier associated with the plug-in |
Definition at line 229 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
PluginType * pion::plugin_manager< PluginType >::find | ( | const std::string & | resource | ) | [inline] |
finds the plug-in object associated with a particular resource (fuzzy match)
resource | resource identifier (uri-stem) to search for |
Definition at line 295 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
const PluginType * pion::plugin_manager< PluginType >::get | ( | const std::string & | plugin_id | ) | const [inline] |
gets the plug-in object associated with a particular plugin_id (exact match)
plugin_id | unique identifier associated with the plug-in |
Definition at line 273 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
PluginType * pion::plugin_manager< PluginType >::get | ( | const std::string & | plugin_id | ) | [inline] |
gets the plug-in object associated with a particular plugin_id (exact match)
plugin_id | unique identifier associated with the plug-in |
Definition at line 262 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
plugin_ptr< PluginType > pion::plugin_manager< PluginType >::get_lib_ptr | ( | const std::string & | plugin_id | ) | const [inline] |
gets a smart pointer to the plugin shared library for a particular plugin_id (exact match)
plugin_id | unique identifier associated with the plug-in |
Definition at line 284 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
boost::uint64_t pion::plugin_manager< PluginType >::get_statistic | ( | const std::string & | plugin_id, | |
PluginStatFunction | stat_func | |||
) | const [inline] |
returns a statistic value for a particular plug-in
plugin_id | unique identifier associated with the plug-in | |
stat_func | the statistic function to execute |
Definition at line 372 of file plugin_manager.hpp.
boost::uint64_t pion::plugin_manager< PluginType >::get_statistic | ( | PluginStatFunction | stat_func | ) | const [inline] |
returns a total statistic value summed for every plug-in being managed
stat_func | the statistic function to execute for each plug-in object |
Definition at line 359 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
PluginType * pion::plugin_manager< PluginType >::load | ( | const std::string & | plugin_id, | |
const std::string & | plugin_type | |||
) | [inline] |
loads a new plug-in object
plugin_id | unique identifier associated with the plug-in | |
plugin_type | the name or type of the plug-in to load (searches plug-in directories and appends extensions) |
Definition at line 239 of file plugin_manager.hpp.
References pion::plugin_ptr< InterfaceClassType >::create(), pion::plugin_manager< PluginType >::m_plugin_map, pion::plugin_manager< PluginType >::m_plugin_mutex, and pion::plugin::open().
Referenced by pion::http::plugin_server::load_service().
void pion::plugin_manager< PluginType >::remove | ( | const std::string & | plugin_id | ) | [inline] |
removes a plug-in object
plugin_id | unique identifier associated with the plug-in |
Definition at line 198 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
void pion::plugin_manager< PluginType >::replace | ( | const std::string & | plugin_id, | |
PluginType * | plugin_ptr | |||
) | [inline] |
replaces an existing plug-in object with a new one
plugin_id | unique identifier associated with the plug-in | |
plugin_ptr | pointer to the new plug-in object which will replace the old one |
Definition at line 213 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
void pion::plugin_manager< PluginType >::run | ( | const std::string & | plugin_id, | |
PluginRunFunction | run_func | |||
) | [inline] |
runs a method for a particular plug-in
plugin_id | unique identifier associated with the plug-in | |
run_func | the function to execute |
Definition at line 348 of file plugin_manager.hpp.
void pion::plugin_manager< PluginType >::run | ( | PluginRunFunction | run_func | ) | [inline] |
runs a method for every plug-in being managed
run_func | the function to execute for each plug-in object |
Definition at line 337 of file plugin_manager.hpp.
References pion::plugin_manager< PluginType >::m_plugin_map, and pion::plugin_manager< PluginType >::m_plugin_mutex.
Referenced by pion::http::plugin_server::set_service_option().