Changeset 9691 in orxonox.OLD for branches/new_class_id/src/lib/lang
- Timestamp:
- Aug 22, 2006, 11:45:21 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/lang
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/lang/base_object.cc
r9686 r9691 21 21 #include "util/loading/load_param.h" 22 22 23 NewObjectListDefinition(BaseObject); 24 23 25 /** 24 26 * @brief sets the name from a LoadXML-Element … … 26 28 */ 27 29 BaseObject::BaseObject(const std::string& objectName) 30 : _leafClassID(&BaseObject::classID()) 28 31 { 29 32 this->className = "BaseObject"; -
branches/new_class_id/src/lib/lang/base_object.h
r9686 r9691 26 26 class BaseObject : public sigslot::has_slots<> 27 27 { 28 28 NewObjectListDeclaration(BaseObject); 29 29 public: 30 30 BaseObject (const std::string& objectName = ""); … … 49 49 50 50 /** @returns the ID of the Topmost object of the ClassStack */ 51 inline int getLeafClassID() const { return _classes.front()._objectList->id(); }51 inline const int& getLeafClassID() const { return _leafClassID->id(); } 52 52 53 53 bool isA(const NewObjectListBase& objectList) const; … … 88 88 std::string className; //!< the name of the class 89 89 ClassList _classes; //!< All Classes this object is part of. 90 90 const NewClassID* _leafClassID; //!< Topmost ClassID. 91 91 }; 92 92 … … 104 104 inline void BaseObject::registerObject(T* object, NewObjectList<T>& objectList) 105 105 { 106 this->_leafClassID = &objectList.identity(); 106 107 this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object))); 107 108 } -
branches/new_class_id/src/lib/lang/new_class_id.h
r9685 r9691 17 17 NewClassID(int id, const std::string& name) : _id(id), _name(name) { }; 18 18 // the copy constructor is also defined. 19 intid() const { return _id; };19 const int& id() const { return _id; }; 20 20 const std::string& name() const { return _name; }; 21 21 … … 23 23 bool operator==(int id) const { return _id == id; }; 24 24 bool operator==(const std::string& name) const { return _name == name; }; 25 bool operator!=(NewClassID id) const { return _id != id._id && _name != id._name; }; 26 bool operator!=(int id) const { return _id != id; }; 27 bool operator!=(const std::string& name) const { return _name != name; }; 25 28 26 29 private: -
branches/new_class_id/src/lib/lang/new_object_list.h
r9686 r9691 25 25 public: \ 26 26 static inline const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \ 27 static inline const NewClassID classID() { return ClassName::_objectList.identity(); }; \27 static inline const NewClassID& classID() { return ClassName::_objectList.identity(); }; \ 28 28 private: \ 29 29 static NewObjectList<ClassName> _objectList
Note: See TracChangeset
for help on using the changeset viewer.