13 #ifndef __named_obj_h__
14 #define __named_obj_h__
81 std::ostringstream os;
82 xml.printCurrentContext(os);
89 file_xml = xml.printCurrentContext();
95 std::ostringstream os;
96 xml.printCurrentContext(os);
164 typedef std::map<std::string, NamedObjectBase*>::iterator I;
181 typedef std::map<std::string, NamedObjectBase*>::iterator I;
185 std::ostringstream error_stream;
186 error_stream <<
"NamedObjectMap::create : duplicate id = " <<
id << std::endl;
187 throw error_stream.str();
197 std::ostringstream error_stream;
198 error_stream <<
"NamedObjectMap::create : error creating NamedObject for id= " <<
id << std::endl;
199 throw error_stream.str();
204 template<
typename T,
typename P1>
208 MapType_t::iterator iter =
the_map.find(
id);
211 std::ostringstream error_stream;
212 error_stream <<
"NamedObjectMap::create : duplicate id = " <<
id << std::endl;
213 throw error_stream.str();
223 std::ostringstream error_stream;
224 error_stream <<
"NamedObjectMap::create : error creating NamedObject for id= " <<
id << std::endl;
225 throw error_stream.str();
234 MapType_t::const_iterator iter =
the_map.find(
id);
237 return (iter !=
the_map.end()) ? true :
false;
245 MapType_t::iterator iter =
the_map.find(
id);
259 std::ostringstream error_stream;
260 error_stream <<
"NamedObjectMap::erase : erasing unknown id = " <<
id << std::endl;
261 throw error_stream.str();
269 QDPIO::cout <<
"Available Keys are : " << std::endl;
271 QDPIO::cout <<
j->first << std::endl;
279 MapType_t::const_iterator iter =
the_map.find(
id);
283 std::ostringstream error_stream;
284 error_stream <<
"NamedObjectMap::get : unknown id = " <<
id << std::endl;
285 throw error_stream.str();
290 return *(iter->second);
323 typedef std::map<std::string, NamedObjectBase*>
MapType_t;
Primary include file for CHROMA library code.
Class for counted reference semantics.
Typeinfo Hiding Base Clase.
virtual void getRecordXML(XMLBufferWriter &xml) const =0
Getter.
virtual void setFileXML(XMLBufferWriter &xml)=0
Setter.
virtual ~NamedObjectBase()
virtual void setRecordXML(XMLReader &xml)=0
Setter.
virtual void setRecordXML(XMLBufferWriter &xml)=0
Setter.
virtual void getRecordXML(XMLReader &xml) const =0
Getter.
virtual void setFileXML(XMLReader &xml)=0
Setter.
virtual void getFileXML(XMLReader &xml) const =0
Getter.
virtual void getFileXML(XMLBufferWriter &xml) const =0
Getter.
std::map< std::string, NamedObjectBase * > MapType_t
void create(const std::string &id, const P1 &p1)
Create an entry of arbitrary type, with 1 parameter.
bool check(const std::string &id) const
Check if an id exists.
void dump() const
Dump out all objects.
NamedObjectBase & get(const std::string &id) const
Look something up and return a NamedObjectBase reference.
void create(const std::string &id)
Create an entry of arbitrary type.
const T & getObj(const std::string &id) const
Look something up and return a ref to the derived named object.
T & getObj(const std::string &id)
Look something up and return a ref to the derived named object.
const T & getData(const std::string &id) const
Look something up and return a ref to actual data.
void erase(const std::string &id)
Delete an item that we no longer neeed.
T & getData(const std::string &id)
Look something up and return a ref to actual data.
Type specific named object.
void getRecordXML(XMLReader &xml) const
Getter.
~NamedObject()
Destructor.
void setFileXML(XMLReader &xml)
Setter.
void getFileXML(XMLBufferWriter &xml) const
Getter.
void getFileXML(XMLReader &xml) const
Getter.
void setFileXML(XMLBufferWriter &xml)
Setter.
virtual T & getData()
Mutable data ref.
NamedObject(const P1 &p1)
NamedObject()
Constructor.
void getRecordXML(XMLBufferWriter &xml) const
Getter.
void setRecordXML(XMLBufferWriter &xml)
Setter.
virtual const T & getData() const
Const data ref.
void setRecordXML(XMLReader &xml)
Setter.
Class for counted reference semantics.
Asqtad Staggered-Dirac operator.
LinOpSysSolverMGProtoClover::T T