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