00001 // This file may be redistributed and modified only under the terms of 00002 // the GNU Lesser General Public License (See COPYING for details). 00003 // Copyright 2000-2001 Stefanus Du Toit and Aloril. 00004 // Copyright 2001-2005 Alistair Riddoch. 00005 // Automatically generated using gen_cpp.py. 00006 00007 #ifndef ATLAS_OBJECTS_ENTITY_ROOTENTITY_H 00008 #define ATLAS_OBJECTS_ENTITY_ROOTENTITY_H 00009 00010 #include <Atlas/Objects/Root.h> 00011 #include <Atlas/Objects/SmartPtr.h> 00012 00013 namespace Atlas { namespace Objects { namespace Entity { 00014 00021 class RootEntityData; 00022 typedef SmartPtr<RootEntityData> RootEntity; 00023 00024 static const int ROOT_ENTITY_NO = 2; 00025 00028 00030 class RootEntityData : public RootData 00031 { 00032 protected: 00034 RootEntityData(RootEntityData *defaults = NULL) : 00035 RootData((RootData*)defaults) 00036 { 00037 m_class_no = ROOT_ENTITY_NO; 00038 } 00040 virtual ~RootEntityData(); 00041 00042 public: 00044 virtual RootEntityData * copy() const; 00045 00047 virtual bool instanceOf(int classNo) const; 00048 00051 virtual int copyAttr(const std::string& name, Atlas::Message::Element & attr) const; 00053 virtual void setAttr(const std::string& name, 00054 const Atlas::Message::Element& attr); 00056 virtual void removeAttr(const std::string& name); 00057 00059 virtual void sendContents(Atlas::Bridge & b) const; 00060 00062 virtual void addToMessage(Atlas::Message::MapType &) const; 00063 00065 inline void setLoc(const std::string& val); 00067 inline void setPos(const std::vector<double>& val); 00069 inline void setPosAsList(const Atlas::Message::ListType& val); 00071 inline void setVelocity(const std::vector<double>& val); 00073 inline void setVelocityAsList(const Atlas::Message::ListType& val); 00075 inline void setContains(const std::list<std::string>& val); 00077 inline void setContainsAsList(const Atlas::Message::ListType& val); 00079 inline void setStampContains(double val); 00080 00082 inline const std::string& getLoc() const; 00084 inline std::string& modifyLoc(); 00086 inline const std::vector<double>& getPos() const; 00088 inline std::vector<double>& modifyPos(); 00090 inline const Atlas::Message::ListType getPosAsList() const; 00092 inline const std::vector<double>& getVelocity() const; 00094 inline std::vector<double>& modifyVelocity(); 00096 inline const Atlas::Message::ListType getVelocityAsList() const; 00098 inline const std::list<std::string>& getContains() const; 00100 inline std::list<std::string>& modifyContains(); 00102 inline const Atlas::Message::ListType getContainsAsList() const; 00104 inline double getStampContains() const; 00106 inline double& modifyStampContains(); 00107 00109 inline bool isDefaultLoc() const; 00111 inline bool isDefaultPos() const; 00113 inline bool isDefaultVelocity() const; 00115 inline bool isDefaultContains() const; 00117 inline bool isDefaultStampContains() const; 00118 00119 protected: 00121 virtual int getAttrClass(const std::string& name)const; 00123 virtual int getAttrFlag(const std::string& name)const; 00125 std::string attr_loc; 00127 std::vector<double> attr_pos; 00129 std::vector<double> attr_velocity; 00131 std::list<std::string> attr_contains; 00133 double attr_stamp_contains; 00134 00136 void sendLoc(Atlas::Bridge&) const; 00138 void sendPos(Atlas::Bridge&) const; 00140 void sendVelocity(Atlas::Bridge&) const; 00142 void sendContains(Atlas::Bridge&) const; 00144 void sendStampContains(Atlas::Bridge&) const; 00145 00146 virtual void iterate(int& current_class, std::string& attr) const; 00147 00148 //freelist related things 00149 public: 00150 static RootEntityData *alloc(); 00151 virtual void free(); 00152 00157 virtual RootEntityData *getDefaultObject(); 00158 00163 static RootEntityData *getDefaultObjectInstance(); 00164 private: 00165 static RootEntityData *defaults_RootEntityData; 00166 static RootEntityData *begin_RootEntityData; 00167 00168 static std::map<std::string, int> * attr_flags_RootEntityData; 00169 }; 00170 00171 // 00172 // Attribute name strings follow. 00173 // 00174 00175 extern const std::string LOC_ATTR; 00176 extern const std::string POS_ATTR; 00177 extern const std::string VELOCITY_ATTR; 00178 extern const std::string CONTAINS_ATTR; 00179 extern const std::string STAMP_CONTAINS_ATTR; 00180 00181 // 00182 // Inlined member functions follow. 00183 // 00184 00185 const int LOC_FLAG = 1 << 6; 00186 00187 void RootEntityData::setLoc(const std::string& val) 00188 { 00189 attr_loc = val; 00190 m_attrFlags |= LOC_FLAG; 00191 } 00192 00193 const int POS_FLAG = 1 << 7; 00194 00195 void RootEntityData::setPos(const std::vector<double>& val) 00196 { 00197 attr_pos = val; 00198 m_attrFlags |= POS_FLAG; 00199 } 00200 00201 void RootEntityData::setPosAsList(const Atlas::Message::ListType& val) 00202 { 00203 m_attrFlags |= POS_FLAG; 00204 attr_pos.resize(0); 00205 for(Atlas::Message::ListType::const_iterator I = val.begin(); 00206 I != val.end(); 00207 I++) 00208 { 00209 if((*I).isNum()) { 00210 attr_pos.push_back((*I).asNum()); 00211 } 00212 } 00213 } 00214 00215 const int VELOCITY_FLAG = 1 << 8; 00216 00217 void RootEntityData::setVelocity(const std::vector<double>& val) 00218 { 00219 attr_velocity = val; 00220 m_attrFlags |= VELOCITY_FLAG; 00221 } 00222 00223 void RootEntityData::setVelocityAsList(const Atlas::Message::ListType& val) 00224 { 00225 m_attrFlags |= VELOCITY_FLAG; 00226 attr_velocity.resize(0); 00227 for(Atlas::Message::ListType::const_iterator I = val.begin(); 00228 I != val.end(); 00229 I++) 00230 { 00231 if((*I).isNum()) { 00232 attr_velocity.push_back((*I).asNum()); 00233 } 00234 } 00235 } 00236 00237 const int CONTAINS_FLAG = 1 << 9; 00238 00239 void RootEntityData::setContains(const std::list<std::string>& val) 00240 { 00241 attr_contains = val; 00242 m_attrFlags |= CONTAINS_FLAG; 00243 } 00244 00245 void RootEntityData::setContainsAsList(const Atlas::Message::ListType& val) 00246 { 00247 m_attrFlags |= CONTAINS_FLAG; 00248 attr_contains.resize(0); 00249 for(Atlas::Message::ListType::const_iterator I = val.begin(); 00250 I != val.end(); 00251 I++) 00252 { 00253 if((*I).isString()) { 00254 attr_contains.push_back((*I).asString()); 00255 } 00256 } 00257 } 00258 00259 const int STAMP_CONTAINS_FLAG = 1 << 10; 00260 00261 void RootEntityData::setStampContains(double val) 00262 { 00263 attr_stamp_contains = val; 00264 m_attrFlags |= STAMP_CONTAINS_FLAG; 00265 } 00266 00267 const std::string& RootEntityData::getLoc() const 00268 { 00269 if(m_attrFlags & LOC_FLAG) 00270 return attr_loc; 00271 else 00272 return ((RootEntityData*)m_defaults)->attr_loc; 00273 } 00274 00275 std::string& RootEntityData::modifyLoc() 00276 { 00277 if(!(m_attrFlags & LOC_FLAG)) 00278 setLoc(((RootEntityData*)m_defaults)->attr_loc); 00279 return attr_loc; 00280 } 00281 00282 const std::vector<double>& RootEntityData::getPos() const 00283 { 00284 if(m_attrFlags & POS_FLAG) 00285 return attr_pos; 00286 else 00287 return ((RootEntityData*)m_defaults)->attr_pos; 00288 } 00289 00290 std::vector<double>& RootEntityData::modifyPos() 00291 { 00292 if(!(m_attrFlags & POS_FLAG)) 00293 setPos(((RootEntityData*)m_defaults)->attr_pos); 00294 return attr_pos; 00295 } 00296 00297 const Atlas::Message::ListType RootEntityData::getPosAsList() const 00298 { 00299 const std::vector<double>& lst_in = getPos(); 00300 Atlas::Message::ListType lst_out; 00301 for(std::vector<double>::const_iterator I = lst_in.begin(); 00302 I != lst_in.end(); 00303 I++) 00304 { 00305 lst_out.push_back(*I); 00306 } 00307 return lst_out; 00308 } 00309 00310 const std::vector<double>& RootEntityData::getVelocity() const 00311 { 00312 if(m_attrFlags & VELOCITY_FLAG) 00313 return attr_velocity; 00314 else 00315 return ((RootEntityData*)m_defaults)->attr_velocity; 00316 } 00317 00318 std::vector<double>& RootEntityData::modifyVelocity() 00319 { 00320 if(!(m_attrFlags & VELOCITY_FLAG)) 00321 setVelocity(((RootEntityData*)m_defaults)->attr_velocity); 00322 return attr_velocity; 00323 } 00324 00325 const Atlas::Message::ListType RootEntityData::getVelocityAsList() const 00326 { 00327 const std::vector<double>& lst_in = getVelocity(); 00328 Atlas::Message::ListType lst_out; 00329 for(std::vector<double>::const_iterator I = lst_in.begin(); 00330 I != lst_in.end(); 00331 I++) 00332 { 00333 lst_out.push_back(*I); 00334 } 00335 return lst_out; 00336 } 00337 00338 const std::list<std::string>& RootEntityData::getContains() const 00339 { 00340 if(m_attrFlags & CONTAINS_FLAG) 00341 return attr_contains; 00342 else 00343 return ((RootEntityData*)m_defaults)->attr_contains; 00344 } 00345 00346 std::list<std::string>& RootEntityData::modifyContains() 00347 { 00348 if(!(m_attrFlags & CONTAINS_FLAG)) 00349 setContains(((RootEntityData*)m_defaults)->attr_contains); 00350 return attr_contains; 00351 } 00352 00353 const Atlas::Message::ListType RootEntityData::getContainsAsList() const 00354 { 00355 const std::list<std::string>& lst_in = getContains(); 00356 Atlas::Message::ListType lst_out; 00357 for(std::list<std::string>::const_iterator I = lst_in.begin(); 00358 I != lst_in.end(); 00359 I++) 00360 { 00361 lst_out.push_back(std::string(*I)); 00362 } 00363 return lst_out; 00364 } 00365 00366 double RootEntityData::getStampContains() const 00367 { 00368 if(m_attrFlags & STAMP_CONTAINS_FLAG) 00369 return attr_stamp_contains; 00370 else 00371 return ((RootEntityData*)m_defaults)->attr_stamp_contains; 00372 } 00373 00374 double& RootEntityData::modifyStampContains() 00375 { 00376 if(!(m_attrFlags & STAMP_CONTAINS_FLAG)) 00377 setStampContains(((RootEntityData*)m_defaults)->attr_stamp_contains); 00378 return attr_stamp_contains; 00379 } 00380 00381 bool RootEntityData::isDefaultLoc() const 00382 { 00383 return (m_attrFlags & LOC_FLAG) == 0; 00384 } 00385 00386 bool RootEntityData::isDefaultPos() const 00387 { 00388 return (m_attrFlags & POS_FLAG) == 0; 00389 } 00390 00391 bool RootEntityData::isDefaultVelocity() const 00392 { 00393 return (m_attrFlags & VELOCITY_FLAG) == 0; 00394 } 00395 00396 bool RootEntityData::isDefaultContains() const 00397 { 00398 return (m_attrFlags & CONTAINS_FLAG) == 0; 00399 } 00400 00401 bool RootEntityData::isDefaultStampContains() const 00402 { 00403 return (m_attrFlags & STAMP_CONTAINS_FLAG) == 0; 00404 } 00405 00406 00407 } } } // namespace Atlas::Objects::Entity 00408 00409 #endif // ATLAS_OBJECTS_ENTITY_ROOTENTITY_H
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.