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,
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;
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
void setId(const std::string &val)
Set the "id" attribute.
Definition: Root.h:184
Atlas base object class.
Definition: BaseObject.h:68
All objects inherit from this.
Definition: Root.h:36
const std::list< std::string > & getParents() const
Retrieve the "parents" attribute.
Definition: Root.h:251
Atlas stream bridge.
Definition: Bridge.h:36
double attr_stamp
Last time this object was modified.
Definition: Root.h:126
RootData(RootData *defaults=NULL)
Construct a RootData class definition.
Definition: Root.h:39
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
void setParentsAsList(const Atlas::Message::ListType &val)
Set the "parents" attribute AsList.
Definition: Root.h:198
void sendId(Atlas::Bridge &) const
Send the "id" attribute to an Atlas::Bridge.
bool isDefaultName() const
Is "name" value default?
Definition: Root.h:344
std::string & modifyObjtype()
Retrieve the "objtype" attribute as a non-const reference.
Definition: Root.h:302
static RootData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
virtual void free()
Free an instance of this class, returning it to the memory pool.
void setStamp(double val)
Set the "stamp" attribute.
Definition: Root.h:214
bool isDefaultObjtype() const
Is "objtype" value default?
Definition: Root.h:339
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by"attr".
virtual void removeAttr(const std::string &name)
Remove the attribute "name". This will not work for static attributes.
std::string attr_objtype
What kind of object this is.
Definition: Root.h:128
std::string & modifyId()
Retrieve the "id" attribute as a non-const reference.
Definition: Root.h:244
std::string attr_id
Id of object.
Definition: Root.h:122
const std::string & getId() const
Retrieve the "id" attribute.
Definition: Root.h:236
void sendName(Atlas::Bridge &) const
Send the "name" attribute to an Atlas::Bridge.
bool isDefaultId() const
Is "id" value default?
Definition: Root.h:324
Multi-type container.
Definition: Element.h:61
void setObjtype(const std::string &val)
Set the "objtype" attribute.
Definition: Root.h:222
bool isDefaultStamp() const
Is "stamp" value default?
Definition: Root.h:334
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
std::list< std::string > & modifyParents()
Retrieve the "parents" attribute as a non-const reference.
Definition: Root.h:259
std::string attr_name
Name of object.
Definition: Root.h:130
virtual ~RootData()
Default destructor.
const Atlas::Message::ListType getParentsAsList() const
Retrieve the "parents" attribute AsList.
Definition: Root.h:266
bool isDefaultParents() const
Is "parents" value default?
Definition: Root.h:329
void setParents(const std::list< std::string > &val)
Set the "parents" attribute.
Definition: Root.h:192
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
std::list< std::string > attr_parents
List of objects this inherits attributes from.
Definition: Root.h:124
void sendParents(Atlas::Bridge &) const
Send the "parents" attribute to an Atlas::Bridge.
double & modifyStamp()
Retrieve the "stamp" attribute as a non-const reference.
Definition: Root.h:287
const std::string & getObjtype() const
Retrieve the "objtype" attribute.
Definition: Root.h:294
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
virtual RootData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
void setName(const std::string &val)
Set the "name" attribute.
Definition: Root.h:230
The Atlas namespace.
Definition: Bridge.h:20
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
void sendObjtype(Atlas::Bridge &) const
Send the "objtype" attribute to an Atlas::Bridge.
double getStamp() const
Retrieve the "stamp" attribute.
Definition: Root.h:279
std::string & modifyName()
Retrieve the "name" attribute as a non-const reference.
Definition: Root.h:317
virtual RootData * copy() const
Copy this object.
const std::string & getName() const
Retrieve the "name" attribute.
Definition: Root.h:309
void sendStamp(Atlas::Bridge &) const
Send the "stamp" attribute to an Atlas::Bridge.
Copyright 2000-2004 the respective authors.
This document can be licensed under the terms of the GNU Free Documentation
License or the GNU General Public License and may be freely distributed under
the terms given by one of these licenses.