Changeset 4752 in orxonox.OLD for orxonox/trunk/src/lib/lang/class_list.cc
- Timestamp:
- Jul 1, 2005, 7:07:43 PM (19 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.