Changeset 9724 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Sep 8, 2006, 12:20:55 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
r9718 r9724 25 25 /** 26 26 * @brief sets the name from a LoadXML-Element 27 * @param root the element to load from27 * @param objectName: The name of the Object. 28 28 */ 29 29 BaseObject::BaseObject(const std::string& objectName) … … 100 100 /** 101 101 * @brief Seeks in the Inheritance if it matches objectList. 102 * @param objectList The ObjectListthis should be a member of (by Pointer-comparison).102 * @param classID The ClassID this should be a member of (by Pointer-comparison). 103 103 * @return True if found, false if not. 104 104 */ … … 141 141 142 142 143 /** 144 * @brief This is for debug purposes, to see the Inheritances of this Object and its classes. 145 * 146 * The Inheritance will be listed in a Linear fashion, diamand structures are resolved in a linear dependency. 147 */ 143 148 void BaseObject::listInheritance() const 144 149 { -
branches/new_class_id/src/lib/lang/base_object.h
r9718 r9724 26 26 class BaseObject : public sigslot::has_slots<> 27 27 { 28 //! Declare an ObjectList for this Class. 28 29 ObjectListDeclaration(BaseObject); 29 30 public: … … 48 49 inline const std::string& getClassName() const { return _classes.front()._objectList->name(); }; 49 50 51 /** @returns the ClassID of this Object */ 50 52 inline const ClassID& getClassID() const { return _classes.front()._objectList->identity(); } 51 53 /** @returns the ID of the Topmost object of the ClassStack */ -
branches/new_class_id/src/lib/lang/object_list.cc
r9716 r9724 98 98 /** 99 99 * @brief Checks if a Class with name already exists. 100 * @param name The Nameof the Class to check.100 * @param id The id of the Class to check. 101 101 * @return true if such a class already exists. 102 102 */ … … 233 233 } 234 234 235 236 /** 237 * @returns An alphabetically sorted List of all stored ClassNames. 238 */ 239 const std::list<std::string>& ObjectListBase::getClassNames() 240 { 241 if (ObjectListBase::classCount() != ObjectListBase::_classNames.size()) 242 { 243 ObjectListBase::_classNames.clear(); 244 245 for (classNameMap::const_iterator it = ObjectListBase::_classesByName->begin(); 246 it != ObjectListBase::_classesByName->end(); 247 ++it) 248 { 249 ObjectListBase::_classNames.push_back((*it).second->name()); 250 } 251 } 252 return ObjectListBase::_classNames; 253 } 254 255 235 256 #include "base_object.h" 236 257 237 258 /** 238 259 * @brief Prints out some debugging information about a given List. 260 * @param level: 261 * 1: List ObjectListsand how many object. 262 * 2: 1+List ObjectLists entries, and information about Objects. 239 263 */ 240 264 void ObjectListBase::debug(unsigned int level) const … … 259 283 260 284 285 /** 286 * @brief prints out debug output about all Lists 287 * @param level: 288 * 0: list number of ClassList and general info. 289 * 1: 0+List ObjectLists and how many object. 290 * 2: 1+List ObjectLists entries, and information about Objects. 291 */ 261 292 void ObjectListBase::debugAll(unsigned int level) 262 293 { -
branches/new_class_id/src/lib/lang/object_list.h
r9718 r9724 28 28 static ObjectList<ClassName> _objectList 29 29 30 /** 31 * @brief Use this macro to easily define a Class to store its own ObjectListDefinition 32 * @param ClassName: the Name of the Class. 33 * @param ID: optional set a Fixed ID. 34 */ 30 35 #define ObjectListDefinitionID(ClassName, ID) \ 31 36 ObjectList<ClassName> ClassName::_objectList(#ClassName, ID) 32 37 33 38 /** 39 * @brief Use this macro to easily define a Class to store its own ObjectListDefinition 40 * @param ClassName: the Name of the Class. 41 */ 34 42 #define ObjectListDefinition(ClassName) \ 35 43 ObjectListDefinitionID(ClassName, -1) … … 43 51 { 44 52 public: 45 //! A fast iterator Base-Class, for iterator-casting and storing.46 /**47 * @note This Iterator is explicitely used only for storage purposes in the BaseObject48 */49 class IteratorBase { };50 51 53 /** @brief A Typedefinition for the Base-List that can be retrieved with getBaseObjectList(base_list*) */ 52 54 typedef std::list<BaseObject*> base_list; 53 55 /** @brief An iterator for the base_list */ 54 56 typedef base_list::iterator base_iterator; 57 //! A fast iterator Base-Class, for iterator-casting and storing. 58 /** @note This Iterator is explicitely used only for storage purposes in the BaseObject */ 59 class IteratorBase { }; 55 60 56 61 public: 57 62 /** @returns The Identity of the Class stored within. */ 58 inline const ClassID& identity() const { return _identity; }63 inline const ClassID& identity() const { return _identity; } 59 64 /** @returns the ID of the Identity of the ObjectList */ 60 65 inline int id() const { return _id; }; … … 67 72 /** @param name The name to compare @returns true on match, false otherwise */ 68 73 inline bool operator==(const std::string& name) const { return _name == name; }; 69 /** @param id The id to check @returns true on match, false otherwise*/74 /** @param id The id to acquire @param name the Name to acquire @brief stores a Name and an ID in a pointer. */ 70 75 inline void acquireID(const int*& id, const std::string*& name) const { id = &_id; name = &_name; }; 71 76 /** @brief fills a list of Objects into a BaseObject*-List. @param list the list to fill */ … … 104 109 105 110 private: 106 ObjectListBase(const ObjectListBase&); 111 /** @brief hidden copy constructor. */ 112 ObjectListBase(const ObjectListBase&) {}; 107 113 108 114 static bool classIDExists(int id); … … 153 159 * and not loaded before the ObjectList. 154 160 * 155 * @exampleIterating: Iteration is made easy, and fast as follows:161 * example: Iterating: Iteration is made easy, and fast as follows: 156 162 * for (ObjectList<PlayerStats>::const_iterator it = PlayerStats::objectList().begin(); 157 163 * it != PlayerStats::objectList().end(); … … 161 167 * } 162 168 * 163 * @exampleFind an Object:169 * example: Find an Object: 164 170 * Playable* playable = Playable::objectList("orxonox-super-rocket-fighter"); // searches an Object By its name. 165 171 * … … 192 198 virtual BaseObject* getBaseObject(const std::string& name) const; 193 199 T* getObject(const std::string& name) const; 200 /** @returns A constant list of Objects of this Class. */ 194 201 inline const list& objects() const { return _objects; }; 195 202 bool exists(const T* const object) const; … … 314 321 /** 315 322 * @brief registers an Object to the ObjectList. 316 * @param T object the Object to register.323 * @param object The Object to register. 317 324 * @returns a pointer to the iterator inside of the list. 318 325 */
Note: See TracChangeset
for help on using the changeset viewer.