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_ROOT_H 00008 #define ATLAS_OBJECTS_ROOT_H 00009 00010 #include <Atlas/Objects/BaseObject.h> 00011 00012 #include <Atlas/Message/Element.h> 00013 00014 namespace Atlas { namespace Objects { 00015 00016 template <class T> class SmartPtr; 00017 00025 class RootData; 00026 typedef SmartPtr<RootData> Root; 00027 00028 static const int ROOT_NO = 1; 00029 00032 00035 class RootData : public BaseObjectData 00036 { 00037 protected: 00039 RootData(RootData *defaults = NULL) : 00040 BaseObjectData((BaseObjectData*)defaults) 00041 { 00042 m_class_no = ROOT_NO; 00043 } 00045 virtual ~RootData(); 00046 00047 public: 00049 virtual RootData * copy() const; 00050 00052 virtual bool instanceOf(int classNo) const; 00053 00056 virtual int copyAttr(const std::string& name, Atlas::Message::Element & attr) const; 00058 virtual void setAttr(const std::string& name, 00059 const Atlas::Message::Element& attr); 00061 virtual void removeAttr(const std::string& name); 00062 00064 virtual void sendContents(Atlas::Bridge & b) const; 00065 00067 virtual void addToMessage(Atlas::Message::MapType &) const; 00068 00070 inline void setId(const std::string& val); 00072 inline void setParents(const std::list<std::string>& val); 00074 inline void setParentsAsList(const Atlas::Message::ListType& val); 00076 inline void setStamp(double val); 00078 inline void setObjtype(const std::string& val); 00080 inline void setName(const std::string& val); 00081 00083 inline const std::string& getId() const; 00085 inline std::string& modifyId(); 00087 inline const std::list<std::string>& getParents() const; 00089 inline std::list<std::string>& modifyParents(); 00091 inline const Atlas::Message::ListType getParentsAsList() const; 00093 inline double getStamp() const; 00095 inline double& modifyStamp(); 00097 inline const std::string& getObjtype() const; 00099 inline std::string& modifyObjtype(); 00101 inline const std::string& getName() const; 00103 inline std::string& modifyName(); 00104 00106 inline bool isDefaultId() const; 00108 inline bool isDefaultParents() const; 00110 inline bool isDefaultStamp() const; 00112 inline bool isDefaultObjtype() const; 00114 inline bool isDefaultName() const; 00115 00116 protected: 00118 virtual int getAttrClass(const std::string& name)const; 00120 virtual int getAttrFlag(const std::string& name)const; 00122 std::string attr_id; 00124 std::list<std::string> attr_parents; 00126 double attr_stamp; 00128 std::string attr_objtype; 00130 std::string attr_name; 00131 00133 void sendId(Atlas::Bridge&) const; 00135 void sendParents(Atlas::Bridge&) const; 00137 void sendStamp(Atlas::Bridge&) const; 00139 void sendObjtype(Atlas::Bridge&) const; 00141 void sendName(Atlas::Bridge&) const; 00142 00143 virtual void iterate(int& current_class, std::string& attr) const; 00144 00145 //freelist related things 00146 public: 00147 static RootData *alloc(); 00148 virtual void free(); 00149 00154 virtual RootData *getDefaultObject(); 00155 00160 static RootData *getDefaultObjectInstance(); 00161 private: 00162 static RootData *defaults_RootData; 00163 static RootData *begin_RootData; 00164 00165 static std::map<std::string, int> * attr_flags_RootData; 00166 }; 00167 00168 // 00169 // Attribute name strings follow. 00170 // 00171 00172 extern const std::string ID_ATTR; 00173 extern const std::string PARENTS_ATTR; 00174 extern const std::string STAMP_ATTR; 00175 extern const std::string OBJTYPE_ATTR; 00176 extern const std::string NAME_ATTR; 00177 00178 // 00179 // Inlined member functions follow. 00180 // 00181 00182 const int ID_FLAG = 1 << 1; 00183 00184 void RootData::setId(const std::string& val) 00185 { 00186 attr_id = val; 00187 m_attrFlags |= ID_FLAG; 00188 } 00189 00190 const int PARENTS_FLAG = 1 << 2; 00191 00192 void RootData::setParents(const std::list<std::string>& val) 00193 { 00194 attr_parents = val; 00195 m_attrFlags |= PARENTS_FLAG; 00196 } 00197 00198 void RootData::setParentsAsList(const Atlas::Message::ListType& val) 00199 { 00200 m_attrFlags |= PARENTS_FLAG; 00201 attr_parents.resize(0); 00202 for(Atlas::Message::ListType::const_iterator I = val.begin(); 00203 I != val.end(); 00204 I++) 00205 { 00206 if((*I).isString()) { 00207 attr_parents.push_back((*I).asString()); 00208 } 00209 } 00210 } 00211 00212 const int STAMP_FLAG = 1 << 3; 00213 00214 void RootData::setStamp(double val) 00215 { 00216 attr_stamp = val; 00217 m_attrFlags |= STAMP_FLAG; 00218 } 00219 00220 const int OBJTYPE_FLAG = 1 << 4; 00221 00222 void RootData::setObjtype(const std::string& val) 00223 { 00224 attr_objtype = val; 00225 m_attrFlags |= OBJTYPE_FLAG; 00226 } 00227 00228 const int NAME_FLAG = 1 << 5; 00229 00230 void RootData::setName(const std::string& val) 00231 { 00232 attr_name = val; 00233 m_attrFlags |= NAME_FLAG; 00234 } 00235 00236 const std::string& RootData::getId() const 00237 { 00238 if(m_attrFlags & ID_FLAG) 00239 return attr_id; 00240 else 00241 return ((RootData*)m_defaults)->attr_id; 00242 } 00243 00244 std::string& RootData::modifyId() 00245 { 00246 if(!(m_attrFlags & ID_FLAG)) 00247 setId(((RootData*)m_defaults)->attr_id); 00248 return attr_id; 00249 } 00250 00251 const std::list<std::string>& RootData::getParents() const 00252 { 00253 if(m_attrFlags & PARENTS_FLAG) 00254 return attr_parents; 00255 else 00256 return ((RootData*)m_defaults)->attr_parents; 00257 } 00258 00259 std::list<std::string>& RootData::modifyParents() 00260 { 00261 if(!(m_attrFlags & PARENTS_FLAG)) 00262 setParents(((RootData*)m_defaults)->attr_parents); 00263 return attr_parents; 00264 } 00265 00266 const Atlas::Message::ListType RootData::getParentsAsList() const 00267 { 00268 const std::list<std::string>& lst_in = getParents(); 00269 Atlas::Message::ListType lst_out; 00270 for(std::list<std::string>::const_iterator I = lst_in.begin(); 00271 I != lst_in.end(); 00272 I++) 00273 { 00274 lst_out.push_back(std::string(*I)); 00275 } 00276 return lst_out; 00277 } 00278 00279 double RootData::getStamp() const 00280 { 00281 if(m_attrFlags & STAMP_FLAG) 00282 return attr_stamp; 00283 else 00284 return ((RootData*)m_defaults)->attr_stamp; 00285 } 00286 00287 double& RootData::modifyStamp() 00288 { 00289 if(!(m_attrFlags & STAMP_FLAG)) 00290 setStamp(((RootData*)m_defaults)->attr_stamp); 00291 return attr_stamp; 00292 } 00293 00294 const std::string& RootData::getObjtype() const 00295 { 00296 if(m_attrFlags & OBJTYPE_FLAG) 00297 return attr_objtype; 00298 else 00299 return ((RootData*)m_defaults)->attr_objtype; 00300 } 00301 00302 std::string& RootData::modifyObjtype() 00303 { 00304 if(!(m_attrFlags & OBJTYPE_FLAG)) 00305 setObjtype(((RootData*)m_defaults)->attr_objtype); 00306 return attr_objtype; 00307 } 00308 00309 const std::string& RootData::getName() const 00310 { 00311 if(m_attrFlags & NAME_FLAG) 00312 return attr_name; 00313 else 00314 return ((RootData*)m_defaults)->attr_name; 00315 } 00316 00317 std::string& RootData::modifyName() 00318 { 00319 if(!(m_attrFlags & NAME_FLAG)) 00320 setName(((RootData*)m_defaults)->attr_name); 00321 return attr_name; 00322 } 00323 00324 bool RootData::isDefaultId() const 00325 { 00326 return (m_attrFlags & ID_FLAG) == 0; 00327 } 00328 00329 bool RootData::isDefaultParents() const 00330 { 00331 return (m_attrFlags & PARENTS_FLAG) == 0; 00332 } 00333 00334 bool RootData::isDefaultStamp() const 00335 { 00336 return (m_attrFlags & STAMP_FLAG) == 0; 00337 } 00338 00339 bool RootData::isDefaultObjtype() const 00340 { 00341 return (m_attrFlags & OBJTYPE_FLAG) == 0; 00342 } 00343 00344 bool RootData::isDefaultName() const 00345 { 00346 return (m_attrFlags & NAME_FLAG) == 0; 00347 } 00348 00349 00350 } } // namespace Atlas::Objects 00351 00352 #endif // ATLAS_OBJECTS_ROOT_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.