24 #ifndef PLUGINMANAGER_H_
25 #define PLUGINMANAGER_H_
35 #if defined(_WIN32) || defined(__WIN32__)
36 #include "WindowsPluginLoader.h"
37 #define PLUGIN_LOADER WindowsPluginLoader
38 #define PLUGIN_EXTENSION ".dll"
42 #define PLUGIN_LOADER UnixPluginLoader
45 #define PLUGIN_EXTENSION ".dylib"
47 #define PLUGIN_EXTENSION ".so"
167 void _unloadAllPlugins();
187 bool _generateMetadataForPlugin(
188 const std::string& pluginName,
189 const std::string& filename);
197 std::list<ParameteredObject*> _determineTargetPoints();
205 void _getConnected(std::set<std::string>& visited,
const std::set<
206 std::string>& cur)
const;
214 void _getConnected(std::set<std::string>& visited,
const std::set<
222 std::map<std::string, ParameteredObject *>
objects;
224 bool _initializePluginOnLoad;
229 #define DEFAULT_DEBUG_SUFFIX false
231 #define DEFAULT_DEBUG_SUFFIX true
246 const std::vector<std::string>& pluginPaths,
248 bool initializeOnLoad=
false,
249 PluginVersionCheckLevel versionInfo=PluginVersionIgnore
266 const std::string& globalPath,
267 const std::string& localPath =
"",
269 bool initializeOnLoad=
false,
270 PluginVersionCheckLevel versionInfo=PluginVersionIgnore
284 void loadPlugin(std::string name)
298 void unloadPlugin(
const std::string & name)
304 bool isLoaded(
const std::string & name)
const;
307 const std::vector<std::string>& getPluginPaths()
const;
310 size_t getLoadedPluginsCount()
const;
313 size_t getInstancesCount()
const;
323 const std::map<std::string, ParameteredObject *>&
351 std::string pluginName,
353 std::string instanceName =
"")
369 const std::
string & instanceName = "")
419 void loadParameterFile(const std::
string& path);
437 void saveParameterFile(const std::
string & path) const;
478 void setExcludeList(
const std::vector<std::string>& list);
482 void resetExecuted();
492 void createMetadata(
const std::string & targetPath =
"");
511 const std::string& filePrefix);
522 void createDynamicMetadata(
const std::string& pluginName,
523 const ParameterFile& paramFile,
const std::string& fileName);
547 std::set<std::string> getNeighbours(
const std::string& root)
const;
554 std::set<std::string> getNeighbours(
const std::string& root,
570 virtual std::set<std::string>
getConnected(
const std::string& root,
580 std::set<std::string>
getConnected(
const std::string& root)
const;
592 bool connect(
Slot& slot1,
Slot& slot2);
599 bool connect(
Slot* slot1,
Slot* slot2);
610 bool connect(
const std::string& slot1,
const std::string& slot2);
618 bool disconnect(
Slot& slot1,
Slot& slot2);
628 bool disconnect(
const std::string& slot1,
const std::string& slot2);
641 std::list<ParameteredObject*> determineExecutionOrder();
643 virtual bool initializePluginOnLoad()
const;
644 virtual void setInitiailizePluginOnLoad (
bool initOnLoad);
#define charon_DEPRECATED
handle deprecated messages on GCC and MSVC
std::string libSuffix
Lib suffix e.g. _d for debug builds.
Interface for a plugin manager.
Manages ParameteredObject based plugins and their instances.
Provides an interface for a plugin manager.
This class serves to store parameters used within the Charon Project.
template_type
Integer which represents a template type.
Base class for serializable objects.
virtual ParameteredObject * getInstance(const std::string &instanceName) const =0
Get an existing instance of a loaded plugin.
Implements a plugin Loader for Unix systems.
ParameteredObject::template_type _defaultTemplateType
current default template type.
std::map< std::string, ParameteredObject * > objects
currently existing instances that are handled by this PluginManager
Declaration of the base class ParameteredObject.
std::map< ParameteredObject *, PLUGIN_LOADER * > _instances
Links the instances to their PluginLoader.
std::map< std::string, PLUGIN_LOADER * > _loadedPlugins
Saves the currently loaded plugins.
charon_DEPRECATED typedef ParameteredObject::template_type template_type
for transition to ParameteredObject::template_type
PluginVersionCheckLevel
info how to handle version information
std::vector< std::string > pluginPaths
Paths where the plugins are stored.
Commom properties of slot objects.
std::vector< std::string > _excludeList
exclude list for metadata generation
const std::map< std::string, ParameteredObject * > & getObjectList() const
Get names of existing instances.
PluginVersionCheckLevel _versionInfo
load plugin regardless of version information in the library file
#define charon_plugins_DLL_PUBLIC
Preprocessor macro to define this class/function as public visible, i.e.
virtual std::set< std::string > getConnected(const std::string &root, const ParameterFile &pf) const =0
Recurse into object list and find connected objects.
virtual std::string templateTypeToString(ParameteredObject::template_type t) const =0
Converts template_type to std::string.
Abstract base class for a plugin loader.
#define DEFAULT_DEBUG_SUFFIX
default lib suffix
#define PLUGIN_LOADER
plugin loader classname (unix/win)