34 #include "../stuff/macros.h" 35 #include "../stuff/color_macros.h" 36 #include "../stuff/string_tools.h" 43 _isMainStorage(isMainStorage_)
50 for (iterator it = begin(); it!=end(); it++){
63 iterator it=find(p->
id());
66 insert(make_pair(p->
id(), p));
88 for (const_iterator it=begin(); it!=end(); it++){
89 os << factory->
tag(it->second) <<
" ";
90 os << it->second->id() <<
" ";
91 it->second->write(os);
98 stringstream currentLine;
106 int bytesRead =
readLine(is, currentLine);
109 currentLine >> token;
110 if (bytesRead == 0 || token.size() == 0 || token[0] ==
'#')
112 if (_renamedTypesLookup && _renamedTypesLookup->size()>0){
113 map<string, string>::const_iterator foundIt = _renamedTypesLookup->find(token);
114 if (foundIt != _renamedTypesLookup->end()) {
115 token = foundIt->second;
128 bool r = p->read(currentLine);
130 cerr <<
__PRETTY_FUNCTION__ <<
": Error reading data " << token <<
" for parameter " << pid << endl;
134 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
int readLine(std::istream &is, std::stringstream ¤tLine)
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
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
virtual HyperGraphElementType elementType() const =0
ParameterContainer(bool isMainStorage_=true)
bool addParameter(Parameter *p)
add parameter to the container