Changeset 9718 in orxonox.OLD for branches/new_class_id/src/lib/lang
- Timestamp:
- Sep 1, 2006, 11:56:54 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/lang
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/lang/base_object.cc
r9715 r9718 28 28 */ 29 29 BaseObject::BaseObject(const std::string& objectName) 30 : _leafClassID(&BaseObject::classID())31 30 { 32 31 this->className = "BaseObject"; -
branches/new_class_id/src/lib/lang/base_object.h
r9716 r9718 48 48 inline const std::string& getClassName() const { return _classes.front()._objectList->name(); }; 49 49 50 inline const ClassID& getClassID() const { return *_leafClassID; }50 inline const ClassID& getClassID() const { return _classes.front()._objectList->identity(); } 51 51 /** @returns the ID of the Topmost object of the ClassStack */ 52 inline const int& getLeafClassID() const { return _ leafClassID->id(); }52 inline const int& getLeafClassID() const { return _classes.front()._objectList->identity().id(); } 53 53 54 54 bool isA(const ObjectListBase& objectList) const; … … 89 89 std::string className; //!< the name of the class 90 90 ClassList _classes; //!< All Classes this object is part of. 91 const ClassID* _leafClassID; //!< Topmost ClassID.92 91 }; 93 92 … … 105 104 inline void BaseObject::registerObject(T* object, ObjectList<T>& objectList) 106 105 { 107 this->_leafClassID = &objectList.identity();108 106 this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object))); 109 107 } -
branches/new_class_id/src/lib/lang/object_list.h
r9716 r9718 72 72 virtual void getBaseObjectList(base_list* list) const = 0; 73 73 74 static const ClassID& retrieveIdentity(int id);75 static const ClassID& retrieveIdentity(const std::string& name);76 77 static const ObjectListBase* const getObjectList(int classID);78 static const ObjectListBase* const getObjectList(const std::string& className);79 static const ObjectListBase* const getObjectList(const ClassID& classID);74 static const ClassID& retrieveIdentity(int id); 75 static const ClassID& retrieveIdentity(const std::string& name); 76 77 static const ObjectListBase* const getObjectList(int classID); 78 static const ObjectListBase* const getObjectList(const std::string& className); 79 static const ObjectListBase* const getObjectList(const ClassID& classID); 80 80 81 81 static BaseObject* getBaseObject(int classID, const std::string& objectName); … … 115 115 116 116 private: 117 int _id; 117 int _id; //!< The Unique ID of the Class. 118 118 const std::string _name; //!< The Name of the Class. 119 ClassID _identity; //!< The Identity of the Class. (equal to _id and _name)119 ClassID _identity; //!< The Identity of the Class. (equal to _id and _name) 120 120 121 121 private: … … 169 169 { 170 170 public: 171 typedef std::list<T*> list; 172 typedef typename list::iterator iterator; 173 typedef typename list::const_iterator const_iterator; 174 175 171 typedef std::list<T*> list; //!< The list of Type T* (used for Objects in this ObjectList) 172 typedef typename list::iterator iterator; //!< The iterator for the List of type T (use with ObjectList<Type>::iterator) 173 typedef typename list::const_iterator const_iterator; //!< A constant iterator for the List of type T (use with ObjectList<Type>::const_iterator) 174 175 176 //! An iterator to store Objects in the BaseObject, and remove Objects fast. 176 177 class Iterator : public ObjectListBase::IteratorBase 177 178 { 178 179 public: 179 Iterator(iterator it) { _it = it; } 180 /** @brief creates an Iterator fast. @param it the Iterator. */ 181 inline Iterator(iterator it) { _it = it; } 182 /** @returns the Iterator */ 180 183 inline iterator& it() { return _it; } 181 typename ObjectList::iterator _it; 184 private: 185 typename ObjectList::iterator _it; //!< Stored Iterator 182 186 }; 183 187 … … 210 214 211 215 212 ObjectListBase::IteratorBase* registerObject(T* object);216 ObjectListBase::IteratorBase* registerObject(T* object); 213 217 virtual void unregisterObject(IteratorBase* iterator); 214 218 … … 288 292 */ 289 293 template <class T> 290 294 bool ObjectList<T>::exists(const T* const object) const 291 295 { 292 296 return (std::find(_objects.begin(), _objects.end(), object) != _objects.end());
Note: See TracChangeset
for help on using the changeset viewer.