charon-core  0.3.1
PluginManager Class Reference

Manages ParameteredObject based plugins and their instances. More...

#include <charon-core/PluginManager.h>

Inheritance diagram for PluginManager:

Public Member Functions

 PluginManager (const std::vector< std::string > &pluginPaths, bool debugSuffix=DEFAULT_DEBUG_SUFFIX, bool initializeOnLoad=false, PluginVersionCheckLevel versionInfo=PluginVersionIgnore)
 default constructor More...
 
 PluginManager (const std::string &globalPath, const std::string &localPath="", bool debugSuffix=DEFAULT_DEBUG_SUFFIX, bool initializeOnLoad=false, PluginVersionCheckLevel versionInfo=PluginVersionIgnore)
 default constructor More...
 
virtual ~PluginManager ()
 default destructor More...
 
void createDynamicMetadata (const ParameterFile &paramFile, const std::string &filePrefix)
 generate plugin metadata for dynamic plugins and store to given path More...
 
void createDynamicMetadata (const std::string &pluginName, const ParameterFile &paramFile, const std::string &fileName)
 generate plugin metadata for a single dynamic plugin and store to given file name More...
 
ParameteredObjectcreateInstance (std::string pluginName, ParameteredObject::template_type t, std::string instanceName="") throw (AbstractPluginLoader::PluginException)
 Create a new instance of a plugin. More...
 
ParameteredObjectcreateInstance (const std::string &pluginName, const std::string &instanceName="") throw (AbstractPluginLoader::PluginException)
 Create a new instance of a plugin. More...
 
void createMetadata (const std::string &targetPath="")
 generate plugin metadata and store to given path More...
 
void destroyInstance (ParameteredObject *toDestroy) throw (AbstractPluginLoader::PluginException)
 Delete an instance of a loaded plugin. More...
 
std::list< ParameteredObject * > determineExecutionOrder ()
 Determine execution order. More...
 
charon_DEPRECATED void executeWorkflow ()
 for compatibility, use runWorkflow instead
 
ParameteredObject::template_type getDefaultTemplateType () const
 Get the default template type property. More...
 
ParameteredObjectgetInstance (const std::string &instanceName) const throw (AbstractPluginLoader::PluginException)
 get an existing instance of a loaded plugin. More...
 
size_t getInstancesCount () const
 number of handled instances
 
size_t getLoadedPluginsCount () const
 number of loaded plugins
 
const std::map< std::string,
ParameteredObject * > & 
getObjectList () const
 Get names of existing instances. More...
 
const std::vector< std::string > & getPluginPaths () const
 Gets the plugin paths.
 
virtual bool initializePluginOnLoad () const
 
void insertInstance (ParameteredObject *instance)
 Insert an existing parametered object instance. More...
 
bool isLoaded (const std::string &name) const
 Checks if a plugin is loaded. More...
 
void loadParameterFile (const ParameterFile &pf)
 Reads a parameter file. More...
 
void loadParameterFile (const std::string &path)
 Reads a parameter file. More...
 
void loadPlugin (std::string name) throw (AbstractPluginLoader::PluginException)
 Loads a plugin stored in the previously declared folder. More...
 
void reset ()
 reset plugin manager More...
 
void resetExecuted ()
 Set the executed flags of the objects to false. More...
 
void runWorkflow ()
 run whole workflow More...
 
void saveParameterFile (ParameterFile &paramFile) const
 save parameters and connections of all managed plugins More...
 
void saveParameterFile (const std::string &path) const
 save parameters and connections of all managed plugins More...
 
void setDefaultTemplateType (ParameteredObject::template_type t)
 Set the default template type property. More...
 
void setExcludeList (const std::vector< std::string > &list)
 set exclude list
 
virtual void setInitiailizePluginOnLoad (bool initOnLoad)
 
virtual std::string templateTypeToString (ParameteredObject::template_type t) const
 Converts template_type to std::string. More...
 
void unloadPlugin (const std::string &name) throw (AbstractPluginLoader::PluginException)
 Unloads a plugin. More...
 
- Public Member Functions inherited from PluginManagerInterface
virtual ~PluginManagerInterface ()
 Default destructor.
 

Private Member Functions

