pion-net
4.0.9
|
#include <PluginManager.hpp>
Classes | |
class | DuplicatePluginException |
exception thrown if we try to add or load a duplicate plug-in More... | |
class | PluginMap |
data type that maps identifiers to plug-in objects More... | |
class | PluginNotFoundException |
exception thrown if a plug-in cannot be found More... | |
Public Types | |
typedef boost::function1< void, PLUGIN_TYPE * > | PluginRunFunction |
data type for a function that may be called by the run() method | |
typedef boost::function1 < boost::uint64_t, const PLUGIN_TYPE * > | PluginStatFunction |
data type for a function that may be called by the getStat() method | |
Public Member Functions | |
PluginManager (void) | |
default constructor | |
virtual | ~PluginManager () |
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, PLUGIN_TYPE *plugin_object_ptr) |
void | remove (const std::string &plugin_id) |
void | replace (const std::string &plugin_id, PLUGIN_TYPE *plugin_ptr) |
PLUGIN_TYPE * | clone (const std::string &plugin_id) |
PLUGIN_TYPE * | load (const std::string &plugin_id, const std::string &plugin_type) |
PLUGIN_TYPE * | get (const std::string &plugin_id) |
const PLUGIN_TYPE * | get (const std::string &plugin_id) const |
PionPluginPtr< PLUGIN_TYPE > | getLibPtr (const std::string &plugin_id) const |
PLUGIN_TYPE * | find (const std::string &resource) |
void | run (PluginRunFunction run_func) |
void | run (const std::string &plugin_id, PluginRunFunction run_func) |
boost::uint64_t | getStatistic (PluginStatFunction stat_func) const |
boost::uint64_t | getStatistic (const std::string &plugin_id, PluginStatFunction stat_func) const |
Protected Attributes | |
PluginMap | m_plugin_map |
collection of plug-in objects being managed | |
boost::mutex | m_plugin_mutex |
mutex to make class thread-safe |
PluginManager: used to manage a collection of plug-in objects
Definition at line 30 of file PluginManager.hpp.
void pion::PluginManager< PLUGIN_TYPE >::add | ( | const std::string & | plugin_id, |
PLUGIN_TYPE * | 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 201 of file PluginManager.hpp.
Referenced by pion::net::WebServer::addService().
PLUGIN_TYPE * pion::PluginManager< PLUGIN_TYPE >::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 242 of file PluginManager.hpp.
References pion::PluginManager< PLUGIN_TYPE >::find().
PLUGIN_TYPE * pion::PluginManager< PLUGIN_TYPE >::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 319 of file PluginManager.hpp.
Referenced by pion::PluginManager< PLUGIN_TYPE >::clone(), pion::PluginManager< PLUGIN_TYPE >::get(), pion::PluginManager< PLUGIN_TYPE >::getLibPtr(), pion::PluginManager< PLUGIN_TYPE >::remove(), and pion::PluginManager< PLUGIN_TYPE >::replace().
PLUGIN_TYPE * pion::PluginManager< PLUGIN_TYPE >::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 286 of file PluginManager.hpp.
References pion::PluginManager< PLUGIN_TYPE >::find().
const PLUGIN_TYPE * pion::PluginManager< PLUGIN_TYPE >::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 297 of file PluginManager.hpp.
References pion::PluginManager< PLUGIN_TYPE >::find().
PionPluginPtr< PLUGIN_TYPE > pion::PluginManager< PLUGIN_TYPE >::getLibPtr | ( | 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 308 of file PluginManager.hpp.
References pion::PluginManager< PLUGIN_TYPE >::find().
boost::uint64_t pion::PluginManager< PLUGIN_TYPE >::getStatistic | ( | 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 383 of file PluginManager.hpp.
boost::uint64_t pion::PluginManager< PLUGIN_TYPE >::getStatistic | ( | 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 396 of file PluginManager.hpp.
PLUGIN_TYPE * pion::PluginManager< PLUGIN_TYPE >::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 252 of file PluginManager.hpp.
References pion::PionPluginPtr< InterfaceClassType >::create(), pion::PionPlugin::findStaticEntryPoint(), pion::PionPlugin::open(), and pion::PionPlugin::openStaticLinked().
Referenced by pion::net::WebServer::loadService().
void pion::PluginManager< PLUGIN_TYPE >::remove | ( | const std::string & | plugin_id | ) | [inline] |
removes a plug-in object
plugin_id | unique identifier associated with the plug-in |
Definition at line 211 of file PluginManager.hpp.
References pion::PluginManager< PLUGIN_TYPE >::find().
void pion::PluginManager< PLUGIN_TYPE >::replace | ( | const std::string & | plugin_id, |
PLUGIN_TYPE * | 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 226 of file PluginManager.hpp.
References pion::PluginManager< PLUGIN_TYPE >::find().
void pion::PluginManager< PLUGIN_TYPE >::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 361 of file PluginManager.hpp.
Referenced by pion::net::WebServer::setServiceOption().
void pion::PluginManager< PLUGIN_TYPE >::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 372 of file PluginManager.hpp.