Changeset 4752 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jul 1, 2005, 7:07:43 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/lang
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/lang/class_list.cc
r4750 r4752 19 19 #include "base_object.h" 20 20 21 #include "list.h" 21 22 #include "compiler.h" 22 23 #include "debug.h" … … 32 33 ClassList::ClassList(const long& classID, const char* className) 33 34 { 34 this->objectCount = 0;35 35 this->next = NULL; 36 36 this->className = className; 37 37 this->classID = classID; 38 this->objectList = new tList<BaseObject>; 38 39 39 40 ++ClassList::classCount; … … 85 86 } 86 87 87 ++regClass->objectCount;88 regClass->objectList->add(objectPointer); 88 89 } 89 90 … … 99 100 if (objectPointer->isA(tmp->classID)) 100 101 { 101 --tmp->objectCount;102 tmp->objectList->remove(objectPointer); 102 103 } 103 104 … … 109 110 * Print out some very nice debug information 110 111 */ 111 void ClassList::debug()112 void ClassList::debug(unsigned int debugLevel) 112 113 { 113 PRINT(0)("=================\n"); 114 PRINT(0)("= CLASS_LIST =\n"); 115 PRINT(0)("=================\n"); 114 if (debugLevel > 2) 115 debugLevel = 2; 116 PRINT(0)("==========================\n"); 117 PRINT(0)("= CLASS_LIST (level %d) =\n", debugLevel); 118 PRINT(0)("==========================\n"); 116 119 PRINT(0)("has %d Elements\n\n", ClassList::classCount); 117 120 ClassList* tmp = ClassList::first; … … 121 124 while (likely(tmp != NULL)) 122 125 { 123 lenCount = 1; 124 while (pow(10,lenCount) <= tmp->objectCount) 125 ++lenCount; 126 for (int i=0; i < 30-strlen(tmp->className) - lenCount; i++) 127 (niceString[i]) = ' '; 128 niceString[30-strlen(tmp->className) - lenCount] = '\0'; 126 if (debugLevel >= 1 || tmp->objectList->getSize() > 0) 127 { 128 lenCount = 1; 129 while (pow(10,lenCount) <= tmp->objectList->getSize()) 130 ++lenCount; 131 for (int i=0; i < 30-strlen(tmp->className) - lenCount; i++) 132 (niceString[i]) = ' '; 133 niceString[30-strlen(tmp->className) - lenCount] = '\0'; 129 134 130 PRINT(0)("CLASS %s:%s %d instances\n", tmp->className, niceString, tmp->objectCount);135 PRINT(0)(" CLASS %s:%s %d instances\n", tmp->className, niceString, tmp->objectList->getSize()); 131 136 137 if (debugLevel >=2 && tmp->objectList->getSize() > 0) 138 { 139 PRINT(0)(" Listing Instances:\n"); 140 tIterator<BaseObject>* iterator = tmp->objectList->getIterator(); 141 BaseObject* enumBO = iterator->nextElement(); 142 while (enumBO) 143 { 144 PRINT(0)(" (class %s): NAME(%s)->%p\n", enumBO->getClassName(), enumBO->getName(), enumBO); 145 enumBO = iterator->nextElement(); 146 } 147 delete iterator; 148 } 149 } 132 150 tmp = tmp->next; 133 151 } -
orxonox/trunk/src/lib/lang/class_list.h
r4748 r4752 30 30 static void removeFromClassList(BaseObject* objectPointer); 31 31 32 static void debug( );32 static void debug(unsigned int debugLevel = 0); 33 33 34 34 private: 35 //! a Struct for Lists of Objects 36 struct ObjectList 37 { 38 BaseObject* pointerToObject; //! Pointer to the Object 39 ObjectList* next; //!< pointer to the next Object in the List 40 }; 35 tList<BaseObject>* objectList; //!< A list of Objects belonging to this Class 41 36 42 37 long classID; //!< ClassID stored in this ClassList \see ClassID … … 45 40 ClassList* next; //!< Pointer to the next class in the List 46 41 47 unsigned int objectCount; //!< how many Objects of this particular Object have been loaded?? 48 49 42 // STATIC MEMBERS 50 43 static ClassList* first; //!< The first Class in the List (should be BaseObject) 51 44 static unsigned int classCount; //!< The Count of classes that have been registered (should match the lower description) 52 53 45 }; 54 46
Note: See TracChangeset
for help on using the changeset viewer.