void _destroyAllInstances (PLUGIN_LOADER *p)
 Deletes all instances of a loaded plugin. More...
 
std::list< ParameteredObject * > _determineTargetPoints ()
 Look for execution target points. More...
 
bool _generateMetadataForPlugin (const std::string &pluginName, const std::string &filename)
 Creates metadata information for a specific plugin. More...
 
void _unloadAllPlugins ()
 Unloads all Plugins and destroys all instances.
 
void _unloadPlugin (PLUGIN_LOADER *p, bool erase=true)
 Unloads a plugin and destroys instances. More...
 
bool isInternal (ParameteredObject *obj)
 Check if parametered object is an internal object.
 

Private Attributes

ParameteredObject::template_type _defaultTemplateType
 current default template type.
 
std::vector< std::string > _excludeList
 exclude list for metadata generation
 
bool _initializePluginOnLoad
 
std::map< ParameteredObject
*, PLUGIN_LOADER * > 
_instances
 Links the instances to their PluginLoader. More...
 
std::map< std::string,
PLUGIN_LOADER * > 
_loadedPlugins
 Saves the currently loaded plugins.
 
PluginVersionCheckLevel _versionInfo
 load plugin regardless of version information in the library file
 
std::string libSuffix
 Lib suffix e.g. _d for debug builds.
 
std::map< std::string,
ParameteredObject * > 
objects
 currently existing instances that are handled by this PluginManager
 
std::vector< std::string > pluginPaths
 Paths where the plugins are stored.
 

Formerly part of the ParameteredObject class

void _getConnected (std::set< std::string > &visited, const std::set< std::string > &cur) const
 Recurse into object list and find connected objects. More...
 
void _getConnected (std::set< std::string > &visited, const std::set< std::string > &cur, const ParameterFile &pf) const
 Recurse into object list and find connected objects. More...
 
std::set< std::string > getNeighbours (const std::string &root) const
 Convenience function to get neighbours of given object. More...
 
std::set< std::string > getNeighbours (const std::string &root, const ParameterFile &pf) const
 Convenience function to get neighbours of given object. More...
 
virtual std::set< std::string > getConnected (const std::string &root, const ParameterFile &pf) const
 Recurse into object list and find connected objects. More...
 
std::set< std::string > getConnected (const std::string &root) const
 Recurse into object list and find connected objects. More...
 
std::set< std::string > getConnected (ParameterFile &pf, ParameteredObject *obj) const
 parameterFile version of getConnected(const std::string&) const
 
bool connect (Slot &slot1, Slot &slot2)
 Connect slots. More...
 
bool connect (Slot *slot1, Slot *slot2)
 Same method, but taking pointers. More...
 
bool connect (const std::string &slot1, const std::string &slot2)
 Connect slots by name. More...
 
bool disconnect (Slot &slot1, Slot &slot2)
 Disconnect slots. More...
 
bool disconnect (const std::string &slot1, const std::string &slot2)
 Disconnect slots by name. More...
 

Additional Inherited Members

- Public Types inherited from PluginManagerInterface
enum  PluginVersionCheckLevel { PluginVersionIgnore = 0, PluginVersionWarn = 1, PluginVersionDiscard = 2 }
 info how to handle version information
 

Detailed Description

Offers methods to

  • load and unload plugins
  • create and destroy instances of plugins
  • load parameter files and execute the discribed workflow
  • write parameter files
  • generation of metadata descriptions, for usual and dynamic modules

Also, some methods which were previously members of the ParameteredObject class are now members of this class.

Plugin Manager Paths

There may be multiple paths where Plugins are located. These paths have to be given to the PluginManager constructor. For compatibility reasons, there are constructors taking two paths (global and local path) as arguments, but arbitrary numbers of paths may be given to the stringlist versions of the constructor.

If using the two-paths version, note that the local path (if given) gets a higher priority than the global path. I.e. if the same Module exists twice (in global and local path) the local one is found first and will be used in workflows.

If using the stringlist version of the constructor, the paths are searched in the order as given.

Plugins with Debug suffix

To be able to use plugins in their debug and release build configuration side by side, it is possible to name the debug library with the suffix _d. Regarding a plugin called example, the libraries could be named e.g. example.dll and example_d.dll (Win/MSVC) or e.g. libexample.so and libexample_d.so (Linux/GCC). Since the names are different, both versions may be placed side by side in the same folder.

