43 _isMainStorage(isMainStorage_)
50 for (iterator it = begin(); it!=end(); it++){
63 iterator it=find(p->
id());
66 insert(make_pair(p->
id(), p));
78 const_iterator it=find(
id);
95 for (const_iterator it=begin(); it!=end(); it++){
96 os << factory->
tag(it->second) <<
" ";
97 os << it->second->id() <<
" ";
98 it->second->write(os);
105 stringstream currentLine;
113 int bytesRead =
readLine(is, currentLine);
116 currentLine >>
token;
117 if (bytesRead == 0 || token.size() == 0 || token[0] ==
'#')
119 if (_renamedTypesLookup && _renamedTypesLookup->size()>0){
120 map<string, string>::const_iterator foundIt = _renamedTypesLookup->find(token);
121 if (foundIt != _renamedTypesLookup->end()) {
122 token = foundIt->second;
135 bool r = p->read(currentLine);
137 cerr <<
__PRETTY_FUNCTION__ <<
": Error reading data " << token <<
" for parameter " << pid << endl;
141 cerr <<
__PRETTY_FUNCTION__ <<
": Parameter of type:" << token <<
" id:" << pid <<
" already defined" << endl;
virtual bool read(std::istream &is, const std::map< std::string, std::string > *renamedMap=0)
read parameters from a stream
Parameter * detachParameter(int id)
remove a parameter from the container, i.e., the user now owns the pointer
#define __PRETTY_FUNCTION__
virtual bool write(std::ostream &os) const
write the data to a stream
static Factory * instance()
return the instance
std::bitset< HyperGraph::HGET_NUM_ELEMS > GraphElemBitset
Parameter * getParameter(int id)
return a parameter based on its ID
HyperGraph::HyperGraphElement * construct(const std::string &tag) const
SlamParser::Parser::token token
const std::string & tag(const HyperGraph::HyperGraphElement *v) const
return the TAG given a vertex
virtual ~ParameterContainer()
create vertices and edges based on TAGs in, for example, a file
int readLine(std::istream &is, std::stringstream ¤tLine)
virtual HyperGraphElementType elementType() const =0
ParameterContainer(bool isMainStorage_=true)
bool addParameter(Parameter *p)
add parameter to the container