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
void sendContains(Atlas::Bridge &) const
Send the "contains" attribute to an Atlas::Bridge.
const Atlas::Message::ListType getPosAsList() const
Retrieve the "pos" attribute AsList.
Definition: RootEntity.h:297
All objects inherit from this.
Definition: Root.h:35
Atlas stream bridge.
Definition: Bridge.h:35
std::vector< double > attr_pos
Position coordinates, usually world is 3D.
Definition: RootEntity.h:127
RootEntityData(RootEntityData *defaults=NULL)
Construct a RootEntityData class definition.
Definition: RootEntity.h:34
const Atlas::Message::ListType getVelocityAsList() const
Retrieve the "velocity" attribute AsList.
Definition: RootEntity.h:325
std::list< std::string > & modifyContains()
Retrieve the "contains" attribute as a non-const reference.
Definition: RootEntity.h:346
virtual bool instanceOf(int classNo) const
Is this instance of some class?
static RootEntityData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
bool isDefaultLoc() const
Is "loc" value default?
Definition: RootEntity.h:381
std::vector< double > attr_velocity
Velocity object is moving, usually world is 3D.
Definition: RootEntity.h:129
void sendPos(Atlas::Bridge &) const
Send the "pos" attribute to an Atlas::Bridge.
std::string & modifyLoc()
Retrieve the "loc" attribute as a non-const reference.
Definition: RootEntity.h:275
void setLoc(const std::string &val)
Set the "loc" attribute.
Definition: RootEntity.h:187
std::string attr_loc
Reference object for coordinates (location).
Definition: RootEntity.h:125
void setPos(const std::vector< double > &val)
Set the "pos" attribute.
Definition: RootEntity.h:195
bool isDefaultPos() const
Is "pos" value default?
Definition: RootEntity.h:386
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
bool isDefaultStampContains() const
Is "stamp_contains" value default?
Definition: RootEntity.h:401
const std::vector< double > & getVelocity() const
Retrieve the "velocity" attribute.
Definition: RootEntity.h:310
bool isDefaultVelocity() const
Is "velocity" value default?
Definition: RootEntity.h:391
const Atlas::Message::ListType getContainsAsList() const
Retrieve the "contains" attribute AsList.
Definition: RootEntity.h:353
virtual RootEntityData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
Multi-type container.
Definition: Element.h:60
void setVelocity(const std::vector< double > &val)
Set the "velocity" attribute.
Definition: RootEntity.h:217
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
std::vector< double > & modifyVelocity()
Retrieve the "velocity" attribute as a non-const reference.
Definition: RootEntity.h:318
const std::string & getLoc() const
Retrieve the "loc" attribute.
Definition: RootEntity.h:267
const std::list< std::string > & getContains() const
Retrieve the "contains" attribute.
Definition: RootEntity.h:338
void setStampContains(double val)
Set the "stamp_contains" attribute.
Definition: RootEntity.h:261
double getStampContains() const
Retrieve the "stamp_contains" attribute.
Definition: RootEntity.h:366
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".
virtual void free()
Free an instance of this class, returning it to the memory pool.
bool isDefaultContains() const
Is "contains" value default?
Definition: RootEntity.h:396
virtual RootEntityData * copy() const
Copy this object.
Starting point for entity hierarchy.
Definition: RootEntity.h:30
void setVelocityAsList(const Atlas::Message::ListType &val)
Set the "velocity" attribute AsList.
Definition: RootEntity.h:223
std::vector< double > & modifyPos()
Retrieve the "pos" attribute as a non-const reference.
Definition: RootEntity.h:290
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
The Atlas namespace.
Definition: Bridge.h:20
void setContainsAsList(const Atlas::Message::ListType &val)
Set the "contains" attribute AsList.
Definition: RootEntity.h:245
void sendLoc(Atlas::Bridge &) const
Send the "loc" attribute to an Atlas::Bridge.
double & modifyStampContains()
Retrieve the "stamp_contains" attribute as a non-const reference.
Definition: RootEntity.h:374
void sendVelocity(Atlas::Bridge &) const
Send the "velocity" attribute to an Atlas::Bridge.
const std::vector< double > & getPos() const
Retrieve the "pos" attribute.
Definition: RootEntity.h:282
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by"attr".
void sendStampContains(Atlas::Bridge &) const
Send the "stamp_contains" attribute to an Atlas::Bridge.
void setContains(const std::list< std::string > &val)
Set the "contains" attribute.
Definition: RootEntity.h:239
void setPosAsList(const Atlas::Message::ListType &val)
Set the "pos" attribute AsList.
Definition: RootEntity.h:201
double attr_stamp_contains
Last time any object that uses this as reference recursively has been modified.
Definition: RootEntity.h:133
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 ~RootEntityData()
Default destructor.
Copyright 2000-2004 the respective authors.
This document can be licensed under the terms of the GNU Free Documentation
License or the GNU General Public License and may be freely distributed under
the terms given by one of these licenses.