44 : _isMainStorage(isMainStorage_) {}
48 for (iterator it = begin(); it != end(); ++it) {
57 if (p->
id() < 0)
return false;
58 iterator it = find(p->
id());
59 if (it != end())
return false;
60 insert(make_pair(p->
id(), p));
65 iterator it = find(
id);
66 if (it == end())
return nullptr;
71 const_iterator it = find(
id);
72 if (it == end())
return nullptr;
77 iterator it = find(
id);
78 if (it == end())
return nullptr;
86 for (const_iterator it = begin(); it != end(); ++it) {
87 os << factory->
tag(it->second) <<
" ";
88 os << it->second->id() <<
" ";
89 it->second->write(os);
97 const std::map<std::string, std::string>* _renamedTypesLookup) {
98 stringstream currentLine;
103 elemBitset[HyperGraph::HGET_PARAMETER] = 1;
106 int bytesRead =
readLine(is, currentLine);
107 if (bytesRead == -1)
break;
108 currentLine >>
token;
109 if (bytesRead == 0 ||
token.size() == 0 ||
token[0] ==
'#')
continue;
110 if (_renamedTypesLookup && _renamedTypesLookup->size() > 0) {
111 map<string, string>::const_iterator foundIt =
112 _renamedTypesLookup->find(
token);
113 if (foundIt != _renamedTypesLookup->end()) {
114 token = foundIt->second;
122 assert(element->
elementType() == HyperGraph::HGET_PARAMETER &&
123 "Should be a param");
129 bool r = p->
read(currentLine);
131 G2O_ERROR(
"{}: Error reading data {} for parameter {}",
136 G2O_ERROR(
"{}: Parameter of type: {} id: {} already defined",
create vertices and edges based on TAGs in, for example, a file
static Factory * instance()
return the instance
HyperGraph::HyperGraphElement * construct(const std::string &tag) const
const std::string & tag(const HyperGraph::HyperGraphElement *v) const
return the TAG given a vertex
std::bitset< HyperGraph::HGET_NUM_ELEMS > GraphElemBitset
virtual bool write(std::ostream &os) const
write the data to a stream
virtual ~ParameterContainer()
ParameterContainer(bool isMainStorage_=true)
Parameter * detachParameter(int id)
remove a parameter from the container, i.e., the user now owns the pointer
bool addParameter(Parameter *p)
add parameter to the container
Parameter * getParameter(int id)
return a parameter based on its ID
virtual bool read(std::istream &is, const std::map< std::string, std::string > *renamedMap=0)
read parameters from a stream
virtual bool read(std::istream &is)=0
read the data from a stream
SlamParser::Parser::token token
#define __PRETTY_FUNCTION__
int readLine(std::istream &is, std::stringstream ¤tLine)
virtual HyperGraphElementType elementType() const =0