ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | List of all members
PluginFactory< T > Class Template Reference

Plugin Factory. More...

#include <PluginFactory.h>

Public Member Functions

void registerPlugin (createInstanceFunc *createInstance)
 Register an output plugin. More...
 
void registerDefaultPlugins ()
 Register a plugin. More...
 
std::vector< std::string > getPluginNames ()
 Get all names of registered plugins.
 
T * create (std::string pluginname)
 Create a new instance of plugin.
 
long enablePlugins (std::list< PluginBase * > &_plugins, XMLfileUnits &xmlconfig, std::string category, Domain *_domain)
 
void registerDefaultPlugins ()
 Register all default plugins with base PluginBase. More...
 
long enablePlugins (std::list< PluginBase * > &_plugins, XMLfileUnits &xmlconfig, std::string category, Domain *_domain)
 Enable selected plugins.
 

Detailed Description

template<typename T>
class PluginFactory< T >

Plugin Factory.

Provides a common interface to register plugins based on the template given as parameter. The interface must include the following method:

virtual std::string getPluginName() = 0; // return the name of the plugin
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270

Also each plugin has to implement the following static method:

static T* createInstance() { return new MyPlugin(); } // return an instance object

Plugins are registered in the PluginFactory constructor using the REGISTER_PLUGIN(NAME) macro.

Member Function Documentation

◆ registerDefaultPlugins() [1/2]

void PluginFactory< PluginBase >::registerDefaultPlugins ( )

Register all default plugins with base PluginBase.

Parameters
createInstancepointer to a function returning an instance of the plugin object.

◆ registerDefaultPlugins() [2/2]

template<typename T >
void PluginFactory< T >::registerDefaultPlugins ( )

Register a plugin.

Parameters
createInstancepointer to a function returning an instance of the plugin object.

◆ registerPlugin()

template<typename T >
void PluginFactory< T >::registerPlugin ( createInstanceFunc *  createInstance)
inline

Register an output plugin.

Parameters
createInstancepointer to a function returning an instance of the plugin object.

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