A mechanism to create the libraries easily this way is provided by the CMake variable CMAKE_DEBUG_SUFFIX (see CMake Documentation for more information).

This line should be added to your main CMakeLists.txt (i.e. located in the top folder) to split up your debug/release libraries:

PROJECT(...)
[...]
SET(CMAKE_DEBUG_POSTFIX _d)
[...]

Which version of the libraries is preferred may be given to the PluginManager constructor using the debugSuffix parameter:

If this parameter is set to true (default on Debug builds), libraries with debug suffix are preferred (i.e. if both versions exist, the suffixed module will be loaded. If only one of them exists, there is no choice, the found one will be loaded).

If debugSuffix is set to false (default on Release builds), suffixed modules are completely ignored (even if only a suffixed file is found, it will not be loaded).

Warning
If the plugins are built with MSVC, it is essential, that libraries and executables built in Debug/Release mode are not mixed with each other. Otherwise there may be application crashes at runtime because of different versions of the STL implementations (e.g. std::string). The debug suffix mechanism provides a way to avoid this mixture. The default value for the debugSuffix parameter is set to true on debug builds and to false on release builds. Specifying this parameter manually is useful only on unix builds where this mixture causes less or no problems.

Metadata Generation

Per default, all generated plugins are created with their metadata description stored within the ParameteredObject. It can be retrieved via ParameteredObject::getMetadata(). Calling ParameteredObject::clearMetadata(), the metadata cache is cleared e.g. to save space. In the PluginManager, all created plugins are shipped with their metadata. The only exception is on loading a whole workflow file. I.e. loadParameterFile(const ParameterFile&) and loadParameterFile(const std::string&) delete the metadata information, because they are usually called just before running a workflow.

Definition at line 141 of file PluginManager.h.

Constructor & Destructor Documentation

PluginManager::PluginManager ( const std::vector< std::string > &  pluginPaths,
bool  debugSuffix = DEFAULT_DEBUG_SUFFIX,
bool  initializeOnLoad = false,
PluginVersionCheckLevel  versionInfo = PluginVersionIgnore 
)

Creates a new PluginManager instance and sets the path to the plugins to the value of pluginPaths.

Parameters
pluginPathsPaths where the plugins are stored. Search order as given.
debugSuffixLook for libraries with debug suffix (_d), fallback to libs without suffix.
initializeOnLoadask Gerald
versionInfoen/disable additional version check for plugins

Definition at line 31 of file PluginManager.cpp.

References libSuffix, and pluginPaths.

PluginManager::PluginManager ( const std::string &  globalPath,
const std::string &  localPath = "",
bool  debugSuffix = DEFAULT_DEBUG_SUFFIX,
bool  initializeOnLoad = false,
PluginVersionCheckLevel  versionInfo = PluginVersionIgnore 
)

Creates a new PluginManager instance and sets the path to the plugins to the value of path1 and path2. This is a convenience function to preserve compatibility to the old non-vector style call.

Parameters
globalPath,localPathPaths where the plugins are stored. localPath is searched first.
debugSuffixLook for libraries with debug suffix (_d), fallback to libs without suffix.
initializeOnLoadask Gerald
versionInfoset how to handle version check on plugin load

Definition at line 44 of file PluginManager.cpp.

References libSuffix, and pluginPaths.

PluginManager::~PluginManager ( )
virtual

Deletes all existing instances of any loaded plugin and then unloads all plugins. Frees the memory.

Definition at line 833 of file PluginManager.cpp.

References reset().

Member Function Documentation

void PluginManager::_destroyAllInstances ( PLUGIN_LOADER p)
private
Parameters
pPlugin loader which has created the instances

Definition at line 63 of file PluginManager.cpp.

References _instances, and objects.

std::list< ParameteredObject * > PluginManager::_determineTargetPoints ( )
private

Iterates through the currently existing instances and looks for target points. Every instance which has no connected output slots is considered to be a target point.

Returns
list of target objects

Definition at line 762 of file PluginManager.cpp.

References objects, and sout.

bool PluginManager::_generateMetadataForPlugin ( const std::string &  pluginName,
const std::string &  filename 
)
private

