Generic Factory class for objects deriving from a base class BaseT. More...
#include <generic_factory.h>
Public Types | |
| typedef BaseT *(* | CreatorFunction) (const Dictionary &d) |
| typedef std::map< std::string, CreatorFunction > | AssocMap |
Public Member Functions | |
| BaseT * | create (const std::string &name, const Dictionary &d) const |
| Factory function. | |
| template<class T > | |
| bool | register_subtype (const std::string &name) |
| Register a new subtype. | |
| bool | register_subtype (const std::string &name, CreatorFunction creator) |
| Register a new subtype. | |
Static Private Member Functions | |
| template<class T > | |
| static BaseT * | new_from_dict_ (const Dictionary &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< std::string, CreatorFunction > nest::GenericFactory< BaseT >::AssocMap |
| typedef BaseT *(* nest::GenericFactory< BaseT >::CreatorFunction) (const Dictionary &d) |
|
inline |
Factory function.
| name | Subtype. |
| d | Dictionary containing parameters for this subtype. |
|
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 Dictionary& as parameter.
| name | subtype name. |
Referenced by nest::register_mask(), nest::register_mask(), and nest::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 Dictionary& containing parameters |
|
private |