8 #include <Atlas/Objects/Root.h> 11 using Atlas::Message::MapType;
13 namespace Atlas {
namespace Objects {
15 const std::string ID_ATTR =
"id";
16 const std::string PARENT_ATTR =
"parent";
17 const std::string STAMP_ATTR =
"stamp";
18 const std::string OBJTYPE_ATTR =
"objtype";
19 const std::string NAME_ATTR =
"name";
23 if (allocator.attr_flags_Data.find(name) != allocator.attr_flags_Data.end()) {
31 auto I = allocator.attr_flags_Data.find(name);
32 if (I != allocator.attr_flags_Data.end()) {
41 if (name == ID_ATTR) { attr =
getId();
return 0; }
42 if (name == PARENT_ATTR) { attr =
getParent();
return 0; }
43 if (name == STAMP_ATTR) { attr =
getStamp();
return 0; }
44 if (name == OBJTYPE_ATTR) { attr =
getObjtype();
return 0; }
45 if (name == NAME_ATTR) { attr =
getName();
return 0; }
62 { m_attrFlags &= ~ID_FLAG;
return;}
63 if (name == PARENT_ATTR)
64 { m_attrFlags &= ~PARENT_FLAG;
return;}
65 if (name == STAMP_ATTR)
66 { m_attrFlags &= ~STAMP_FLAG;
return;}
67 if (name == OBJTYPE_ATTR)
68 { m_attrFlags &= ~OBJTYPE_FLAG;
return;}
69 if (name == NAME_ATTR)
70 { m_attrFlags &= ~NAME_FLAG;
return;}
76 if(m_attrFlags & ID_FLAG) {
90 if(m_attrFlags & STAMP_FLAG) {
104 if(m_attrFlags & NAME_FLAG) {
122 if(m_attrFlags & ID_FLAG)
124 const std::string& l_attr_parent =
getParent();
125 if (!l_attr_parent.empty())
126 m[PARENT_ATTR] = l_attr_parent;
127 if(m_attrFlags & STAMP_FLAG)
129 const std::string& l_attr_objtype =
getObjtype();
130 if (!l_attr_objtype.empty())
131 m[OBJTYPE_ATTR] = l_attr_objtype;
132 if(m_attrFlags & NAME_FLAG)
142 allocator.free(
this);
153 return copyInstance<RootData>(*this);
158 if(ROOT_NO == classNo)
return true;
162 void RootData::fillDefaultObjectInstance(
RootData& data, std::map<std::string, uint32_t>& attr_data)
167 attr_data[ID_ATTR] = ID_FLAG;
168 attr_data[PARENT_ATTR] = PARENT_FLAG;
169 attr_data[STAMP_ATTR] = STAMP_FLAG;
170 attr_data[OBJTYPE_ATTR] = OBJTYPE_FLAG;
171 attr_data[NAME_ATTR] = NAME_FLAG;
FloatType asFloat() const
Retrieve the current value as a double.
std::string attr_parent
The object this inherits attributes from.
std::string attr_name
Name of object.
std::string attr_objtype
What kind of object this is.
void free() override
Free an instance of this class, returning it to the memory pool.
const std::string & getId() const
Retrieve the "id" attribute.
double getStamp() const
Retrieve the "stamp" attribute.
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
bool instanceOf(int classNo) const override
Is this instance of some class?
virtual void removeAttr(const std::string &name)
Remove the attribute "name".
StringType && moveString()
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
const std::string & getName() const
Retrieve the "name" attribute.
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
std::string attr_id
Id of object.
void sendId(Atlas::Bridge &) const
Send the "id" attribute to an Atlas::Bridge.
const std::string & getObjtype() const
Retrieve the "objtype" attribute.
RootData * copy() const override
Copy this object.
void sendObjtype(Atlas::Bridge &) const
Send the "objtype" attribute to an Atlas::Bridge.
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
const std::string & getParent() const
Retrieve the "parent" attribute.
void setStamp(double val)
Set the "stamp" attribute.
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".
virtual void mapStringItem(std::string name, std::string)=0
void sendName(Atlas::Bridge &) const
Send the "name" attribute to an Atlas::Bridge.
void sendParent(Atlas::Bridge &) const
Send the "parent" attribute to an Atlas::Bridge.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
virtual void setAttr(std::string name, Atlas::Message::Element attr, const Atlas::Objects::Factories *factories=nullptr)
Set the attribute "name" to the value given by "attr".
All objects inherit from this..
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
virtual void mapFloatItem(std::string name, double)=0
void sendStamp(Atlas::Bridge &) const
Send the "stamp" attribute to an Atlas::Bridge.
void setObjtype(std::string val)
Set the "objtype" attribute.
virtual bool getAttrFlag(const std::string &name, uint32_t &flag) const
Find the flag for the attribute "name".
void setName(std::string val)
Set the "name" attribute.
BaseObjectData * m_defaults
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
double attr_stamp
Last time this object was modified.
void setId(std::string val)
Set the "id" attribute.
void reset() override
Resets the object as it's returned to the pool.
void setParent(std::string val)
Set the "parent" attribute.