Loads the plugin (if not already loaded), creates an instance of the plugin and destroys it immediately. If the plugin was not already loaded, unloads the plugin afterwards. The metadata information is stored in a parameter text file called "${targetPath}/${pluginName}.wrp"

Parameters
pluginNameName of the plugin (without prefix or extension)
filenamePath to a file to store the metadata info
Returns
true if the plugin was loaded successfully, false otherwise

Definition at line 698 of file PluginManager.cpp.

References createInstance(), destroyInstance(), AbstractPluginLoader::PluginException::getErrorCode(), ParameteredObject::getMetadata(), AbstractPluginLoader::PluginException::getPluginName(), AbstractPluginLoader::PluginException::INVALID_PLUGIN_FORMAT, isLoaded(), loadPlugin(), ParameterFile::save(), sout, unloadPlugin(), and AbstractPluginLoader::PluginException::VERSION_INFORMATION_MISSING.

void PluginManager::_getConnected ( std::set< std::string > &  visited,
const std::set< std::string > &  cur 
) const
private
Parameters
visitedList of visited objects (= result)
curList of objects to look for neighbours

Definition at line 377 of file PluginManager.cpp.

References getNeighbours().

void PluginManager::_getConnected ( std::set< std::string > &  visited,
const std::set< std::string > &  cur,
const ParameterFile pf 
) const
private

This search is based on the parameterfile content instead of the real existing connections.

Parameters
visitedList of visited objects (= result)
curList of objects to look for neighbours
pfParameterFile to read connections from.

Definition at line 404 of file PluginManager.cpp.

References _getConnected(), and getNeighbours().

void PluginManager::_unloadPlugin ( PLUGIN_LOADER p,
bool  erase = true 
)
private
Parameters
pPlugin zo unload
eraseIf true, erases the plugin from map

Definition at line 99 of file PluginManager.cpp.

References _destroyAllInstances(), _loadedPlugins, and StringTool::toLowerCase().

bool PluginManager::connect ( Slot slot1,
Slot slot2 
)

Both slots are connected with each other.

Parameters
slot1Slot1 (in or out)
slot2Slot2 (out or in)
Return values
trueoperation successful

Definition at line 469 of file PluginManager.cpp.

References Slot::connect(), ParameteredObject::getInputSlots(), Slot::getName(), ParameteredObject::getOutputSlots(), Slot::getParent(), Slot::printWarning(), and sout.

bool PluginManager::connect ( Slot slot1,
Slot slot2 
)
Parameters
slot1Slot1 (in or out)
slot2Slot2 (out or in)
Return values
trueoperation successful

Definition at line 502 of file PluginManager.cpp.

References connect().

bool PluginManager::connect ( const std::string &  slot1,
const std::string &  slot2 
)

You have to provide the slot names as "objectname.slotname", i.e. the same way you find them in the parameter file. Both slots are connected with each other. You have to make sure, that both objects already exist.

Parameters
slot1Slot1 (e.g. "object1.slot1")
slot2Slot2 (e.g. "object2.slot1")
Return values
trueoperation successful

Definition at line 506 of file PluginManager.cpp.

References connect(), objects, Slot::printWarning(), and sout.

void PluginManager::createDynamicMetadata ( const ParameterFile paramFile,
const std::string &  filePrefix 
)

Creates metadata of all dynamic plugins in given parameter file. FilePrefix should be some/file_prefix instead of some/file_prefix.wrp since this method writes the metadata into some/file_prefix_instance_name.wrp

The given parameter file is passed to the dynamic modules' prepareDynamicInterface function to add metadata for the parameter/slots in the scope of a dynamic plugin instance.

See Also
ParameteredObject::prepareDynamicInterface(const ParameterFile&)
Parameters
paramFileParameterFile containing parameters for plugin
filePrefixFile prefix to determine save file names

Definition at line 886 of file PluginManager.cpp.

References _defaultTemplateType, createInstance(), destroyInstance(), ParameterFile::get(), ParameterFile::getKeyList(), ParameteredObject::getMetadata(), isLoaded(), ParameterFile::isSet(), loadPlugin(), ParameteredObject::prepareDynamicInterface(), ParameterFile::save(), sout, ParameteredObject::TYPE_DOUBLE, ParameteredObject::TYPE_FLOAT, ParameteredObject::TYPE_INT, and unloadPlugin().

