8 #include <Atlas/Objects/RootEntity.h> 11 using Atlas::Message::MapType;
13 namespace Atlas {
namespace Objects {
namespace Entity {
15 const std::string LOC_ATTR =
"loc";
16 const std::string POS_ATTR =
"pos";
17 const std::string VELOCITY_ATTR =
"velocity";
18 const std::string CONTAINS_ATTR =
"contains";
19 const std::string STAMP_CONTAINS_ATTR =
"stamp_contains";
23 if (allocator.attr_flags_Data.find(name) != allocator.attr_flags_Data.end()) {
24 return ROOT_ENTITY_NO;
31 auto I = allocator.attr_flags_Data.find(name);
32 if (I != allocator.attr_flags_Data.end()) {
41 if (name == LOC_ATTR) { attr =
getLoc();
return 0; }
42 if (name == POS_ATTR) { attr =
getPosAsList();
return 0; }
62 { m_attrFlags &= ~LOC_FLAG;
return;}
64 { m_attrFlags &= ~POS_FLAG;
return;}
65 if (name == VELOCITY_ATTR)
66 { m_attrFlags &= ~VELOCITY_FLAG;
return;}
67 if (name == CONTAINS_ATTR)
68 { m_attrFlags &= ~CONTAINS_FLAG;
return;}
69 if (name == STAMP_CONTAINS_ATTR)
70 { m_attrFlags &= ~STAMP_CONTAINS_FLAG;
return;}
76 if(m_attrFlags & LOC_FLAG) {
83 if(m_attrFlags & POS_FLAG) {
94 if(m_attrFlags & VELOCITY_FLAG) {
105 if(m_attrFlags & CONTAINS_FLAG) {
116 if(m_attrFlags & STAMP_CONTAINS_FLAG) {
134 if(m_attrFlags & LOC_FLAG)
136 if(m_attrFlags & POS_FLAG)
138 if(m_attrFlags & VELOCITY_FLAG)
140 if(m_attrFlags & CONTAINS_FLAG)
142 if(m_attrFlags & STAMP_CONTAINS_FLAG)
152 allocator.free(
this);
164 return copyInstance<RootEntityData>(*this);
169 if(ROOT_ENTITY_NO == classNo)
return true;
173 void RootEntityData::fillDefaultObjectInstance(
RootEntityData& data, std::map<std::string, uint32_t>& attr_data)
187 attr_data[LOC_ATTR] = LOC_FLAG;
188 attr_data[POS_ATTR] = POS_FLAG;
189 attr_data[VELOCITY_ATTR] = VELOCITY_FLAG;
190 attr_data[CONTAINS_ATTR] = CONTAINS_FLAG;
191 attr_data[STAMP_CONTAINS_ATTR] = STAMP_CONTAINS_FLAG;
FloatType asFloat() const
Retrieve the current value as a double.
std::string attr_parent
The object this inherits attributes from.
void reset() override
Resets the object as it's returned to the pool.
std::string attr_objtype
What kind of object this is.
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
std::vector< double > attr_velocity
Velocity object is moving, usually world is 3D.
virtual void listFloatItem(double)=0
bool instanceOf(int classNo) const override
Is this instance of some class?
StringType && moveString()
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
void sendLoc(Atlas::Bridge &) const
Send the "loc" attribute to an Atlas::Bridge.
double getStampContains() const
Retrieve the "stamp_contains" attribute.
virtual void mapListItem(std::string name)=0
void setVelocityAsList(const Atlas::Message::ListType &val)
Set the "velocity" attribute AsList.
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
void free() override
Free an instance of this class, returning it to the memory pool.
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".
Starting point for entity hierarchy.
virtual void mapStringItem(std::string name, std::string)=0
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 setPosAsList(const Atlas::Message::ListType &val)
Set the "pos" attribute AsList.
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
void sendPos(Atlas::Bridge &) const
Send the "pos" attribute to an Atlas::Bridge.
void setStampContains(double val)
Set the "stamp_contains" attribute.
bool instanceOf(int classNo) const override
Is this instance of some class?
void sendVelocity(Atlas::Bridge &) const
Send the "velocity" attribute to an Atlas::Bridge.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
void sendStampContains(Atlas::Bridge &) const
Send the "stamp_contains" attribute to an Atlas::Bridge.
std::vector< double > attr_pos
Position coordinates, usually world is 3D.
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
Atlas::Message::ListType getPosAsList() const
Retrieve the "pos" attribute AsList.
virtual void mapFloatItem(std::string name, double)=0
Atlas::Message::ListType getVelocityAsList() const
Retrieve the "velocity" attribute AsList.
virtual void listStringItem(std::string)=0
void setLoc(std::string val)
Set the "loc" attribute.
void setContainsAsList(const Atlas::Message::ListType &val)
Set the "contains" attribute AsList.
const std::string & getLoc() const
Retrieve the "loc" attribute.
RootEntityData * copy() const override
Copy this object.
void sendContains(Atlas::Bridge &) const
Send the "contains" attribute to an Atlas::Bridge.
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
std::string attr_loc
Reference object for coordinates (location).
double attr_stamp
Last time this object was modified.
void reset() override
Resets the object as it's returned to the pool.
std::vector< std::string > attr_contains
List of objects that use this object as reference system (usually same as what this object contains)...
Atlas::Message::ListType getContainsAsList() const
Retrieve the "contains" attribute AsList.
double attr_stamp_contains
Last time any object that uses this as reference recursively has been modified.