#include <BasicPluginManager.h>

Public Types | |
| typedef std::list < BasicPluginInfo * > | infos_t |
Public Member Functions | |
| BasicPluginManager (bool preloadDeps=false) | |
| virtual | ~BasicPluginManager () |
| virtual void | init (T *plugin) |
| void | destroyPlugin (std::string pluginName) |
| void | unload () |
| Deallocate all plugins in the correct order. | |
| void | closeLibraries () |
| Close all shared library handles. | |
| bool | dependsOn (std::string plugin1, std::string plugin2) |
| T * | get (const std::string pluginName, bool *_pluginAlreadyRegisteredFlag=0) |
| bool | isLoaded (std::string pluginName) |
| |
| const BasicPluginInfo * | getPluginInfo (const std::string pluginName) |
| |
| infos_t & | getPluginInfos () |
| void | loadLibraries (const std::string path) |
| void | loadLibrary (const std::string filename) |
| void | registerPlugin (BasicPluginInfo *info, BasicClassFactoryBase< T > *factory) |
| void | setPluginException (BasicException e) |
Static Public Attributes | |
| static const char | libExtension [] = ".so" |
| May need to ifdef this for windows dlls. | |
Protected Member Functions | |
| BasicClassFactoryBase < T > * | getPluginFactory (const std::string pluginName) |
| |
| plugins_t & | getPluginMapBPM () |
| void | loadSingleLibraryPath (const std::string path) |
Private Types | |
| typedef std::map < std::string, BasicClassFactoryBase < T > * > | factories_t |
| typedef std::map < std::string, BasicPluginInfo * > | infoMap_t |
| typedef std::map < std::string, T * > | plugins_t |
| typedef std::map < std::string, void * > | libraryHandles_t |
Private Attributes | |
| factories_t | factories |
| A map from plugin name to registered factory. | |
| infoMap_t | infoMap |
| A map from plugin name to registered info. | |
| plugins_t | plugins |
| A map from plugin name to plugin instance. | |
| libraryHandles_t | libraryHandles |
| A map of loaded library handles. | |
| infos_t | infos |
| A list of plugin info structures. | |
| BasicException * | pluginException |
| Holds exceptions thrown by plugins on dlopen. | |
| bool | preloadDeps |
| If true dependencies will be loaded first. | |
Definition at line 40 of file BasicPluginManager.h.
| typedef std::list<BasicPluginInfo *> BasicPluginManager< T >::infos_t |
Definition at line 42 of file BasicPluginManager.h.
typedef std::map<std::string, BasicClassFactoryBase<T> *> BasicPluginManager< T >::factories_t [private] |
Definition at line 46 of file BasicPluginManager.h.
typedef std::map<std::string, BasicPluginInfo *> BasicPluginManager< T >::infoMap_t [private] |
Definition at line 47 of file BasicPluginManager.h.
typedef std::map<std::string, T *> BasicPluginManager< T >::plugins_t [private] |
Reimplemented in CompuCell3D::PluginManager< PluginType >, CompuCell3D::PluginManager< CompuCell3D::Steppable >, and CompuCell3D::PluginManager< CompuCell3D::Plugin >.
Definition at line 48 of file BasicPluginManager.h.
typedef std::map<std::string, void *> BasicPluginManager< T >::libraryHandles_t [private] |
Definition at line 49 of file BasicPluginManager.h.
| BasicPluginManager< T >::BasicPluginManager | ( | bool | preloadDeps = false |
) | [inline] |
Definition at line 77 of file BasicPluginManager.h.
| virtual BasicPluginManager< T >::~BasicPluginManager | ( | ) | [inline, virtual] |
Destruct the plugin manager. Deallocates all plugins and closes all plugin libraries.
Definition at line 84 of file BasicPluginManager.h.
| virtual void BasicPluginManager< T >::init | ( | T * | plugin | ) | [inline, virtual] |
Initialization function called when a plugin is first loaded. Child classes should over load this function for type specific plugin initialization.
| plugin | The plugin to initialize. |
Reimplemented in CompuCell3D::PluginManager< PluginType >, CompuCell3D::PluginManager< CompuCell3D::Steppable >, and CompuCell3D::PluginManager< CompuCell3D::Plugin >.
Definition at line 107 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::get().
| void BasicPluginManager< T >::destroyPlugin | ( | std::string | pluginName | ) | [inline] |
Deallocate a specific plugin.
Definition at line 112 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::destroyPlugin(), and BasicPluginManager< CompuCell3D::Plugin >::unload().
| void BasicPluginManager< T >::unload | ( | ) | [inline] |
Deallocate all plugins in the correct order.
Definition at line 130 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::~BasicPluginManager().
| void BasicPluginManager< T >::closeLibraries | ( | ) | [inline] |
Close all shared library handles.
Definition at line 138 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::~BasicPluginManager().
| bool BasicPluginManager< T >::dependsOn | ( | std::string | plugin1, | |
| std::string | plugin2 | |||
| ) | [inline] |
If plugin1 has not yet been registered this function will return false;
Definition at line 152 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::dependsOn(), BasicPluginManager< CompuCell3D::Plugin >::destroyPlugin(), and BasicPluginManager< CompuCell3D::Plugin >::registerPlugin().
| T* BasicPluginManager< T >::get | ( | const std::string | pluginName, | |
| bool * | _pluginAlreadyRegisteredFlag = 0 | |||
| ) | [inline] |
Get a pointer to a named plugin. If an instance has not yet been allocated it will be created. If the plugin name is unknown a BasicException will be thrown.
| pluginName | The name of the plugin. |
Definition at line 174 of file BasicPluginManager.h.
| bool BasicPluginManager< T >::isLoaded | ( | std::string | pluginName | ) | [inline] |
| pluginName | is loaded. |
Definition at line 206 of file BasicPluginManager.h.
| const BasicPluginInfo* BasicPluginManager< T >::getPluginInfo | ( | const std::string | pluginName | ) | [inline] |
Definition at line 211 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::get().
| infos_t& BasicPluginManager< T >::getPluginInfos | ( | ) | [inline] |
Definition at line 222 of file BasicPluginManager.h.
| void BasicPluginManager< T >::loadLibraries | ( | const std::string | path | ) | [inline] |
Loads all plugin libraries on a ':' separated path list.
| path | The plugin library path list. |
Definition at line 230 of file BasicPluginManager.h.
| void BasicPluginManager< T >::loadLibrary | ( | const std::string | filename | ) | [inline] |
Load a plugin library.
| filename | Path to plugin library. |
Definition at line 248 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::loadSingleLibraryPath().
| void BasicPluginManager< T >::registerPlugin | ( | BasicPluginInfo * | info, | |
| BasicClassFactoryBase< T > * | factory | |||
| ) | [inline] |
Called by BasicPluginProxy to register itself with the manager.
| info | A pointer to a new plugin info structure. | |
| factory | A pointer to a new plugin class factory. |
Definition at line 280 of file BasicPluginManager.h.
Referenced by BasicPluginProxy< B, T >::init().
| void BasicPluginManager< T >::setPluginException | ( | BasicException | e | ) | [inline] |
Used by statically allocated plugins to pass any exceptions back to the library loader.
Definition at line 312 of file BasicPluginManager.h.
Referenced by BasicPluginProxy< B, T >::init().
| BasicClassFactoryBase<T>* BasicPluginManager< T >::getPluginFactory | ( | const std::string | pluginName | ) | [inline, protected] |
Definition at line 322 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::destroyPlugin(), and BasicPluginManager< CompuCell3D::Plugin >::get().
| plugins_t& BasicPluginManager< T >::getPluginMapBPM | ( | ) | [inline, protected] |
Definition at line 330 of file BasicPluginManager.h.
Referenced by CompuCell3D::PluginManager< CompuCell3D::Plugin >::getPluginMap().
| void BasicPluginManager< T >::loadSingleLibraryPath | ( | const std::string | path | ) | [inline, protected] |
Loads all libraries on a single path.
| path | A single path. |
Definition at line 336 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::loadLibraries().
factories_t BasicPluginManager< T >::factories [private] |
A map from plugin name to registered factory.
Definition at line 52 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::getPluginFactory(), BasicPluginManager< CompuCell3D::Plugin >::registerPlugin(), and BasicPluginManager< CompuCell3D::Plugin >::~BasicPluginManager().
infoMap_t BasicPluginManager< T >::infoMap [private] |
A map from plugin name to registered info.
Definition at line 55 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::dependsOn(), BasicPluginManager< CompuCell3D::Plugin >::getPluginInfo(), and BasicPluginManager< CompuCell3D::Plugin >::registerPlugin().
plugins_t BasicPluginManager< T >::plugins [private] |
A map from plugin name to plugin instance.
Definition at line 58 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::destroyPlugin(), BasicPluginManager< CompuCell3D::Plugin >::get(), BasicPluginManager< CompuCell3D::Plugin >::getPluginMapBPM(), BasicPluginManager< CompuCell3D::Plugin >::isLoaded(), and BasicPluginManager< CompuCell3D::Plugin >::unload().
libraryHandles_t BasicPluginManager< T >::libraryHandles [private] |
A map of loaded library handles.
Definition at line 61 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::closeLibraries(), and BasicPluginManager< CompuCell3D::Plugin >::loadLibrary().
infos_t BasicPluginManager< T >::infos [private] |
A list of plugin info structures.
Definition at line 64 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::getPluginInfos(), BasicPluginManager< CompuCell3D::Plugin >::registerPlugin(), and BasicPluginManager< CompuCell3D::Plugin >::~BasicPluginManager().
BasicException* BasicPluginManager< T >::pluginException [private] |
Holds exceptions thrown by plugins on dlopen.
Definition at line 67 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::loadLibrary(), and BasicPluginManager< CompuCell3D::Plugin >::setPluginException().
bool BasicPluginManager< T >::preloadDeps [private] |
If true dependencies will be loaded first.
Definition at line 70 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::get().
const char BasicPluginManager< T >::libExtension = ".so" [inline, static] |
May need to ifdef this for windows dlls.
Definition at line 74 of file BasicPluginManager.h.
Referenced by BasicPluginManager< CompuCell3D::Plugin >::loadSingleLibraryPath().
1.5.3