30 #include "../../config.h" 31 #include "../stuff/misc.h" 44 class AbstractHyperGraphElementCreator;
83 bool knowsTag(
const std::string& tag,
int* elementType = 0)
const;
112 std::cout <<
"Deleting " << (
void*) creator << std::endl;
118 typedef std::map<std::string, CreatorInformation*>
CreatorMap;
136 #ifdef G2O_DEBUG_FACTORY 137 std::cout << __FUNCTION__ <<
": Registering " << _name <<
" of type " <<
typeid(T).name() << std::endl;
144 #ifdef G2O_DEBUG_FACTORY 145 std::cout << __FUNCTION__ <<
": Unregistering " << _name <<
" of type " <<
typeid(T).name() << std::endl;
154 #if defined _MSC_VER && defined G2O_SHARED_LIBS 155 # define G2O_FACTORY_EXPORT __declspec(dllexport) 156 # define G2O_FACTORY_IMPORT __declspec(dllimport) 158 # define G2O_FACTORY_EXPORT 159 # define G2O_FACTORY_IMPORT 163 #define G2O_REGISTER_TYPE(name, classname) \ 164 extern "C" void G2O_FACTORY_EXPORT g2o_type_##classname(void) {} \ 165 static g2o::RegisterTypeProxy<classname> g_type_proxy_##classname(#name); 167 #define G2O_USE_TYPE_BY_CLASS_NAME(classname) \ 168 extern "C" void G2O_FACTORY_IMPORT g2o_type_##classname(void); \ 169 static g2o::ForceLinker proxy_##classname(g2o_type_##classname); 171 #define G2O_REGISTER_TYPE_GROUP(typeGroupName) \ 172 extern "C" void G2O_FACTORY_EXPORT g2o_type_group_##typeGroupName(void) {} 174 #define G2O_USE_TYPE_GROUP(typeGroupName) \ 175 extern "C" void G2O_FACTORY_IMPORT g2o_type_group_##typeGroupName(void); \ 176 static g2o::ForceLinker g2o_force_type_link_##typeGroupName(g2o_type_group_##typeGroupName);
static Factory * instance()
return the instance
TagLookup _tagLookup
reverse look-up, class name to tag
std::bitset< HyperGraph::HGET_NUM_ELEMS > GraphElemBitset
HyperGraph::HyperGraphElement * construct(const std::string &tag) const
void fillKnownTypes(std::vector< std::string > &types) const
void printRegisteredTypes(std::ostream &os, bool comment=false) const
templatized creator class which creates graph elements
const std::string & tag(const HyperGraph::HyperGraphElement *v) const
return the TAG given a vertex
static Factory * factoryInstance
create vertices and edges based on TAGs in, for example, a file
CreatorMap _creator
look-up map for the existing creators
bool knowsTag(const std::string &tag, int *elementType=0) const
RegisterTypeProxy(const std::string &name)
void unregisterType(const std::string &tag)
static void destroy()
free the instance
std::map< std::string, CreatorInformation * > CreatorMap
void registerType(const std::string &tag, AbstractHyperGraphElementCreator *c)
Abstract interface for allocating HyperGraphElement.
std::map< std::string, std::string > TagLookup