Changeset 4748 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 1, 2005, 4:37:15 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 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 } -
orxonox/trunk/src/lib/lang/class_list.h
r4747 r4748 36 36 struct ObjectList 37 37 { 38 BaseObject* pointerToObject; 39 ObjectList* next; 38 BaseObject* pointerToObject; //! Pointer to the Object 39 ObjectList* next; //!< pointer to the next Object in the List 40 40 }; 41 41 42 long classID; 43 const char* className; 42 long classID; //!< ClassID stored in this ClassList \see ClassID 43 const char* className; //!< Name of the Class Stored here 44 44 45 ClassList* next; 45 ClassList* next; //!< Pointer to the next class in the List 46 46 47 unsigned int objectCount; 47 unsigned int objectCount; //!< how many Objects of this particular Object have been loaded?? 48 48 49 49 50 static ClassList* first; 51 static unsigned int classCount; 50 static ClassList* first; //!< The first Class in the List (should be BaseObject) 51 static unsigned int classCount; //!< The Count of classes that have been registered (should match the lower description) 52 52 53 53 }; -
orxonox/trunk/src/orxonox.cc
r4746 r4748 43 43 #include "cd_engine.h" 44 44 45 #include "class_list.h" 46 45 47 #include <string.h> 46 48 … … 81 83 delete TextEngine::getInstance(); 82 84 delete EventHandler::getInstance(); 85 86 ClassList::debug(); 83 87 } 84 88
Note: See TracChangeset
for help on using the changeset viewer.