Changeset 4748 in orxonox.OLD for orxonox/trunk/src/lib/lang/class_list.cc
- Timestamp:
- Jul 1, 2005, 4:37:15 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/lang/class_list.cc
r4747 r4748 21 21 #include "compiler.h" 22 22 #include "debug.h" 23 #include <string.h> 24 #include <math.h> 23 25 24 26 using namespace std; … … 26 28 27 29 /** 28 \brief standard constructor 29 \todo this constructor is not jet implemented - do it 30 \brief Creates a new ClassList 30 31 */ 31 32 ClassList::ClassList(const long& classID, const char* className) … … 35 36 this->className = className; 36 37 this->classID = classID; 38 39 ++ClassList::classCount; 37 40 } 38 41 … … 44 47 ClassList::~ClassList () 45 48 { 46 // delete what has to be deleted here49 --ClassList::classCount; 47 50 } 48 51 52 //! the first class that is registered 49 53 ClassList* ClassList::first = NULL; 54 55 //! the Count of classes 50 56 unsigned int ClassList::classCount = 0; 51 57 52 53 58 /** 59 * Adds a new Object to the ClassList (and if necessary a new Class) 60 * @param objectPointer Pointer to the Object at hand 61 * @param classID ID of the Given ObjectType \see ClassID 62 * @param className name of the Class to add 63 */ 54 64 void ClassList::addToClassList(BaseObject* objectPointer, const long& classID, const char* className) 55 65 { … … 78 88 } 79 89 90 /** 91 * removes an Object from a the ClassList 92 * @param objectPointer the Object to delete from the List 93 */ 80 94 void ClassList::removeFromClassList(BaseObject* objectPointer) 81 95 { … … 92 106 } 93 107 94 108 /** 109 * Print out some very nice debug information 110 */ 95 111 void ClassList::debug() 96 112 { … … 98 114 PRINT(0)("= CLASS_LIST =\n"); 99 115 PRINT(0)("=================\n"); 116 PRINT(0)("has %d Elements\n\n", ClassList::classCount); 100 117 ClassList* tmp = ClassList::first; 118 char niceString[100]; 119 unsigned int lenCount = 0; 120 101 121 while (likely(tmp != NULL)) 102 122 { 103 PRINT(0)("CLASS %s has %d instances\n", tmp->className, tmp->objectCount); 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'; 129 130 PRINT(0)("CLASS %s:%s %d instances\n", tmp->className, niceString, tmp->objectCount); 104 131 105 132 tmp = tmp->next; 106 133 } 107 134 PRINT(0)("==============CL=\n"); 108 109 135 }
Note: See TracChangeset
for help on using the changeset viewer.