void PluginManager::createDynamicMetadata ( const std::string &  pluginName,
const ParameterFile paramFile,
const std::string &  fileName 
)

Creates metadata of dynamic plugin based on parameter file

Parameters
pluginNameName of dynamic plugin
paramFileParameterFile containing parameters for plugin
fileNameFile in which to save metadata

Definition at line 943 of file PluginManager.cpp.

References createInstance(), destroyInstance(), AbstractPluginLoader::PluginException::getErrorCode(), ParameteredObject::getMetadata(), AbstractPluginLoader::PluginException::getPluginName(), AbstractPluginLoader::PluginException::INVALID_PLUGIN_FORMAT, isLoaded(), loadPlugin(), ParameteredObject::prepareDynamicInterface(), ParameterFile::save(), sout, and unloadPlugin().

ParameteredObject * PluginManager::createInstance ( std::string  pluginName,
ParameteredObject::template_type  t,
std::string  instanceName = "" 
)
throw (AbstractPluginLoader::PluginException
)

If the requested plugin isn't loaded yet, PluginManager will try to load it. If the instance name is an empty string, a unique name will be generated.

Warning
: Do NOT call delete on an instance of a loaded plugin, use the given method destroyInstance() instead.

The generated instance is shipped with it's metdata information.

See Also
destroyInstance(ParameteredObject *)
AbstractPluginLoader::createInstance()
UnixPluginLoader::createInstance()
WindowsPluginLoader::createInstance()
Parameters
pluginNameName of the plugin
tTemplate type.
instanceNameName of the instance
Returns
Pointer to a new instance

Definition at line 174 of file PluginManager.cpp.

References AbstractPluginLoader::PluginException::DUPLICATE_INSTANCE_NAME, ParameteredObject::getName(), ParameteredObject::getTemplateType(), PLUGIN_LOADER, sout, and StringTool::toLowerCase().

ParameteredObject * PluginManager::createInstance ( const std::string &  pluginName,
const std::string &  instanceName = "" 
)
throw (AbstractPluginLoader::PluginException
)

