Swarm-NG  1.1
swarm::basic_plugin< T > Struct Template Reference

Template class for easy plugin development. More...

#include <plugin.hpp>

Inheritance diagram for swarm::basic_plugin< T >:
swarm::plugin

Public Member Functions

 basic_plugin (const std::string &i, const std::string &d=std::string())
 Specify id and description in the constructor.
 
virtual void * create (const config &cfg)
 Instance the class T and return it.
 
virtual std::string id ()
 id as specified in constructor
 
virtual std::string description ()
 description as specified in constructor
 

Additional Inherited Members

- Static Public Member Functions inherited from swarm::plugin
static void add (plugin *p)
 Register a new plugin.
 
static pluginfind (const std::string &id)
 Find a plugin by id()
 
static void * instance (const std::string &name, const config &cfg)
 Find and instance the pluging with specified configuration.
 
static std::vector< plugin * > all ()
 List of all registered plugins.
 
- Static Public Attributes inherited from swarm::plugin
static help_t help
 Plugin the list of plugins in a nice format To use: More...
 

Detailed Description

template<class T>
struct swarm::basic_plugin< T >

Template class for easy plugin development.

class T should have a constructor that takes config as parameter.

Making plugins that make an instance of a specific class is a pretty common task. To define the plugin class for your plugin package:

  • Define one class that does all the work in your plugin. e.g. MySystem
  • Instantiate this template as follows: basic_plugin<MySystem>( "MySystem" , "This is my plugin that I use" )

Definition at line 87 of file plugin.hpp.


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