|
g2o
|
create vertices and edges based on TAGs in, for example, a file More...
#include <factory.h>
Classes | |
| class | CreatorInformation |
Public Member Functions | |
| Factory (Factory const &)=delete | |
| Factory & | operator= (Factory const &)=delete |
| void | registerType (const std::string &tag, const std::shared_ptr< AbstractHyperGraphElementCreator > &c) |
| void | unregisterType (const std::string &tag) |
| HyperGraph::HyperGraphElement * | construct (const std::string &tag) const |
| HyperGraph::HyperGraphElement * | construct (const std::string &tag, const HyperGraph::GraphElemBitset &elemsToConstruct) const |
| bool | knowsTag (const std::string &tag, int *elementType=0) const |
| const std::string & | tag (const HyperGraph::HyperGraphElement *v) const |
| return the TAG given a vertex | |
| void | fillKnownTypes (std::vector< std::string > &types) const |
| void | printRegisteredTypes (std::ostream &os, bool comment=false) const |
Static Public Member Functions | |
| static Factory * | instance () |
| return the instance | |
| static void | destroy () |
| free the instance | |
Protected Types | |
| typedef std::map< std::string, std::unique_ptr< CreatorInformation > > | CreatorMap |
| typedef std::map< std::string, std::string > | TagLookup |
Protected Member Functions | |
| Factory ()=default | |
Protected Attributes | |
| CreatorMap | _creator |
| look-up map for the existing creators | |
| TagLookup | _tagLookup |
| reverse look-up, class name to tag | |
Static Private Attributes | |
| static std::unique_ptr< Factory > | factoryInstance |
create vertices and edges based on TAGs in, for example, a file
|
protected |
|
protected |
|
delete |
|
protecteddefault |
| HyperGraph::HyperGraphElement * g2o::Factory::construct | ( | const std::string & | tag | ) | const |
construct a graph element based on its tag
Definition at line 129 of file factory.cpp.
References _creator, and tag().
Referenced by construct(), g2o::CacheContainer::createCache(), g2o::EdgeCreator::createEdge(), and g2o::ParameterContainer::read().
| HyperGraph::HyperGraphElement * g2o::Factory::construct | ( | const std::string & | tag, |
| const HyperGraph::GraphElemBitset & | elemsToConstruct | ||
| ) | const |
construct a graph element based on its tag, but only if it's type (a bitmask) matches. A bitmask without any bit set will construct any item. Otherwise a bit has to be set to allow construction of a graph element.
Definition at line 177 of file factory.cpp.
References _creator, construct(), and tag().
|
static |
free the instance
Definition at line 162 of file factory.cpp.
References factoryInstance.
| void g2o::Factory::fillKnownTypes | ( | std::vector< std::string > & | types | ) | const |
get a list of all known types
Definition at line 145 of file factory.cpp.
References _creator.
|
static |
return the instance
Definition at line 46 of file factory.cpp.
References factoryInstance, and G2O_DEBUG.
Referenced by g2o::assignHierarchicalEdges(), g2o::BackBoneTreeAction::BackBoneTreeAction(), g2o::CacheContainer::createCache(), g2o::EdgeCreator::createEdge(), g2o::Cache::key(), main(), g2o::ParameterContainer::read(), g2o::RegisterTypeProxy< T >::RegisterTypeProxy(), g2o::OptimizableGraph::saveEdge(), g2o::OptimizableGraph::saveParameter(), g2o::OptimizableGraph::saveUserData(), g2o::OptimizableGraph::saveVertex(), g2o::OptimizableGraph::setRenamedTypesFromString(), g2o::ParameterContainer::write(), and g2o::Gm2dlIO::writeGm2dl().
| bool g2o::Factory::knowsTag | ( | const std::string & | tag, |
| int * | elementType = 0 |
||
| ) | const |
return whether the factory knows this tag or not
Definition at line 152 of file factory.cpp.
References _creator, and tag().
Referenced by g2o::OptimizableGraph::setRenamedTypesFromString().
| void g2o::Factory::printRegisteredTypes | ( | std::ostream & | os, |
| bool | comment = false |
||
| ) | const |
print a list of the known registered types to the given stream
Definition at line 167 of file factory.cpp.
References _creator.
Referenced by main().
| void g2o::Factory::registerType | ( | const std::string & | tag, |
| const std::shared_ptr< AbstractHyperGraphElementCreator > & | c | ||
| ) |
register a tag for a specific creator
Definition at line 58 of file factory.cpp.
References _creator, _tagLookup, g2o::Factory::CreatorInformation::creator, g2o::HyperGraph::HyperGraphElement::elementType(), g2o::Factory::CreatorInformation::elementTypeBit, G2O_DEBUG, G2O_WARN, and tag().
Referenced by g2o::RegisterTypeProxy< T >::RegisterTypeProxy().
| const std::string & g2o::Factory::tag | ( | const HyperGraph::HyperGraphElement * | v | ) | const |
return the TAG given a vertex
Definition at line 138 of file factory.cpp.
References _tagLookup.
Referenced by construct(), construct(), g2o::EdgeCreator::createEdge(), g2o::Cache::key(), knowsTag(), main(), g2o::EdgeTypesCostFunction::operator()(), g2o::BackBoneTreeAction::perform(), registerType(), g2o::OptimizableGraph::saveEdge(), g2o::OptimizableGraph::saveParameter(), g2o::OptimizableGraph::saveUserData(), g2o::OptimizableGraph::saveVertex(), unregisterType(), g2o::ParameterContainer::write(), and g2o::Gm2dlIO::writeGm2dl().
| void g2o::Factory::unregisterType | ( | const std::string & | tag | ) |
unregister a tag for a specific creator
Definition at line 113 of file factory.cpp.
References _creator, _tagLookup, and tag().
|
protected |
look-up map for the existing creators
Definition at line 113 of file factory.h.
Referenced by construct(), construct(), fillKnownTypes(), knowsTag(), printRegisteredTypes(), registerType(), and unregisterType().
|
protected |
reverse look-up, class name to tag
Definition at line 114 of file factory.h.
Referenced by registerType(), tag(), and unregisterType().
|
staticprivate |
Definition at line 117 of file factory.h.
Referenced by destroy(), and instance().