Changeset 5103 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Aug 22, 2005, 6:08:15 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/lang/class_list.cc
r5102 r5103 48 48 { 49 49 delete this->objectList; 50 if(ClassList::classList != NULL) 51 { 52 delete ClassList::classList; 53 ClassList::classList = NULL; 54 } 50 55 --ClassList::classCount; 51 56 } … … 56 61 //! the Count of classes 57 62 unsigned int ClassList::classCount = 0; 63 64 //! a List of all strings of all classes, that have registered so far. 65 tList<const char>* ClassList::classList = NULL; 58 66 59 67 /** … … 107 115 tmp = tmp->next; 108 116 } 117 } 118 119 /** 120 * grabs the names of all Classes, and injects it into a List of const chars 121 * @return the generated List 122 * 123 * This function first looks, if the List has been changed (by the ListSize) 124 * befor it changes anything. 125 */ 126 const tList<const char>* ClassList::getClassList() 127 { 128 if (unlikely(ClassList::classList != NULL && ClassList::classList->getSize() != ClassList::classCount)) 129 { 130 delete ClassList::classList; 131 ClassList::classList = NULL; 132 } 133 if (unlikely(ClassList::classList == NULL)) 134 ClassList::classList = new tList<const char>; 135 136 if(likely(ClassList::first != NULL)) 137 { 138 ClassList* tmpCL = ClassList::first; 139 while (likely(tmpCL != NULL)) 140 { 141 ClassList::classList->add(tmpCL->className); 142 tmpCL = tmpCL->next; 143 } 144 } 145 return ClassList::classList; 109 146 } 110 147 -
trunk/src/lib/lang/class_list.h
r5102 r5103 35 35 36 36 // STATIC FUNCTIONS 37 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className);38 static void removeFromClassList(BaseObject* objectPointer);37 static void addToClassList(BaseObject* objectPointer, const long& classID, const char* className); 38 static void removeFromClassList(BaseObject* objectPointer); 39 39 40 static tList<BaseObject>* getList(long classID = CL_NULL); 41 static tList<BaseObject>* getList(const char* className); 42 static BaseObject* getObject(const char* name, long classID = CL_NULL); 43 static bool exists(const BaseObject* object, long classID = CL_NULL); 40 static tList<BaseObject>* getList(long classID = CL_NULL); 41 static tList<BaseObject>* getList(const char* className); 42 static const tList<const char>* getClassList(); 43 static BaseObject* getObject(const char* name, long classID = CL_NULL); 44 static bool exists(const BaseObject* object, long classID = CL_NULL); 44 45 45 static void whatIs(const BaseObject* object);46 static void debug(unsigned int debugLevel = 0, long classID = CL_NULL);46 static void whatIs(const BaseObject* object); 47 static void debug(unsigned int debugLevel = 0, long classID = CL_NULL); 47 48 48 49 private: 49 tList<BaseObject>* objectList; //!< A list of Objects belonging to this Class50 tList<BaseObject>* objectList; //!< A list of Objects belonging to this Class 50 51 51 long classID; //!< ClassID stored in this ClassList \see ClassID52 const char* className; //!< Name of the Class Stored here52 long classID; //!< ClassID stored in this ClassList \see ClassID 53 const char* className; //!< Name of the Class Stored here 53 54 54 ClassList* next; //!< Pointer to the next class in the List55 ClassList* next; //!< Pointer to the next class in the List 55 56 56 57 // STATIC MEMBERS 57 static ClassList* first; //!< The first Class in the List 58 static unsigned int classCount; //!< The Count of classes that have been registered (should match the lower description) 58 static ClassList* first; //!< The first Class in the List 59 static tList<const char>* classList; //!< a List of all Names of all classes, that have registered so far. 60 static unsigned int classCount; //!< The Count of classes that have been registered (should match the lower description) 59 61 }; 60 62 -
trunk/src/lib/util/list.h
r5076 r5103 135 135 void removeLast(); 136 136 void flush(); 137 T* firstElement() ;138 T* lastElement() ;139 bool isEmpty() ;140 unsigned int getSize() ;137 T* firstElement() const; 138 T* lastElement() const; 139 bool isEmpty() const; 140 unsigned int getSize() const; 141 141 bool inList(T* entity); 142 tIterator<T>* getIterator() ;142 tIterator<T>* getIterator() const; 143 143 T* nextElement(T* toEntity); 144 144 T* toArray(); … … 303 303 */ 304 304 template<class T> 305 inline T* tList<T>::firstElement() 305 inline T* tList<T>::firstElement() const 306 306 { 307 307 return this->first->curr; … … 314 314 */ 315 315 template<class T> 316 inline T* tList<T>::lastElement() 316 inline T* tList<T>::lastElement() const 317 317 { 318 318 return this->last->curr; … … 325 325 */ 326 326 template<class T> 327 inline bool tList<T>::isEmpty() 327 inline bool tList<T>::isEmpty() const 328 328 { 329 329 return (this->size==0)?true:false; … … 359 359 */ 360 360 template<class T> 361 inline unsigned int tList<T>::getSize() 361 inline unsigned int tList<T>::getSize() const 362 362 { 363 363 return this->size; … … 372 372 */ 373 373 template<class T> 374 inline tIterator<T>* tList<T>::getIterator() 374 inline tIterator<T>* tList<T>::getIterator() const 375 375 { 376 376 tIterator<T>* iterator = new tIterator<T>(this->first);
Note: See TracChangeset
for help on using the changeset viewer.