Classes | |
class | AbstractMetaObject |
Abstract base class for factories where polymorphic type variable indicates base class for plugin interface. B The base class interface for the plugin. More... | |
class | AbstractMetaObjectBase |
A base class for MetaObjects that excludes a polymorphic type parameter. Subclasses are class templates though. More... | |
class | MetaObject |
The actual factory. C The derived class (the actual plugin) B The base class interface for the plugin. More... | |
Typedefs | |
typedef std::string | BaseClassName |
typedef std::map< BaseClassName, FactoryMap > | BaseToFactoryMapMap |
typedef std::vector< class_loader::ClassLoader * > | ClassLoaderVector |
typedef std::string | ClassName |
typedef std::map< ClassName, impl::AbstractMetaObjectBase * > | FactoryMap |
typedef std::pair< LibraryPath, Poco::SharedLibrary * > | LibraryPair |
typedef std::string | LibraryPath |
typedef std::vector< LibraryPair > | LibraryVector |
typedef std::vector< AbstractMetaObjectBase * > | MetaObjectVector |
Functions | |
void | addClassLoaderOwnerForAllExistingMetaObjectsForLibrary (const std::string &library_path, ClassLoader *loader) |
MetaObjectVector | allMetaObjects (const FactoryMap &factories) |
MetaObjectVector | allMetaObjects () |
MetaObjectVector | allMetaObjectsForClassLoader (const ClassLoader *owner) |
MetaObjectVector | allMetaObjectsForLibrary (const std::string &library_path) |
MetaObjectVector | allMetaObjectsForLibraryOwnedBy (const std::string &library_path, const ClassLoader *owner) |
bool | areThereAnyExistingMetaObjectsForLibrary (const std::string &library_path) |
template<typename Base > | |
Base * | createInstance (const std::string &derived_class_name, ClassLoader *loader) |
This function creates an instance of a plugin class given the derived name of the class and returns a pointer of the Base class type. More... | |
void | destroyMetaObjectsForLibrary (const std::string &library_path, FactoryMap &factories, const ClassLoader *loader) |
void | destroyMetaObjectsForLibrary (const std::string &library_path, const ClassLoader *loader) |
MetaObjectVector | filterAllMetaObjectsAssociatedWithLibrary (const MetaObjectVector &to_filter, const std::string &library_path) |
MetaObjectVector | filterAllMetaObjectsOwnedBy (const MetaObjectVector &to_filter, const ClassLoader *owner) |
LibraryVector::iterator | findLoadedLibrary (const std::string &library_path) |
CLASS_LOADER_PUBLIC std::vector< std::string > | getAllLibrariesUsedByClassLoader (const ClassLoader *loader) |
This function returns the names of all libraries in use by a given class loader. More... | |
template<typename Base > | |
std::vector< std::string > | getAvailableClasses (ClassLoader *loader) |
This function returns all the available class_loader in the plugin system that are derived from Base and within scope of the passed ClassLoader. More... | |
CLASS_LOADER_PUBLIC ClassLoader * | getCurrentlyActiveClassLoader () |
Gets the ClassLoader currently in scope which used when a library is being loaded. More... | |
ClassLoader *& | getCurrentlyActiveClassLoaderReference () |
CLASS_LOADER_PUBLIC std::string | getCurrentlyLoadingLibraryName () |
When a library is being loaded, in order for factories to know which library they are being associated with, they use this function to query which library is being loaded. More... | |
std::string & | getCurrentlyLoadingLibraryNameReference () |
CLASS_LOADER_PUBLIC FactoryMap & | getFactoryMapForBaseClass (const std::string &typeid_base_class_name) |
This function extracts a reference to the FactoryMap for appropriate base class out of the global plugin base to factory map. This function should be used by functions in this namespace that need to access the various factories so as to make sure the right key is generated to index into the global map. More... | |
template<typename Base > | |
FactoryMap & | getFactoryMapForBaseClass () |
Same as above but uses a type parameter instead of string for more safety if info is available. More... | |
CLASS_LOADER_PUBLIC BaseToFactoryMapMap & | getGlobalPluginBaseToFactoryMapMap () |
Gets a handle to a global data structure that holds a map of base class names (Base class describes plugin interface) to a FactoryMap which holds the factories for the various different concrete classes that can be instantiated. Note that the Base class is NOT THE LITERAL CLASSNAME, but rather the result of typeid(Base).name() which sometimes is the literal class name (as on Windows) but is often in mangled form (as on Linux). More... | |
CLASS_LOADER_PUBLIC LibraryVector & | getLoadedLibraryVector () |
Gets a handle to a list of open libraries in the form of LibraryPairs which encode the library path+name and the handle to the underlying Poco::SharedLibrary. More... | |
CLASS_LOADER_PUBLIC boost::recursive_mutex & | getLoadedLibraryVectorMutex () |
To provide thread safety, all exposed plugin functions can only be run serially by multiple threads. This is implemented by using critical sections enforced by a single mutex which is locked and released with the following two functions. More... | |
MetaObjectVector & | getMetaObjectGraveyard () |
CLASS_LOADER_PUBLIC boost::recursive_mutex & | getPluginBaseToFactoryMapMapMutex () |
CLASS_LOADER_PUBLIC bool | hasANonPurePluginLibraryBeenOpened () |
Indicates if a library containing more than just plugins has been opened by the running process. More... | |
CLASS_LOADER_PUBLIC void | hasANonPurePluginLibraryBeenOpened (bool hasIt) |
Sets a flag indicating if a library containing more than just plugins has been opened by the running process. More... | |
bool & | hasANonPurePluginLibraryBeenOpenedReference () |
void | insertMetaObjectIntoGraveyard (AbstractMetaObjectBase *meta_obj) |
CLASS_LOADER_PUBLIC bool | isLibraryLoaded (const std::string &library_path, ClassLoader *loader) |
Indicates if passed library loaded within scope of a ClassLoader. The library maybe loaded in memory, but to the class loader it may not be. More... | |
CLASS_LOADER_PUBLIC bool | isLibraryLoadedByAnybody (const std::string &library_path) |
Indicates if passed library has been loaded by ANY ClassLoader. More... | |
CLASS_LOADER_PUBLIC void | loadLibrary (const std::string &library_path, ClassLoader *loader) |
Loads a library into memory if it has not already been done so. Attempting to load an already loaded library has no effect. More... | |
CLASS_LOADER_PUBLIC void | printDebugInfoToScreen () |
void | purgeGraveyardOfMetaobjects (const std::string &library_path, ClassLoader *loader, bool delete_objs) |
template<typename Derived , typename Base > | |
void | registerPlugin (const std::string &class_name, const std::string &base_class_name) |
This function is called by the CLASS_LOADER_REGISTER_CLASS macro in plugin_register_macro.h to register factories. Classes that use that macro will cause this function to be invoked when the library is loaded. The function will create a MetaObject (i.e. factory) for the corresponding Derived class and insert it into the appropriate FactoryMap in the global Base-to-FactoryMap map. Note that the passed class_name is the literal class name and not the mangled version. More... | |
void | revivePreviouslyCreateMetaobjectsFromGraveyard (const std::string &library_path, ClassLoader *loader) |
CLASS_LOADER_PUBLIC void | setCurrentlyActiveClassLoader (ClassLoader *loader) |
Sets the ClassLoader currently in scope which used when a library is being loaded. More... | |
CLASS_LOADER_PUBLIC void | setCurrentlyLoadingLibraryName (const std::string &library_name) |
When a library is being loaded, in order for factories to know which library they are being associated with, this function is called to set the name of the library currently being loaded. More... | |
CLASS_LOADER_PUBLIC void | unloadLibrary (const std::string &library_path, ClassLoader *loader) |
Unloads a library if it loaded in memory and cleans up its corresponding class factories. If it is not loaded, the function has no effect. More... | |
typedef std::string class_loader::impl::BaseClassName |
Definition at line 69 of file class_loader_core.hpp.
typedef std::map<BaseClassName, FactoryMap> class_loader::impl::BaseToFactoryMapMap |
Definition at line 71 of file class_loader_core.hpp.
typedef std::vector<class_loader::ClassLoader *> class_loader::impl::ClassLoaderVector |
Definition at line 53 of file meta_object.hpp.
typedef std::string class_loader::impl::ClassName |
Definition at line 68 of file class_loader_core.hpp.
typedef std::map<ClassName, impl::AbstractMetaObjectBase *> class_loader::impl::FactoryMap |
Definition at line 70 of file class_loader_core.hpp.
typedef std::pair<LibraryPath, Poco::SharedLibrary *> class_loader::impl::LibraryPair |
Definition at line 72 of file class_loader_core.hpp.
typedef std::string class_loader::impl::LibraryPath |
Definition at line 67 of file class_loader_core.hpp.
typedef std::vector<LibraryPair> class_loader::impl::LibraryVector |
Definition at line 73 of file class_loader_core.hpp.
typedef std::vector<AbstractMetaObjectBase *> class_loader::impl::MetaObjectVector |
Definition at line 74 of file class_loader_core.hpp.
void class_loader::impl::addClassLoaderOwnerForAllExistingMetaObjectsForLibrary | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Definition at line 333 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::allMetaObjects | ( | const FactoryMap & | factories | ) |
Definition at line 142 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::allMetaObjects | ( | ) |
Definition at line 151 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::allMetaObjectsForClassLoader | ( | const ClassLoader * | owner | ) |
Definition at line 192 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::allMetaObjectsForLibrary | ( | const std::string & | library_path | ) |
Definition at line 198 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::allMetaObjectsForLibraryOwnedBy | ( | const std::string & | library_path, |
const ClassLoader * | owner | ||
) |
Definition at line 204 of file class_loader_core.cpp.
bool class_loader::impl::areThereAnyExistingMetaObjectsForLibrary | ( | const std::string & | library_path | ) |
Definition at line 272 of file class_loader_core.cpp.
Base* class_loader::impl::createInstance | ( | const std::string & | derived_class_name, |
ClassLoader * | loader | ||
) |
This function creates an instance of a plugin class given the derived name of the class and returns a pointer of the Base class type.
derived_class_name | - The name of the derived class (unmangled) |
loader | - The ClassLoader whose scope we are within |
Definition at line 244 of file class_loader_core.hpp.
void class_loader::impl::destroyMetaObjectsForLibrary | ( | const std::string & | library_path, |
FactoryMap & | factories, | ||
const ClassLoader * | loader | ||
) |
Definition at line 219 of file class_loader_core.cpp.
void class_loader::impl::destroyMetaObjectsForLibrary | ( | const std::string & | library_path, |
const ClassLoader * | loader | ||
) |
Definition at line 253 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::filterAllMetaObjectsAssociatedWithLibrary | ( | const MetaObjectVector & | to_filter, |
const std::string & | library_path | ||
) |
Definition at line 179 of file class_loader_core.cpp.
MetaObjectVector class_loader::impl::filterAllMetaObjectsOwnedBy | ( | const MetaObjectVector & | to_filter, |
const ClassLoader * | owner | ||
) |
Definition at line 167 of file class_loader_core.cpp.
LibraryVector::iterator class_loader::impl::findLoadedLibrary | ( | const std::string & | library_path | ) |
Definition at line 278 of file class_loader_core.cpp.
std::vector< std::string > class_loader::impl::getAllLibrariesUsedByClassLoader | ( | const ClassLoader * | loader | ) |
This function returns the names of all libraries in use by a given class loader.
loader | - The ClassLoader whose scope we are within |
Definition at line 317 of file class_loader_core.cpp.
std::vector<std::string> class_loader::impl::getAvailableClasses | ( | ClassLoader * | loader | ) |
This function returns all the available class_loader in the plugin system that are derived from Base and within scope of the passed ClassLoader.
loader | - The pointer to the ClassLoader whose scope we are within, |
Definition at line 296 of file class_loader_core.hpp.
ClassLoader * class_loader::impl::getCurrentlyActiveClassLoader | ( | ) |
Gets the ClassLoader currently in scope which used when a library is being loaded.
Definition at line 112 of file class_loader_core.cpp.
ClassLoader* & class_loader::impl::getCurrentlyActiveClassLoaderReference | ( | ) |
Definition at line 106 of file class_loader_core.cpp.
std::string class_loader::impl::getCurrentlyLoadingLibraryName | ( | ) |
When a library is being loaded, in order for factories to know which library they are being associated with, they use this function to query which library is being loaded.
Definition at line 95 of file class_loader_core.cpp.
std::string& class_loader::impl::getCurrentlyLoadingLibraryNameReference | ( | ) |
Definition at line 89 of file class_loader_core.cpp.
FactoryMap & class_loader::impl::getFactoryMapForBaseClass | ( | const std::string & | typeid_base_class_name | ) |
This function extracts a reference to the FactoryMap for appropriate base class out of the global plugin base to factory map. This function should be used by functions in this namespace that need to access the various factories so as to make sure the right key is generated to index into the global map.
Definition at line 66 of file class_loader_core.cpp.
FactoryMap& class_loader::impl::getFactoryMapForBaseClass | ( | ) |
Same as above but uses a type parameter instead of string for more safety if info is available.
Definition at line 138 of file class_loader_core.hpp.
BaseToFactoryMapMap & class_loader::impl::getGlobalPluginBaseToFactoryMapMap | ( | ) |
Gets a handle to a global data structure that holds a map of base class names (Base class describes plugin interface) to a FactoryMap which holds the factories for the various different concrete classes that can be instantiated. Note that the Base class is NOT THE LITERAL CLASSNAME, but rather the result of typeid(Base).name() which sometimes is the literal class name (as on Windows) but is often in mangled form (as on Linux).
Definition at line 60 of file class_loader_core.cpp.
LibraryVector & class_loader::impl::getLoadedLibraryVector | ( | ) |
Gets a handle to a list of open libraries in the form of LibraryPairs which encode the library path+name and the handle to the underlying Poco::SharedLibrary.
Definition at line 83 of file class_loader_core.cpp.
boost::recursive_mutex & class_loader::impl::getLoadedLibraryVectorMutex | ( | ) |
To provide thread safety, all exposed plugin functions can only be run serially by multiple threads. This is implemented by using critical sections enforced by a single mutex which is locked and released with the following two functions.
Definition at line 48 of file class_loader_core.cpp.
MetaObjectVector& class_loader::impl::getMetaObjectGraveyard | ( | ) |
Definition at line 77 of file class_loader_core.cpp.
boost::recursive_mutex & class_loader::impl::getPluginBaseToFactoryMapMapMutex | ( | ) |
Definition at line 54 of file class_loader_core.cpp.
bool class_loader::impl::hasANonPurePluginLibraryBeenOpened | ( | ) |
Indicates if a library containing more than just plugins has been opened by the running process.
Definition at line 129 of file class_loader_core.cpp.
void class_loader::impl::hasANonPurePluginLibraryBeenOpened | ( | bool | hasIt | ) |
Sets a flag indicating if a library containing more than just plugins has been opened by the running process.
hasIt | - The flag |
Definition at line 134 of file class_loader_core.cpp.
bool& class_loader::impl::hasANonPurePluginLibraryBeenOpenedReference | ( | ) |
Definition at line 123 of file class_loader_core.cpp.
void class_loader::impl::insertMetaObjectIntoGraveyard | ( | AbstractMetaObjectBase * | meta_obj | ) |
Definition at line 209 of file class_loader_core.cpp.
bool class_loader::impl::isLibraryLoaded | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Indicates if passed library loaded within scope of a ClassLoader. The library maybe loaded in memory, but to the class loader it may not be.
library_path | - The name of the library we wish to check is open |
loader | - The pointer to the ClassLoader whose scope we are within |
Definition at line 304 of file class_loader_core.cpp.
bool class_loader::impl::isLibraryLoadedByAnybody | ( | const std::string & | library_path | ) |
Indicates if passed library has been loaded by ANY ClassLoader.
library_path | - The name of the library we wish to check is open |
Definition at line 289 of file class_loader_core.cpp.
void class_loader::impl::loadLibrary | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Loads a library into memory if it has not already been done so. Attempting to load an already loaded library has no effect.
library_path | - The name of the library to open |
loader | - The pointer to the ClassLoader whose scope we are within |
Definition at line 428 of file class_loader_core.cpp.
void class_loader::impl::printDebugInfoToScreen | ( | ) |
Definition at line 567 of file class_loader_core.cpp.
void class_loader::impl::purgeGraveyardOfMetaobjects | ( | const std::string & | library_path, |
ClassLoader * | loader, | ||
bool | delete_objs | ||
) |
Definition at line 374 of file class_loader_core.cpp.
void class_loader::impl::registerPlugin | ( | const std::string & | class_name, |
const std::string & | base_class_name | ||
) |
This function is called by the CLASS_LOADER_REGISTER_CLASS macro in plugin_register_macro.h to register factories. Classes that use that macro will cause this function to be invoked when the library is loaded. The function will create a MetaObject (i.e. factory) for the corresponding Derived class and insert it into the appropriate FactoryMap in the global Base-to-FactoryMap map. Note that the passed class_name is the literal class name and not the mangled version.
Derived | - parameteric type indicating concrete type of plugin |
Base | - parameteric type indicating base type of plugin |
class_name | - the literal name of the class being registered (NOT MANGLED) |
Definition at line 176 of file class_loader_core.hpp.
void class_loader::impl::revivePreviouslyCreateMetaobjectsFromGraveyard | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Definition at line 350 of file class_loader_core.cpp.
void class_loader::impl::setCurrentlyActiveClassLoader | ( | ClassLoader * | loader | ) |
Sets the ClassLoader currently in scope which used when a library is being loaded.
loader | - pointer to the currently active ClassLoader. |
Definition at line 117 of file class_loader_core.cpp.
void class_loader::impl::setCurrentlyLoadingLibraryName | ( | const std::string & | library_name | ) |
When a library is being loaded, in order for factories to know which library they are being associated with, this function is called to set the name of the library currently being loaded.
library_name | - The name of library that is being loaded currently |
Definition at line 100 of file class_loader_core.cpp.
void class_loader::impl::unloadLibrary | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Unloads a library if it loaded in memory and cleans up its corresponding class factories. If it is not loaded, the function has no effect.
library_path | - The name of the library to open |
loader | - The pointer to the ClassLoader whose scope we are within |
Definition at line 508 of file class_loader_core.cpp.