6 #ifndef DYNAMIC_GRAPH_FACTORY_HH 7 #define DYNAMIC_GRAPH_FACTORY_HH 12 #include <boost/noncopyable.hpp> 14 #include <dynamic-graph/dynamic-graph-api.h> 15 #include <dynamic-graph/exception-factory.h> 16 #include <dynamic-graph/fwd.hh> 27 #define DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(CLASSTYPE, CLASSNAME) \ 28 const std::string CLASSTYPE::CLASS_NAME = CLASSNAME; \ 30 ::dynamicgraph::Entity * \ 31 EntityMaker_##CLASSTYPE(const std::string &objname) { \ 32 return new CLASSTYPE(objname); \ 34 ::dynamicgraph::EntityRegisterer reg_##CLASSTYPE(CLASSNAME, \ 35 &EntityMaker_##CLASSTYPE); \ 37 struct e_n_d__w_i_t_h__s_e_m_i_c_o_l_o_n 86 typedef Entity *(*EntityConstructor_ptr)(
const std::string &);
94 static void destroy();
108 void registerEntity(
const std::string &entname, EntityConstructor_ptr ent);
117 void deregisterEntity(
const std::string &entname);
137 Entity *newEntity(
const std::string &classname,
138 const std::string &objname)
const;
145 bool existEntity(
const std::string &name)
const;
152 void listEntities(std::vector<std::string> &list)
const;
166 typedef std::map<std::string, EntityConstructor_ptr> EntityMap;
197 const std::string entityName;
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
Entity *(* EntityConstructor_ptr)(const std::string &)
Function pointer providing an entity instance from its name.
This class automatically register an Entity to the global factory at initialization and unregister it...
Provides a way to create Entity objects from their class name.