7 #ifndef ATLAS_OBJECTS_ROOT_H 8 #define ATLAS_OBJECTS_ROOT_H 10 #include <Atlas/Objects/BaseObject.h> 12 #include <Atlas/Message/Element.h> 14 namespace Atlas {
namespace Objects {
16 template <
class T>
class SmartPtr;
26 typedef SmartPtr<RootData> Root;
28 static const int ROOT_NO = 1;
58 virtual void setAttr(
const std::string& name,
61 virtual void removeAttr(
const std::string& name);
67 virtual void addToMessage(Atlas::Message::MapType &)
const;
70 inline void setId(
const std::string& val);
72 inline void setParents(
const std::list<std::string>& val);
78 inline void setObjtype(
const std::string& val);
80 inline void setName(
const std::string& val);
83 inline const std::string&
getId()
const;
87 inline const std::list<std::string>&
getParents()
const;
101 inline const std::string&
getName()
const;
120 virtual int getAttrFlag(
const std::string& name)
const;
143 virtual void iterate(
int& current_class, std::string& attr)
const;
165 static std::map<std::string, int> * attr_flags_RootData;
172 extern const std::string ID_ATTR;
173 extern const std::string PARENTS_ATTR;
174 extern const std::string STAMP_ATTR;
175 extern const std::string OBJTYPE_ATTR;
176 extern const std::string NAME_ATTR;
182 const int ID_FLAG = 1 << 1;
187 m_attrFlags |= ID_FLAG;
190 const int PARENTS_FLAG = 1 << 2;
195 m_attrFlags |= PARENTS_FLAG;
200 m_attrFlags |= PARENTS_FLAG;
202 for(Atlas::Message::ListType::const_iterator I = val.begin();
206 if((*I).isString()) {
212 const int STAMP_FLAG = 1 << 3;
217 m_attrFlags |= STAMP_FLAG;
220 const int OBJTYPE_FLAG = 1 << 4;
225 m_attrFlags |= OBJTYPE_FLAG;
228 const int NAME_FLAG = 1 << 5;
233 m_attrFlags |= NAME_FLAG;
238 if(m_attrFlags & ID_FLAG)
241 return ((
RootData*)m_defaults)->attr_id;
246 if(!(m_attrFlags & ID_FLAG))
253 if(m_attrFlags & PARENTS_FLAG)
256 return ((
RootData*)m_defaults)->attr_parents;
261 if(!(m_attrFlags & PARENTS_FLAG))
268 const std::list<std::string>& lst_in =
getParents();
269 Atlas::Message::ListType lst_out;
270 for(std::list<std::string>::const_iterator I = lst_in.begin();
274 lst_out.push_back(std::string(*I));
281 if(m_attrFlags & STAMP_FLAG)
284 return ((
RootData*)m_defaults)->attr_stamp;
289 if(!(m_attrFlags & STAMP_FLAG))
296 if(m_attrFlags & OBJTYPE_FLAG)
299 return ((
RootData*)m_defaults)->attr_objtype;
304 if(!(m_attrFlags & OBJTYPE_FLAG))
311 if(m_attrFlags & NAME_FLAG)
314 return ((
RootData*)m_defaults)->attr_name;
319 if(!(m_attrFlags & NAME_FLAG))
326 return (m_attrFlags & ID_FLAG) == 0;
331 return (m_attrFlags & PARENTS_FLAG) == 0;
336 return (m_attrFlags & STAMP_FLAG) == 0;
341 return (m_attrFlags & OBJTYPE_FLAG) == 0;
346 return (m_attrFlags & NAME_FLAG) == 0;
352 #endif // ATLAS_OBJECTS_ROOT_H const Atlas::Message::ListType getParentsAsList() const
Retrieve the "parents" attribute AsList.
Definition: Root.h:266
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
void setParents(const std::list< std::string > &val)
Set the "parents" attribute.
Definition: Root.h:192
void setName(const std::string &val)
Set the "name" attribute.
Definition: Root.h:230
std::list< std::string > & modifyParents()
Retrieve the "parents" attribute as a non-const reference.
Definition: Root.h:259
const std::list< std::string > & getParents() const
Retrieve the "parents" attribute.
Definition: Root.h:251
Atlas stream bridge.
Definition: Bridge.h:35
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
bool isDefaultId() const
Is "id" value default?
Definition: Root.h:324
void setStamp(double val)
Set the "stamp" attribute.
Definition: Root.h:214
void setObjtype(const std::string &val)
Set the "objtype" attribute.
Definition: Root.h:222
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
Multi-type container.
Definition: Element.h:60
std::string attr_name
Name of object.
Definition: Root.h:130
std::list< std::string > attr_parents
List of objects this inherits attributes from.
Definition: Root.h:124
static RootData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
virtual RootData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
The Atlas namespace.
Definition: Bridge.h:20
std::string & modifyName()
Retrieve the "name" attribute as a non-const reference.
Definition: Root.h:317
All objects inherit from this.
Definition: Root.h:35
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
const std::string & getName() const
Retrieve the "name" attribute.
Definition: Root.h:309
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
void sendStamp(Atlas::Bridge &) const
Send the "stamp" attribute to an Atlas::Bridge.
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by"attr".
void sendId(Atlas::Bridge &) const
Send the "id" attribute to an Atlas::Bridge.
virtual void removeAttr(const std::string &name)
Remove the attribute "name". This will not work for static attributes.
bool isDefaultStamp() const
Is "stamp" value default?
Definition: Root.h:334
const std::string & getObjtype() const
Retrieve the "objtype" attribute.
Definition: Root.h:294
bool isDefaultName() const
Is "name" value default?
Definition: Root.h:344
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
std::string & modifyObjtype()
Retrieve the "objtype" attribute as a non-const reference.
Definition: Root.h:302
virtual RootData * copy() const
Copy this object.
std::string & modifyId()
Retrieve the "id" attribute as a non-const reference.
Definition: Root.h:244
void setId(const std::string &val)
Set the "id" attribute.
Definition: Root.h:184
double & modifyStamp()
Retrieve the "stamp" attribute as a non-const reference.
Definition: Root.h:287
std::string attr_objtype
What kind of object this is.
Definition: Root.h:128
RootData(RootData *defaults=NULL)
Construct a RootData class definition.
Definition: Root.h:39
void sendParents(Atlas::Bridge &) const
Send the "parents" attribute to an Atlas::Bridge.
virtual void free()
Free an instance of this class, returning it to the memory pool.
void sendObjtype(Atlas::Bridge &) const
Send the "objtype" attribute to an Atlas::Bridge.
virtual ~RootData()
Default destructor.
double getStamp() const
Retrieve the "stamp" attribute.
Definition: Root.h:279
bool isDefaultParents() const
Is "parents" value default?
Definition: Root.h:329
double attr_stamp
Last time this object was modified.
Definition: Root.h:126
virtual bool instanceOf(int classNo) const
Is this instance of some class?
bool isDefaultObjtype() const
Is "objtype" value default?
Definition: Root.h:339
Atlas base object class.
Definition: BaseObject.h:67
std::string attr_id
Id of object.
Definition: Root.h:122
void sendName(Atlas::Bridge &) const
Send the "name" attribute to an Atlas::Bridge.
const std::string & getId() const
Retrieve the "id" attribute.
Definition: Root.h:236
void setParentsAsList(const Atlas::Message::ListType &val)
Set the "parents" attribute AsList.
Definition: Root.h:198