23 #ifndef GENERIC_FACTORY_H
24 #define GENERIC_FACTORY_H
32 class AbstractGeneric;
46 typedef std::map<Name,CreatorFunction>
AssocMap;
88 typename AssocMap::const_iterator i = associations_.find(name);
89 if ( i != associations_.end() ) {
90 return (i->second)(
d);
100 return register_subtype(name,new_from_dict_<T>);
103 template<
class BaseT>
107 return associations_.insert(std::pair<Name,CreatorFunction>(name,creator)).second;
110 template<
class BaseT>
BaseT * create(const Name &name, const DictionaryDatum &d) const
Factory function.
Definition: generic_factory.h:86
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
bool register_subtype(const Name &name)
Register a new subtype.
Definition: generic_factory.h:98
Represent strings by ints to facilitate fast comparison.
Definition: name.h:53
std::map< Name, CreatorFunction > AssocMap
Definition: generic_factory.h:46
const std::string & toString(void) const
Return string represented by Name.
Definition: name.cc:63
static BaseT * new_from_dict_(const DictionaryDatum &d)
Definition: generic_factory.h:112
AssocMap associations_
Definition: generic_factory.h:81
BaseT *(* CreatorFunction)(const DictionaryDatum &d)
Definition: generic_factory.h:45
Generic Factory class for objects deriving from a base class BaseT.
Definition: generic_factory.h:43
Default types used by the NEST kernel.
Exception to be thrown if an entry referenced inside a dictionary does not exist. ...
Definition: sliexceptions.h:263