NEST
2.6.0,not_revisioned_source_dir@0
|
Generic Factory class for objects deriving from a base class BaseT. More...
#include <generic_factory.h>
Public Types | |
typedef BaseT *(* | CreatorFunction )(const DictionaryDatum &d) |
typedef std::map< Name, CreatorFunction > | AssocMap |
Public Member Functions | |
BaseT * | create (const Name &name, const DictionaryDatum &d) const |
Factory function. More... | |
template<class T > | |
bool | register_subtype (const Name &name) |
Register a new subtype. More... | |
bool | register_subtype (const Name &name, CreatorFunction creator) |
Register a new subtype. More... | |
Static Private Member Functions | |
template<class T > | |
static BaseT * | new_from_dict_ (const DictionaryDatum &d) |
Private Attributes | |
AssocMap | associations_ |
Generic Factory class for objects deriving from a base class BaseT.
Keeps a register of subtypes which may be created dynamically. New subtypes may be added by registering either a class (which must have a constructor taking as a parameter a dictionary containing parameters for the mask) or a specialized factory function.
typedef std::map<Name,CreatorFunction> nest::GenericFactory< BaseT >::AssocMap |
typedef BaseT*(* nest::GenericFactory< BaseT >::CreatorFunction)(const DictionaryDatum &d) |
|
inline |
Factory function.
name | Subtype. |
d | Dictionary containing parameters for this subtype. |
References nest::names::d, and Name::toString().
Referenced by nest::TopologyModule::create_mask(), and nest::TopologyModule::create_parameter().
|
staticprivate |
|
inline |
Register a new subtype.
The type name must not already exist. The class for the subtype is supplied via the template argument. This class should have a constructor taking a const DictionaryDatum& as parameter.
name | subtype name. |
Referenced by nest::TopologyModule::register_mask(), and nest::TopologyModule::register_parameter().
|
inline |
Register a new subtype.
The type name must not already exist.
name | Subtype name. |
creator | A factory function creating objects of this subtype from a const DictionaryDatum& containing parameters |
|
private |