charon-core
0.3.1
|
Abstract base class for a plugin loader. More...
#include <charon-core/AbstractPluginLoader.h>
Classes | |
class | PluginException |
Plugin Exception class. More... | |
Public Member Functions | |
AbstractPluginLoader (const std::string &name, std::vector< std::string > &plpaths, std::string &lSuffix, PluginManagerInterface::PluginVersionCheckLevel versionCheck=PluginManagerInterface::PluginVersionIgnore) | |
Default constructor. More... | |
virtual | ~AbstractPluginLoader () |
Default Destructor. More... | |
virtual ParameteredObject * | createInstance (const std::string &name, ParameteredObject::template_type t=ParameteredObject::TYPE_DOUBLE) throw (PluginException) |
Creates an instance of the loaded plugin and returns a pointer to it. More... | |
virtual void | destroyInstance (ParameteredObject *p) throw (PluginException) |
Deletes an instance of the loaded plugin. More... | |
virtual const std::string & | getName () const |
Get the name of the plugin. More... | |
virtual void | load ()=0 throw (PluginException) |
Loads the plugin. More... | |
virtual void | unload ()=0 throw (PluginException) |
Unloads the plugin. More... | |
Protected Attributes | |
PluginManagerInterface::PluginVersionCheckLevel | _versionCheck |
should the Loader ignore embedded charon-core version strings? | |
ParameteredObject *(* | create )(const std::string &, ParameteredObject::template_type) |
Function pointer to the constructor of the plugin. | |
void(* | destroy )(ParameteredObject *) |
Function pointer to the destructor of the plugin. | |
ParameteredObject::build_type(* | getBuildType )() |
Function pointer to the getBuildType function of the plugin. | |
std::string & | libSuffix |
Lib suffix e.g. _d for debug builds. | |
std::string | pluginName |
The name of the Plugin (without prefix "lib" and without extension) | |
std::vector< std::string > & | pluginPaths |
Paths where the plugins are stored. | |
If you want to develop an own plugin loader, implement this class.
Definition at line 40 of file AbstractPluginLoader.h.
AbstractPluginLoader::AbstractPluginLoader | ( | const std::string & | name, |
std::vector< std::string > & | plpaths, | ||
std::string & | lSuffix, | ||
PluginManagerInterface::PluginVersionCheckLevel | versionCheck = PluginManagerInterface::PluginVersionIgnore |
||
) |
Transforms the given plugin name to lowercase
name | The name of the Plugin (without prefix "lib" and without extension) |
plpaths | list of paths which are searched for the plugin |
lSuffix | suffix which will be appended to the plugin name before search operations. This is typically used to append _d for searching debug libraries. |
versionCheck | en/disable additional version check for plugins |
Definition at line 24 of file AbstractPluginLoader.cpp.
|
virtual |
Unloads the plugin from the memory.
Definition at line 64 of file AbstractPluginLoader.cpp.
|
virtual |
name | Name of the new instance |
t | Template type.
|
AbstractPluginLoader::PluginException |
Definition at line 41 of file AbstractPluginLoader.cpp.
References create().
|
virtual |
p | Pointer to the instance that will be deleted |
AbstractPluginLoader::PluginException |
Definition at line 53 of file AbstractPluginLoader.cpp.
References destroy().
|
virtual |
Definition at line 37 of file AbstractPluginLoader.cpp.
References pluginName.
|
pure virtual |
Loads the shared library referring to the given plugin name into the memory and initializes the function pointers to the constructor and destructor of the plugin.
AbstractPluginLoader::PluginException |
Implemented in WindowsPluginLoader, and UnixPluginLoader.
|
pure virtual |
Removes the shared library from the memory. Existing instances of the plugin will become obsolete.
AbstractPluginLoader::PluginException |
Implemented in WindowsPluginLoader, and UnixPluginLoader.