charon-core
0.3.1
|
Handles ParameteredObject based plugins on Unix based systems. More...
#include <charon-core/UnixPluginLoader.h>
Public Member Functions | |
UnixPluginLoader (const std::string &name, std::vector< std::string > &plpaths, std::string &lSuffix, PluginManagerInterface::PluginVersionCheckLevel versionCheck=PluginManagerInterface::PluginVersionIgnore) | |
Default constructor. More... | |
virtual | ~UnixPluginLoader () |
Default destructor. More... | |
virtual void | load () throw (PluginException) |
Loads the plugin. More... | |
virtual void | unload () throw (PluginException) |
Unloads the plugin. More... | |
Public Member Functions inherited from AbstractPluginLoader | |
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... | |
Private Attributes | |
void * | libHandle |
Points to the loaded library. | |
Additional Inherited Members | |
Protected Attributes inherited from AbstractPluginLoader | |
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. | |
The UnixPluginLoader can load plugins based on the ParameteredObject class on Unix systems like Linux or Mac OS X. It it based on the abstract class AbstractPluginLoader. You usually don't need to use this class directly. The PluginManager class handles this for you.
Definition at line 40 of file UnixPluginLoader.h.
UnixPluginLoader::UnixPluginLoader | ( | const std::string & | name, |
std::vector< std::string > & | plpaths, | ||
std::string & | lSuffix, | ||
PluginManagerInterface::PluginVersionCheckLevel | versionCheck = PluginManagerInterface::PluginVersionIgnore |
||
) |
Definition at line 42 of file UnixPluginLoader.cpp.
|
virtual |
Unloads the plugin from the memory
Definition at line 297 of file UnixPluginLoader.cpp.
|
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 |
Implements AbstractPluginLoader.
Definition at line 52 of file UnixPluginLoader.cpp.
References AbstractPluginLoader::_versionCheck, CHARON_CORE_VERSION, CHARON_CORE_VERSION_MAJOR, CHARON_CORE_VERSION_MINOR, CHARON_CORE_VERSION_PATCH, AbstractPluginLoader::create, AbstractPluginLoader::destroy, FileTool::exists(), AbstractPluginLoader::PluginException::FILE_DAMAGED, AbstractPluginLoader::PluginException::FILE_NOT_FOUND, AbstractPluginLoader::PluginException::INVALID_PLUGIN_FORMAT, libHandle, LIBRARY_EXTENSION, AbstractPluginLoader::libSuffix, AbstractPluginLoader::pluginName, AbstractPluginLoader::pluginPaths, sout, AbstractPluginLoader::PluginException::VERSION_INFORMATION_MISSING, and AbstractPluginLoader::PluginException::VERSION_MISSMATCH.
|
virtual |
Removes the shared library from the memory. Existing instances of the plugin will become obsolete.
AbstractPluginLoader::PluginException |
Implements AbstractPluginLoader.
Definition at line 275 of file UnixPluginLoader.cpp.
References AbstractPluginLoader::create, AbstractPluginLoader::destroy, libHandle, AbstractPluginLoader::PluginException::PLUGIN_NOT_LOADED, AbstractPluginLoader::pluginName, and sout.