Same Method as above but allowing to leave the template type out. Current default template type will be used (initially, it's ParameteredObject::TYPE_DOUBLE).

See Also
createInstance(const std::string &, const std::string &, const template_type t)
Parameters
pluginNameName of the plugin
instanceNameName of the instance
Returns
Pointer to a new instance

Definition at line 214 of file PluginManager.cpp.

void PluginManager::createMetadata ( const std::string &  targetPath = "")

Iterates through the plugins available inside the plugin path and creates metadata information for them.

Parameters
targetPathPath to save the metadata files to. Defaults to the plugin path if empty.

Definition at line 621 of file PluginManager.cpp.

References _excludeList, _generateMetadataForPlugin(), FileTool::changeDir(), FileTool::getCurrentDir(), FileTool::getFilesWithSuffix(), PLUGIN_EXTENSION, pluginPaths, and sout.

void PluginManager::destroyInstance ( ParameteredObject toDestroy)
throw (AbstractPluginLoader::PluginException
)

Calls the Destructor the instance.

Warning
Do NOT call delete on an instance of a loaded plugin, use this method instead. You also don't have to call this method because all existing instances will be deleted as a plugin is unloaded or as you call delete on an instance of the PluginManager.
See Also
createInstance()
Parameters
toDestroyPointer to an instance of a plugin

Definition at line 220 of file PluginManager.cpp.

References AbstractPluginLoader::PluginException::NO_SUCH_INSTANCE, and sout.

std::list< ParameteredObject * > PluginManager::determineExecutionOrder ( )

Get topological sorted list of module instance names, i.e. an order of instances where each instance depends on predecessors only. This means that input slots of the objects are connected to preceeding objects only. If an object is executed multiple times, the first execution counts.

Returns
list of executed objects

Definition at line 793 of file PluginManager.cpp.

References _determineTargetPoints(), ParameteredObject::getInputSlots(), and FileTool::remove().

bool PluginManager::disconnect ( Slot slot1,
Slot slot2 
)

Both slots are disconnected from each other.

Parameters
slot1Slot1 (in or out)
slot2Slot2 (out or in)
Return values
trueoperation successful

Definition at line 561 of file PluginManager.cpp.

References Slot::disconnect().

bool PluginManager::disconnect ( const std::string &  slot1,
const std::string &  slot2 
)

You have to provide the slot names as "objectname.slotname", i.e. the same way you find them in the parameter file. Both slots are disconnected with each other.

Parameters
slot1Slot1 (e.g. "object1.slot1")
slot2Slot2 (e.g. "object2.slot1")
Return values
trueoperation successful

Definition at line 565 of file PluginManager.cpp.

References disconnect(), objects, Slot::printWarning(), and sout.

std::set< std::string > PluginManager::getConnected ( const std::string &  root,
const ParameterFile pf 
) const
virtual

This is based on the content of the given ParameterFile, i.e. the connected objects need not to exist really. This is also independend of the existing connections of the current object, it is only based on the connections saved in the parameter file. Nonexistent objects are created, so you have to make sure, that the object factory is up and running. The root object itself is also part of the connected component.

Parameters
rootStarting point for connected object search
pfParameterFile to read connections from.
Returns
set of connected object names

Implements PluginManagerInterface.

Definition at line 450 of file PluginManager.cpp.

References _getConnected(), and getNeighbours().

std::set< std::string > PluginManager::getConnected ( const std::string &  root) const

This is based on the "real" slot connections, i.e. independend of some parameter file content. The root object itself is also part of the connected component.

Parameters
rootStarting point for connected object search
Returns
set of connected object names

Definition at line 460 of file PluginManager.cpp.

References _getConnected(), and getNeighbours().

ParameteredObject::template_type PluginManager::getDefaultTemplateType ( ) const

Returns the current default template type property. Initially, it is set to ParameteredObject::TYPE_DOUBLE.

See Also
setDefaultTemplateType()
Returns
Default template type property

Definition at line 349 of file PluginManager.cpp.

References _defaultTemplateType.

ParameteredObject * PluginManager::getInstance ( const std::string &  instanceName) const
throw (AbstractPluginLoader::PluginException
)
virtual
Parameters
instanceNameName of the instance
Returns
Pointer to the requested instance

Implements PluginManagerInterface.

Definition at line 160 of file PluginManager.cpp.

References AbstractPluginLoader::PluginException::NO_SUCH_INSTANCE.

std::set< std::string > PluginManager::getNeighbours ( const std::string &  root) const
Parameters
rootname of the root object to start neighbour search
Returns
set of neighbour object names

Definition at line 431 of file PluginManager.cpp.

References objects.

std::set< std::string > PluginManager::getNeighbours ( const std::string &  root,
const ParameterFile pf 
) const
Parameters
rootname of the root object to start neighbour search
pfParameterFile to read connections from.
Returns
set of neighbour object names

Definition at line 440 of file PluginManager.cpp.

References objects.

const std::map<std::string, ParameteredObject *>& PluginManager::getObjectList ( ) const
inline
Returns
Map containing all existing instances

Definition at line 324 of file PluginManager.h.

void PluginManager::insertInstance ( ParameteredObject instance)
Warning
Inserted instance will be managed by pluginmanager. E. g. it will be deleted on PluginManager::reset(). The instance name must be unique within the PluginManager scope. On name conflicts, a runtime_error will be thrown.
Parameters
instanceInstance to insert.

Definition at line 842 of file PluginManager.cpp.

References ParameteredObject::getName(), and objects.

bool PluginManager::isLoaded ( const std::string &  name) const
Parameters
namename of the plugin
Returns
true if the plugin is loaded

Definition at line 147 of file PluginManager.cpp.

References _loadedPlugins, and StringTool::toLowerCase().

void PluginManager::loadParameterFile ( const ParameterFile pf)
  • reads out the default template type property (if given)
  • loads the required plugins
  • creates the requested instances
  • clears their metadata cache to save space
  • connects the slots
  • reads out the target points (if existing)
Parameters
pfParameterFile to load from
Returns
Map linking the instance names to the created instances

Definition at line 251 of file PluginManager.cpp.

References _defaultTemplateType, ParameteredObject::clearMetadata(), createInstance(), ParameterFile::get(), ParameterFile::getKeyList(), isLoaded(), ParameterFile::isSet(), loadPlugin(), objects, ParameteredObject::prepareDynamicInterface(), reset(), sout, TypeDetector::type(), ParameteredObject::TYPE_DOUBLE, ParameteredObject::TYPE_FLOAT, and ParameteredObject::TYPE_INT.

void PluginManager::loadParameterFile ( const std::string &  path)

Same method as above, but loads a ParameterFile from the given path.

See Also
loadParameterFile(const ParameterFile&)
Parameters
pathPath to the parameter file
Returns
Map linking the instance names to the created instances

Definition at line 317 of file PluginManager.cpp.

References loadParameterFile().

void PluginManager::loadPlugin ( std::string  name)
throw (AbstractPluginLoader::PluginException
)
Warning
Do NOT call delete on an instance of a loaded plugin, use the given method destroyInstance(ParameteredObject *) instead.
See Also
unloadPlugin(const std::string &)
AbstractPluginLoader::load()
UnixPluginLoader::load()
WindowsPluginLoader::load()
Parameters
namethe file name of the plugin

Definition at line 110 of file PluginManager.cpp.

References AbstractPluginLoader::PluginException::ALREADY_LOADED, PLUGIN_LOADER, sout, and StringTool::toLowerCase().

void PluginManager::reset ( )

Resets this PluginManager instance to its initial state. Unloads all plugins, resets defaultTemplateType parameter and deletes target points.

Definition at line 757 of file PluginManager.cpp.

References _defaultTemplateType, _unloadAllPlugins(), and ParameteredObject::TYPE_DOUBLE.

void PluginManager::resetExecuted ( )

This function leaves the objects otherwise untouched

Definition at line 863 of file PluginManager.cpp.

References objects, and AbstractPluginLoader::PluginException::OTHER.

void PluginManager::runWorkflow ( )

Calls run() on every target point.

See Also
addTargetPoint(ParameteredObject *)

Definition at line 359 of file PluginManager.cpp.

References _determineTargetPoints(), and AbstractPluginLoader::PluginException::OTHER.

void PluginManager::saveParameterFile ( ParameterFile paramFile) const

Save content of all currently loaded instances to the given ParameterFile. All registered parameters and slot connections are saved.

Warning
This deletes the content of the given ParameterFile.
Parameters
paramFileParameterFile to save to

Definition at line 321 of file PluginManager.cpp.

References _defaultTemplateType, objects, ParameterFile::set(), and templateTypeToString().

void PluginManager::saveParameterFile ( const std::string &  path) const

Same method, but writes the file to the given path.

Warning
This deletes the content of the given ParameterFile.
Parameters
pathPath where the parameter file should be saved.

Definition at line 343 of file PluginManager.cpp.

References ParameterFile::save(), and saveParameterFile().

void PluginManager::setDefaultTemplateType ( ParameteredObject::template_type  t)

New instances created without explicitly specifying another tempate type are created using this template type. Initially, the value is set to ParameteredObject::TYPE_DOUBLE.

Parameters
tNew default template type

Definition at line 353 of file PluginManager.cpp.

References _defaultTemplateType.

std::string PluginManager::templateTypeToString ( ParameteredObject::template_type  t) const
virtual
Parameters
ttemplate type to convert
Returns
string representation of t

Implements PluginManagerInterface.

Definition at line 992 of file PluginManager.cpp.

References ParameteredObject::TYPE_DOUBLE, ParameteredObject::TYPE_FLOAT, and ParameteredObject::TYPE_INT.

void PluginManager::unloadPlugin ( const std::string &  name)
throw (AbstractPluginLoader::PluginException
)
Warning
All instances of the plugin become obsolete and will be deleted therefore.
See Also
loadPlugin(const std::string &)
AbstractPluginLoader::unload()
UnixPluginLoader::unload()
WindowsPluginLoader::unload()
Parameters
nameName of the plugin

Definition at line 135 of file PluginManager.cpp.

References AbstractPluginLoader::PluginException::PLUGIN_NOT_LOADED, and StringTool::toLowerCase().

Member Data Documentation

std::map<ParameteredObject*, PLUGIN_LOADER*> PluginManager::_instances
private

so the PluginManager can determine of which type the instance is

Definition at line 154 of file PluginManager.h.


The documentation for this class was generated from the following files: