7 #ifndef ATLAS_OBJECTS_ENTITY_ROOTENTITY_H 8 #define ATLAS_OBJECTS_ENTITY_ROOTENTITY_H 10 #include <Atlas/Objects/Root.h> 11 #include <Atlas/Objects/SmartPtr.h> 13 namespace Atlas {
namespace Objects {
namespace Entity {
22 typedef SmartPtr<RootEntityData> RootEntity;
24 static const int ROOT_ENTITY_NO = 2;
37 m_class_no = ROOT_ENTITY_NO;
53 virtual void setAttr(
const std::string& name,
56 virtual void removeAttr(
const std::string& name);
62 virtual void addToMessage(Atlas::Message::MapType &)
const;
65 inline void setLoc(
const std::string& val);
67 inline void setPos(
const std::vector<double>& val);
69 inline void setPosAsList(
const Atlas::Message::ListType& val);
71 inline void setVelocity(
const std::vector<double>& val);
75 inline void setContains(
const std::list<std::string>& val);
82 inline const std::string&
getLoc()
const;
86 inline const std::vector<double>&
getPos()
const;
90 inline const Atlas::Message::ListType
getPosAsList()
const;
92 inline const std::vector<double>&
getVelocity()
const;
98 inline const std::list<std::string>&
getContains()
const;
123 virtual int getAttrFlag(
const std::string& name)
const;
146 virtual void iterate(
int& current_class, std::string& attr)
const;
168 static std::map<std::string, int> * attr_flags_RootEntityData;
175 extern const std::string LOC_ATTR;
176 extern const std::string POS_ATTR;
177 extern const std::string VELOCITY_ATTR;
178 extern const std::string CONTAINS_ATTR;
179 extern const std::string STAMP_CONTAINS_ATTR;
185 const int LOC_FLAG = 1 << 6;
190 m_attrFlags |= LOC_FLAG;
193 const int POS_FLAG = 1 << 7;
198 m_attrFlags |= POS_FLAG;
203 m_attrFlags |= POS_FLAG;
205 for(Atlas::Message::ListType::const_iterator I = val.begin();
215 const int VELOCITY_FLAG = 1 << 8;
220 m_attrFlags |= VELOCITY_FLAG;
225 m_attrFlags |= VELOCITY_FLAG;
227 for(Atlas::Message::ListType::const_iterator I = val.begin();
237 const int CONTAINS_FLAG = 1 << 9;
242 m_attrFlags |= CONTAINS_FLAG;
247 m_attrFlags |= CONTAINS_FLAG;
249 for(Atlas::Message::ListType::const_iterator I = val.begin();
253 if((*I).isString()) {
259 const int STAMP_CONTAINS_FLAG = 1 << 10;
264 m_attrFlags |= STAMP_CONTAINS_FLAG;
269 if(m_attrFlags & LOC_FLAG)
277 if(!(m_attrFlags & LOC_FLAG))
284 if(m_attrFlags & POS_FLAG)
292 if(!(m_attrFlags & POS_FLAG))
299 const std::vector<double>& lst_in =
getPos();
300 Atlas::Message::ListType lst_out;
301 for(std::vector<double>::const_iterator I = lst_in.begin();
305 lst_out.push_back(*I);
312 if(m_attrFlags & VELOCITY_FLAG)
320 if(!(m_attrFlags & VELOCITY_FLAG))
328 Atlas::Message::ListType lst_out;
329 for(std::vector<double>::const_iterator I = lst_in.begin();
333 lst_out.push_back(*I);
340 if(m_attrFlags & CONTAINS_FLAG)
348 if(!(m_attrFlags & CONTAINS_FLAG))
355 const std::list<std::string>& lst_in =
getContains();
356 Atlas::Message::ListType lst_out;
357 for(std::list<std::string>::const_iterator I = lst_in.begin();
361 lst_out.push_back(std::string(*I));
368 if(m_attrFlags & STAMP_CONTAINS_FLAG)
376 if(!(m_attrFlags & STAMP_CONTAINS_FLAG))
383 return (m_attrFlags & LOC_FLAG) == 0;
388 return (m_attrFlags & POS_FLAG) == 0;
393 return (m_attrFlags & VELOCITY_FLAG) == 0;
398 return (m_attrFlags & CONTAINS_FLAG) == 0;
403 return (m_attrFlags & STAMP_CONTAINS_FLAG) == 0;
409 #endif // ATLAS_OBJECTS_ENTITY_ROOTENTITY_H virtual ~RootEntityData()
Default destructor.
const Atlas::Message::ListType getContainsAsList() const
Retrieve the "contains" attribute AsList.
Definition: RootEntity.h:353
std::vector< double > & modifyPos()
Retrieve the "pos" attribute as a non-const reference.
Definition: RootEntity.h:290
const std::list< std::string > & getContains() const
Retrieve the "contains" attribute.
Definition: RootEntity.h:338
void setVelocityAsList(const Atlas::Message::ListType &val)
Set the "velocity" attribute AsList.
Definition: RootEntity.h:223
const std::vector< double > & getVelocity() const
Retrieve the "velocity" attribute.
Definition: RootEntity.h:310
RootEntityData(RootEntityData *defaults=NULL)
Construct a RootEntityData class definition.
Definition: RootEntity.h:34
Atlas stream bridge.
Definition: Bridge.h:35
virtual bool instanceOf(int classNo) const
Is this instance of some class?
std::vector< double > attr_pos
Position coordinates, usually world is 3D.
Definition: RootEntity.h:127
const Atlas::Message::ListType getPosAsList() const
Retrieve the "pos" attribute AsList.
Definition: RootEntity.h:297
bool isDefaultVelocity() const
Is "velocity" value default?
Definition: RootEntity.h:391
void sendStampContains(Atlas::Bridge &) const
Send the "stamp_contains" attribute to an Atlas::Bridge.
bool isDefaultLoc() const
Is "loc" value default?
Definition: RootEntity.h:381
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
double attr_stamp_contains
Last time any object that uses this as reference recursively has been modified.
Definition: RootEntity.h:133
Multi-type container.
Definition: Element.h:60
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by"attr".
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
std::vector< double > & modifyVelocity()
Retrieve the "velocity" attribute as a non-const reference.
Definition: RootEntity.h:318
The Atlas namespace.
Definition: Bridge.h:20
void sendContains(Atlas::Bridge &) const
Send the "contains" attribute to an Atlas::Bridge.
void sendPos(Atlas::Bridge &) const
Send the "pos" attribute to an Atlas::Bridge.
All objects inherit from this.
Definition: Root.h:35
void setContainsAsList(const Atlas::Message::ListType &val)
Set the "contains" attribute AsList.
Definition: RootEntity.h:245
virtual RootEntityData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
void setPos(const std::vector< double > &val)
Set the "pos" attribute.
Definition: RootEntity.h:195
const Atlas::Message::ListType getVelocityAsList() const
Retrieve the "velocity" attribute AsList.
Definition: RootEntity.h:325
bool isDefaultPos() const
Is "pos" value default?
Definition: RootEntity.h:386
double & modifyStampContains()
Retrieve the "stamp_contains" attribute as a non-const reference.
Definition: RootEntity.h:374
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
std::vector< double > attr_velocity
Velocity object is moving, usually world is 3D.
Definition: RootEntity.h:129
void setPosAsList(const Atlas::Message::ListType &val)
Set the "pos" attribute AsList.
Definition: RootEntity.h:201
std::string & modifyLoc()
Retrieve the "loc" attribute as a non-const reference.
Definition: RootEntity.h:275
double getStampContains() const
Retrieve the "stamp_contains" attribute.
Definition: RootEntity.h:366
virtual void free()
Free an instance of this class, returning it to the memory pool.
bool isDefaultStampContains() const
Is "stamp_contains" value default?
Definition: RootEntity.h:401
std::list< std::string > & modifyContains()
Retrieve the "contains" attribute as a non-const reference.
Definition: RootEntity.h:346
std::list< std::string > attr_contains
List of objects that use this object as reference system (usually same as what this object contains)...
Definition: RootEntity.h:131
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
void setContains(const std::list< std::string > &val)
Set the "contains" attribute.
Definition: RootEntity.h:239
Starting point for entity hierarchy.
Definition: RootEntity.h:30
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
std::string attr_loc
Reference object for coordinates (location).
Definition: RootEntity.h:125
void setLoc(const std::string &val)
Set the "loc" attribute.
Definition: RootEntity.h:187
void setStampContains(double val)
Set the "stamp_contains" attribute.
Definition: RootEntity.h:261
virtual RootEntityData * copy() const
Copy this object.
const std::string & getLoc() const
Retrieve the "loc" attribute.
Definition: RootEntity.h:267
void sendLoc(Atlas::Bridge &) const
Send the "loc" attribute to an Atlas::Bridge.
void sendVelocity(Atlas::Bridge &) const
Send the "velocity" attribute to an Atlas::Bridge.
static RootEntityData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
virtual void removeAttr(const std::string &name)
Remove the attribute "name". This will not work for static attributes.
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
void setVelocity(const std::vector< double > &val)
Set the "velocity" attribute.
Definition: RootEntity.h:217
const std::vector< double > & getPos() const
Retrieve the "pos" attribute.
Definition: RootEntity.h:282
bool isDefaultContains() const
Is "contains" value default?
Definition: RootEntity.h:396