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, class_loader_private::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. | |
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) |
std::vector< std::string > | getAllLibrariesUsedByClassLoader (const ClassLoader *loader) |
This function returns the names of all libraries in use by a given class loader. | |
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. | |
ClassLoader * | getCurrentlyActiveClassLoader () |
Gets the ClassLoader currently in scope which used when a library is being loaded. | |
ClassLoader *& | getCurrentlyActiveClassLoaderReference () |
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. | |
std::string & | getCurrentlyLoadingLibraryNameReference () |
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. | |
template<typename Base > | |
FactoryMap & | getFactoryMapForBaseClass () |
Same as above but uses a type parameter instead of string for more safety if info is available. | |
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). | |
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. | |
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. | |
MetaObjectVector & | getMetaObjectGraveyard () |
boost::recursive_mutex & | getPluginBaseToFactoryMapMapMutex () |
bool | hasANonPurePluginLibraryBeenOpened () |
Indicates if a library containing more than just plugins has been opened by the running process. | |
void | hasANonPurePluginLibraryBeenOpened (bool hasIt) |
Sets a flag indicating if a library containing more than just plugins has been opened by the running process. | |
bool & | hasANonPurePluginLibraryBeenOpenedReference () |
void | insertMetaObjectIntoGraveyard (AbstractMetaObjectBase *meta_obj) |
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. | |
bool | isLibraryLoadedByAnybody (const std::string &library_path) |
Indicates if passed library has been loaded by ANY ClassLoader. | |
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. | |
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. | |
void | revivePreviouslyCreateMetaobjectsFromGraveyard (const std::string &library_path, ClassLoader *loader) |
void | setCurrentlyActiveClassLoader (ClassLoader *loader) |
Sets the ClassLoader currently in scope which used when a library is being loaded. | |
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. | |
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. |
typedef std::string class_loader::class_loader_private::BaseClassName |
Definition at line 59 of file class_loader_core.h.
typedef std::map<BaseClassName, FactoryMap> class_loader::class_loader_private::BaseToFactoryMapMap |
Definition at line 61 of file class_loader_core.h.
typedef std::vector<class_loader::ClassLoader*> class_loader::class_loader_private::ClassLoaderVector |
Definition at line 49 of file meta_object.h.
typedef std::string class_loader::class_loader_private::ClassName |
Definition at line 58 of file class_loader_core.h.
typedef std::map<ClassName, class_loader_private::AbstractMetaObjectBase*> class_loader::class_loader_private::FactoryMap |
Definition at line 60 of file class_loader_core.h.
typedef std::pair<LibraryPath, Poco::SharedLibrary*> class_loader::class_loader_private::LibraryPair |
Definition at line 62 of file class_loader_core.h.
typedef std::string class_loader::class_loader_private::LibraryPath |
Definition at line 57 of file class_loader_core.h.
typedef std::vector<LibraryPair> class_loader::class_loader_private::LibraryVector |
Definition at line 63 of file class_loader_core.h.
typedef std::vector<AbstractMetaObjectBase*> class_loader::class_loader_private::MetaObjectVector |
Definition at line 64 of file class_loader_core.h.
void class_loader::class_loader_private::addClassLoaderOwnerForAllExistingMetaObjectsForLibrary | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Definition at line 347 of file class_loader_core.cpp.
MetaObjectVector class_loader::class_loader_private::allMetaObjects | ( | const FactoryMap & | factories | ) |
Definition at line 156 of file class_loader_core.cpp.
Definition at line 165 of file class_loader_core.cpp.
MetaObjectVector class_loader::class_loader_private::allMetaObjectsForClassLoader | ( | const ClassLoader * | owner | ) |
Definition at line 202 of file class_loader_core.cpp.
MetaObjectVector class_loader::class_loader_private::allMetaObjectsForLibrary | ( | const std::string & | library_path | ) |
Definition at line 208 of file class_loader_core.cpp.
MetaObjectVector class_loader::class_loader_private::allMetaObjectsForLibraryOwnedBy | ( | const std::string & | library_path, |
const ClassLoader * | owner | ||
) |
Definition at line 214 of file class_loader_core.cpp.
bool class_loader::class_loader_private::areThereAnyExistingMetaObjectsForLibrary | ( | const std::string & | library_path | ) |
Definition at line 276 of file class_loader_core.cpp.
Base* class_loader::class_loader_private::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 194 of file class_loader_core.h.
void class_loader::class_loader_private::destroyMetaObjectsForLibrary | ( | const std::string & | library_path, |
FactoryMap & | factories, | ||
const ClassLoader * | loader | ||
) |
Definition at line 227 of file class_loader_core.cpp.
void class_loader::class_loader_private::destroyMetaObjectsForLibrary | ( | const std::string & | library_path, |
const ClassLoader * | loader | ||
) |
Definition at line 260 of file class_loader_core.cpp.
MetaObjectVector class_loader::class_loader_private::filterAllMetaObjectsAssociatedWithLibrary | ( | const MetaObjectVector & | to_filter, |
const std::string & | library_path | ||
) |
Definition at line 192 of file class_loader_core.cpp.
MetaObjectVector class_loader::class_loader_private::filterAllMetaObjectsOwnedBy | ( | const MetaObjectVector & | to_filter, |
const ClassLoader * | owner | ||
) |
Definition at line 182 of file class_loader_core.cpp.
LibraryVector::iterator class_loader::class_loader_private::findLoadedLibrary | ( | const std::string & | library_path | ) |
Definition at line 286 of file class_loader_core.cpp.
std::vector< std::string > class_loader::class_loader_private::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 327 of file class_loader_core.cpp.
std::vector<std::string> class_loader::class_loader_private::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 235 of file class_loader_core.h.
Gets the ClassLoader currently in scope which used when a library is being loaded.
Definition at line 118 of file class_loader_core.cpp.
Definition at line 111 of file class_loader_core.cpp.
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 98 of file class_loader_core.cpp.
Definition at line 91 of file class_loader_core.cpp.
FactoryMap & class_loader::class_loader_private::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::class_loader_private::getFactoryMapForBaseClass | ( | ) |
Same as above but uses a type parameter instead of string for more safety if info is available.
Definition at line 122 of file class_loader_core.h.
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 59 of file class_loader_core.cpp.
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 84 of file class_loader_core.cpp.
boost::recursive_mutex & class_loader::class_loader_private::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 45 of file class_loader_core.cpp.
Definition at line 77 of file class_loader_core.cpp.
boost::recursive_mutex & class_loader::class_loader_private::getPluginBaseToFactoryMapMapMutex | ( | ) |
Definition at line 52 of file class_loader_core.cpp.
Indicates if a library containing more than just plugins has been opened by the running process.
Definition at line 138 of file class_loader_core.cpp.
void class_loader::class_loader_private::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 144 of file class_loader_core.cpp.
Definition at line 131 of file class_loader_core.cpp.
void class_loader::class_loader_private::insertMetaObjectIntoGraveyard | ( | AbstractMetaObjectBase * | meta_obj | ) |
Definition at line 220 of file class_loader_core.cpp.
bool class_loader::class_loader_private::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 316 of file class_loader_core.cpp.
bool class_loader::class_loader_private::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 299 of file class_loader_core.cpp.
void class_loader::class_loader_private::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 415 of file class_loader_core.cpp.
Definition at line 537 of file class_loader_core.cpp.
void class_loader::class_loader_private::purgeGraveyardOfMetaobjects | ( | const std::string & | library_path, |
ClassLoader * | loader, | ||
bool | delete_objs | ||
) |
Definition at line 380 of file class_loader_core.cpp.
void class_loader::class_loader_private::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 157 of file class_loader_core.h.
void class_loader::class_loader_private::revivePreviouslyCreateMetaobjectsFromGraveyard | ( | const std::string & | library_path, |
ClassLoader * | loader | ||
) |
Definition at line 359 of file class_loader_core.cpp.
void class_loader::class_loader_private::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 124 of file class_loader_core.cpp.
void class_loader::class_loader_private::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 104 of file class_loader_core.cpp.
void class_loader::class_loader_private::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 487 of file class_loader_core.cpp.