Changeset 9686 in orxonox.OLD for branches/new_class_id/src/lib/lang
- Timestamp:
- Aug 22, 2006, 2:36: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
r9684 r9686 95 95 } 96 96 97 98 /** 99 * @brief Seeks in the Inheritance if it matches objectList. 100 * @param objectList The ObjectList this should be a member of (by Pointer-comparison). 101 * @return True if found, false if not. 102 */ 103 bool BaseObject::isA(const NewClassID& classID) const 104 { 105 ClassList::const_iterator it; 106 for (it = this->_classes.begin(); it != this->_classes.end(); ++it) 107 if (*(*it)._objectList == classID) 108 return true; 109 return false; 110 } 111 97 112 /** 98 113 * @brief Seeks in the Inheritance if it matches objectList. -
branches/new_class_id/src/lib/lang/base_object.h
r9684 r9686 52 52 53 53 bool isA(const NewObjectListBase& objectList) const; 54 bool isA(const NewClassID& classID) const; 54 55 bool isA(int classID) const; 55 56 bool isA(const std::string& className) const; -
branches/new_class_id/src/lib/lang/new_object_list.h
r9685 r9686 15 15 16 16 17 18 /** 19 * @brief Use this macro to easily declare a Class to store its own ObjectListDeclaration 20 * @param ClassName the Name of the Class. 21 * @note: Using this inside of a Class means, that you loose the member: _objectList, while defining 22 * two new functions objectList() and classID(). 23 */ 17 24 #define NewObjectListDeclaration(ClassName) \ 18 25 public: \ 19 static const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \ 26 static inline const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \ 27 static inline const NewClassID classID() { return ClassName::_objectList.identity(); }; \ 20 28 private: \ 21 29 static NewObjectList<ClassName> _objectList … … 40 48 41 49 public: 50 inline const NewClassID& identity() const { return _identity; }; 42 51 inline int id() const { return _identity.id(); }; 43 52 inline const std::string& name() const { return _identity.name(); }; 44 53 bool operator==(int id) const { return _identity == id; }; 54 bool operator==(const NewClassID& id) const { return _identity == id; }; 45 55 bool operator==(const std::string& name) const { return _identity == name; }; 46 56
Note: See TracChangeset
for help on using the changeset viewer.