8 #ifndef ATLAS_OBJECTS_ROOT_H 9 #define ATLAS_OBJECTS_ROOT_H 11 #include <Atlas/Objects/BaseObject.h> 13 #include <Atlas/Message/Element.h> 15 namespace Atlas {
namespace Objects {
17 template <
class T>
class SmartPtr;
27 typedef SmartPtr<RootData> Root;
29 static const int ROOT_NO = 1;
59 void setAttr(
const std::string& name,
62 void removeAttr(
const std::string& name)
override;
68 void addToMessage(Atlas::Message::MapType &)
const override;
71 void setId(
const std::string& val);
79 void setName(
const std::string& val);
82 const std::string&
getId()
const;
98 const std::string&
getName()
const;
115 int getAttrClass(
const std::string& name)
const override;
117 int32_t
getAttrFlag(
const std::string& name)
const override;
140 void iterate(
int& current_class, std::string& attr)
const override;
144 friend class ::Atlas::Objects::Allocator;
149 void reset()
override;
150 void free()
override;
154 static void fillDefaultObjectInstance(
RootData& data, std::map<std::string, int32_t>& attr_data);
161 extern const std::string ID_ATTR;
162 extern const std::string PARENT_ATTR;
163 extern const std::string STAMP_ATTR;
164 extern const std::string OBJTYPE_ATTR;
165 extern const std::string NAME_ATTR;
171 const int32_t ID_FLAG = 1 << 1;
176 m_attrFlags |= ID_FLAG;
179 const int32_t PARENT_FLAG = 1 << 2;
184 m_attrFlags |= PARENT_FLAG;
187 const int32_t STAMP_FLAG = 1 << 3;
192 m_attrFlags |= STAMP_FLAG;
195 const int32_t OBJTYPE_FLAG = 1 << 4;
200 m_attrFlags |= OBJTYPE_FLAG;
203 const int32_t NAME_FLAG = 1 << 5;
208 m_attrFlags |= NAME_FLAG;
213 if(m_attrFlags & ID_FLAG)
221 if(!(m_attrFlags & ID_FLAG))
228 if(m_attrFlags & PARENT_FLAG)
236 if(!(m_attrFlags & PARENT_FLAG))
243 if(m_attrFlags & STAMP_FLAG)
251 if(!(m_attrFlags & STAMP_FLAG))
258 if(m_attrFlags & OBJTYPE_FLAG)
266 if(!(m_attrFlags & OBJTYPE_FLAG))
273 if(m_attrFlags & NAME_FLAG)
281 if(!(m_attrFlags & NAME_FLAG))
288 return (m_attrFlags & ID_FLAG) == 0;
293 return (m_attrFlags & PARENT_FLAG) == 0;
298 return (m_attrFlags & STAMP_FLAG) == 0;
303 return (m_attrFlags & OBJTYPE_FLAG) == 0;
308 return (m_attrFlags & NAME_FLAG) == 0;
314 #endif // ATLAS_OBJECTS_ROOT_H bool isDefaultId() const
Is "id" value default?
Definition: Root.h:286
void sendObjtype(Atlas::Bridge &) const
Send the "objtype" attribute to an Atlas::Bridge.
const std::string & getId() const
Retrieve the "id" attribute.
Definition: Root.h:211
void setName(const std::string &val)
Set the "name" attribute.
Definition: Root.h:205
Atlas stream bridge.
Definition: Bridge.h:35
std::string & modifyParent()
Retrieve the "parent" attribute as a non-const reference.
Definition: Root.h:234
~RootData() override=default
Default destructor.
void setStamp(double val)
Set the "stamp" attribute.
Definition: Root.h:189
void sendName(Atlas::Bridge &) const
Send the "name" attribute to an Atlas::Bridge.
void setObjtype(const std::string &val)
Set the "objtype" attribute.
Definition: Root.h:197
BaseObjectData * m_defaults
The default instance, acting as a prototype for all other instances.
Definition: BaseObject.h:440
void sendParent(Atlas::Bridge &) const
Send the "parent" attribute to an Atlas::Bridge.
Multi-type container.
Definition: Element.h:60
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
std::string attr_name
Name of object.
Definition: Root.h:127
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
void sendStamp(Atlas::Bridge &) const
Send the "stamp" attribute to an Atlas::Bridge.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
The Atlas namespace.
Definition: Bridge.h:20
const std::string & getObjtype() const
Retrieve the "objtype" attribute.
Definition: Root.h:256
std::string & modifyName()
Retrieve the "name" attribute as a non-const reference.
Definition: Root.h:279
All objects inherit from this.
Definition: Root.h:36
void free() override
Free an instance of this class, returning it to the memory pool.
RootData(RootData *defaults=nullptr)
Construct a RootData class definition.
Definition: Root.h:40
std::string & modifyObjtype()
Retrieve the "objtype" attribute as a non-const reference.
Definition: Root.h:264
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
Retrieve the attribute "name".
bool instanceOf(int classNo) const override
Is this instance of some class?
std::string & modifyId()
Retrieve the "id" attribute as a non-const reference.
Definition: Root.h:219
double getStamp() const
Retrieve the "stamp" attribute.
Definition: Root.h:241
void setId(const std::string &val)
Set the "id" attribute.
Definition: Root.h:173
double & modifyStamp()
Retrieve the "stamp" attribute as a non-const reference.
Definition: Root.h:249
int32_t getAttrFlag(const std::string &name) const override
Find the flag for the attribute "name".
const std::string & getName() const
Retrieve the "name" attribute.
Definition: Root.h:271
bool isDefaultObjtype() const
Is "objtype" value default?
Definition: Root.h:301
std::string attr_objtype
What kind of object this is.
Definition: Root.h:125
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
void setParent(const std::string &val)
Set the "parent" attribute.
Definition: Root.h:181
const std::string & getParent() const
Retrieve the "parent" attribute.
Definition: Root.h:226
void setAttr(const std::string &name, const Atlas::Message::Element &attr) override
Set the attribute "name" to the value given by"attr".
Trait which handles allocation of instances of BaseObject.
Definition: BaseObject.h:63
bool isDefaultParent() const
Is "parent" value default?
Definition: Root.h:291
void iterate(int ¤t_class, std::string &attr) const override
Iterate over the attributes of this instance.
RootData * copy() const override
Copy this object.
bool isDefaultName() const
Is "name" value default?
Definition: Root.h:306
bool isDefaultStamp() const
Is "stamp" value default?
Definition: Root.h:296
double attr_stamp
Last time this object was modified.
Definition: Root.h:123
std::string attr_parent
The object this inherits attributes from.
Definition: Root.h:121
Atlas base object class.
Definition: BaseObject.h:214
void reset() override
Resets the object as it's returned to the pool.
std::string attr_id
Id of object.
Definition: Root.h:119
void sendId(Atlas::Bridge &) const
Send the "id" attribute to an Atlas::Bridge.