8#ifndef ATLAS_OBJECTS_ROOT_H
9#define ATLAS_OBJECTS_ROOT_H
11#include <Atlas/Objects/BaseObject.h>
13#include <Atlas/Message/Element.h>
15namespace Atlas {
namespace Objects {
17template <
class T>
class SmartPtr;
27typedef SmartPtr<RootData> Root;
29static const int ROOT_NO = 1;
50 static constexpr const char* default_parent =
"root";
52 static constexpr const char* default_objtype =
"obj";
66 void removeAttr(
const std::string& name)
override;
72 void addToMessage(Atlas::Message::MapType &)
const override;
75 void setId(std::string val);
86 const std::string&
getId()
const;
102 const std::string&
getName()
const;
119 int getAttrClass(
const std::string& name)
const override;
121 bool getAttrFlag(
const std::string& name, uint32_t& flag)
const override;
146 friend class ::Atlas::Objects::Allocator;
151 void reset()
override;
152 void free()
override;
156 static void fillDefaultObjectInstance(
RootData& data, std::map<std::string, uint32_t>& attr_data);
163extern const std::string ID_ATTR;
164extern const std::string PARENT_ATTR;
165extern const std::string STAMP_ATTR;
166extern const std::string OBJTYPE_ATTR;
167extern const std::string NAME_ATTR;
173const uint32_t ID_FLAG = 1u << 1u;
178 m_attrFlags |= ID_FLAG;
181const uint32_t PARENT_FLAG = 1u << 2u;
186 m_attrFlags |= PARENT_FLAG;
189const uint32_t STAMP_FLAG = 1u << 3u;
194 m_attrFlags |= STAMP_FLAG;
197const uint32_t OBJTYPE_FLAG = 1u << 4u;
202 m_attrFlags |= OBJTYPE_FLAG;
205const uint32_t NAME_FLAG = 1u << 5u;
210 m_attrFlags |= NAME_FLAG;
215 if(m_attrFlags & ID_FLAG)
223 if(!(m_attrFlags & ID_FLAG))
230 if(m_attrFlags & PARENT_FLAG)
238 if(!(m_attrFlags & PARENT_FLAG))
245 if(m_attrFlags & STAMP_FLAG)
253 if(!(m_attrFlags & STAMP_FLAG))
260 if(m_attrFlags & OBJTYPE_FLAG)
268 if(!(m_attrFlags & OBJTYPE_FLAG))
275 if(m_attrFlags & NAME_FLAG)
283 if(!(m_attrFlags & NAME_FLAG))
290 return (m_attrFlags & ID_FLAG) == 0;
295 return (m_attrFlags & PARENT_FLAG) == 0;
300 return (m_attrFlags & STAMP_FLAG) == 0;
305 return (m_attrFlags & OBJTYPE_FLAG) == 0;
310 return (m_attrFlags & NAME_FLAG) == 0;
BaseObjectData * m_defaults
All objects inherit from this..
RootData(RootData *defaults=nullptr)
Construct a RootData class definition.
const std::string & getId() const
Retrieve the "id" attribute.
void sendId(Atlas::Bridge &) const
Send the "id" attribute to an Atlas::Bridge.
std::string attr_objtype
What kind of object this is.
const std::string & getObjtype() const
Retrieve the "objtype" attribute.
std::string & modifyObjtype()
Retrieve the "objtype" attribute as a non-const reference.
std::string & modifyId()
Retrieve the "id" attribute as a non-const reference.
void setObjtype(std::string val)
Set the "objtype" attribute.
void setParent(std::string val)
Set the "parent" attribute.
bool isDefaultObjtype() const
Is "objtype" value default?
void reset() override
Resets the object as it's returned to the pool.
void setName(std::string val)
Set the "name" attribute.
std::string & modifyParent()
Retrieve the "parent" attribute as a non-const reference.
std::string attr_parent
The object this inherits attributes from.
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
void sendObjtype(Atlas::Bridge &) const
Send the "objtype" attribute to an Atlas::Bridge.
double attr_stamp
Last time this object was modified.
double getStamp() const
Retrieve the "stamp" attribute.
bool isDefaultId() const
Is "id" value default?
std::string attr_name
Name of object.
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
bool isDefaultStamp() const
Is "stamp" value default?
bool isDefaultName() const
Is "name" value default?
std::string attr_id
Id of object.
void sendStamp(Atlas::Bridge &) const
Send the "stamp" attribute to an Atlas::Bridge.
const std::string & getName() const
Retrieve the "name" attribute.
bool instanceOf(int classNo) const override
Is this instance of some class?
~RootData() override=default
Default destructor.
void setAttr(std::string name, Atlas::Message::Element attr, const Atlas::Objects::Factories *factories=nullptr) override
Set the attribute "name" to the value given by"attr".
void sendParent(Atlas::Bridge &) const
Send the "parent" attribute to an Atlas::Bridge.
void sendName(Atlas::Bridge &) const
Send the "name" attribute to an Atlas::Bridge.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
bool isDefaultParent() const
Is "parent" value default?
void free() override
Free an instance of this class, returning it to the memory pool.
RootData * copy() const override
Copy this object.
void setId(std::string val)
Set the "id" attribute.
const std::string & getParent() const
Retrieve the "parent" attribute.
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
void setStamp(double val)
Set the "stamp" attribute.
double & modifyStamp()
Retrieve the "stamp" attribute as a non-const reference.
std::string & modifyName()
Retrieve the "name" attribute as a non-const reference.