Changeset 4592 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jun 10, 2005, 7:17:22 PM (20 years ago)
- Location:
- orxonox/trunk/src/util
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/garbage_collector.cc
r4519 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 33 33 \brief standard constructor 34 34 */ 35 GarbageCollector::GarbageCollector () 35 GarbageCollector::GarbageCollector () 36 36 { 37 37 this->setClassID(CL_GARBAGE_COLLECTOR, "GarbageCollector"); … … 44 44 \brief standard deconstructor 45 45 */ 46 GarbageCollector::~GarbageCollector () 46 GarbageCollector::~GarbageCollector () 47 47 { 48 48 // delete what has to be deleted here … … 52 52 \brief this sets the collection delay 53 53 \param delay: the delay 54 54 55 55 after this delay, the garbage collector starts its work and begins to collect unused object 56 56 to delete them afterwards. only objects in the worldentity list from the world object are lookded 57 at. 57 at. 58 58 */ 59 59 void GarbageCollector::setCollectionDelay(float delay) … … 107 107 tIterator<WorldEntity>* iterator = list->getIterator(); 108 108 WorldEntity* entity = iterator->nextElement(); 109 while( entity != NULL) 110 { 109 while( entity != NULL) 110 { 111 111 if( entity->isFinalized()) 112 113 114 115 116 117 118 119 120 121 122 ObjectManager::getInstance()->addToDeadList(entity->getClassID(), entity);123 112 { 113 PRINTF(4)("= finalizing object\n"); 114 ++counter; 115 116 /* first remove out of entity list */ 117 list->remove(entity); 118 /* second remove out of pnode tree */ 119 entity->remove(); 120 /* then finaly delete reference */ 121 //delete entity; 122 ObjectManager::getInstance()->addToDeadList(entity->getClassID() & CL_MASK_LOWLEVEL_CLASS, entity); 123 } 124 124 entity = iterator->nextElement(); 125 125 } -
orxonox/trunk/src/util/loading/load_param.h
r4501 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 14 14 */ 15 15 16 /*! 16 /*! 17 17 \file load_param.h 18 18 \brief A Class and macro-functions, that makes our lives easy to load-in parameters … … 74 74 #define LoadParam1(type1) \ 75 75 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE), bool multi = false) \ 76 : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME) 77 { \ 78 if (loadString != NULL && root != NULL) \ 79 80 else \ 81 76 : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME) \ 77 { \ 78 if (loadString != NULL && root != NULL) \ 79 (*pt2Object.*function)(type1##_FUNC(loadString)); \ 80 else \ 81 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 82 82 } 83 83 … … 94 94 { \ 95 95 if (loadString != NULL && root != NULL) \ 96 97 98 99 100 101 102 103 104 else \ 105 96 { \ 97 SubString subLoads(loadString); \ 98 if (subLoads.getCount() == 2) \ 99 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1))); \ 100 else \ 101 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 102 paramName, pt2Object->getClassName(), 2, subLoads.getCount()); \ 103 } \ 104 else \ 105 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 106 106 } 107 107 … … 119 119 { \ 120 120 if (loadString != NULL && root != NULL) \ 121 122 123 124 125 126 127 128 129 else \ 130 121 { \ 122 SubString subLoads(loadString); \ 123 if (subLoads.getCount() == 3) \ 124 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2))); \ 125 else \ 126 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 127 paramName, pt2Object->getClassName(), 3, subLoads.getCount()); \ 128 } \ 129 else \ 130 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 131 131 } 132 132 … … 145 145 { \ 146 146 if (loadString != NULL && root != NULL) \ 147 148 149 150 151 152 153 154 155 else \ 156 147 { \ 148 SubString subLoads(loadString); \ 149 if (subLoads.getCount() == 4) \ 150 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3))); \ 151 else \ 152 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 153 paramName, pt2Object->getClassName(), 4, subLoads.getCount()); \ 154 } \ 155 else \ 156 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 157 157 } 158 158 … … 172 172 { \ 173 173 if (loadString != NULL && root != NULL) \ 174 175 176 177 178 179 180 181 182 else \ 183 174 { \ 175 SubString subLoads(loadString); \ 176 if (subLoads.getCount() == 5) \ 177 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3)), type5##_FUNC(subLoads.getString(4))); \ 178 else \ 179 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 180 paramName, pt2Object->getClassName(), 5, subLoads.getCount()); \ 181 } \ 182 else \ 183 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 184 184 } 185 185 … … 216 216 static LoadClassDescription* addClass(const char* className); 217 217 LoadParamDescription* addParam(const char* paramName); 218 218 219 219 220 220 static void printAll(const char* fileName = NULL); … … 249 249 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(), bool multi = false) 250 250 : BaseLoadParam(root, pt2Object, paramName, 0, multi, "") 251 { 251 { 252 252 if (loadString != NULL && root != NULL) 253 (*pt2Object.*function)(); 254 else 255 253 (*pt2Object.*function)(); 254 else 255 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 256 256 } 257 257 -
orxonox/trunk/src/util/object_manager.cc
r4519 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 26 26 \brief standard constructor 27 27 */ 28 ObjectManager::ObjectManager () 28 ObjectManager::ObjectManager () 29 29 { 30 30 this->setClassID(CL_OBJECT_MANAGER, "ObjectManager"); 31 31 32 32 this->managedObjectList = new tList<BaseObject>*[CL_NUMBER]; 33 33 for(int i = 0; i < CL_NUMBER; ++i) … … 48 48 \brief standard deconstructor 49 49 */ 50 ObjectManager::~ObjectManager () 50 ObjectManager::~ObjectManager () 51 51 { 52 52 ObjectManager::singletonRef = NULL; … … 80 80 this->managedObjectList[index]->remove(obj); 81 81 if( unlikely(obj == NULL)) 82 83 84 82 { 83 PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n"); 84 } 85 85 return obj; 86 86 } … … 96 96 { 97 97 PRINT(0)("\n==========================| ObjectManager::debug() |===\n"); 98 PRINT(0)("= Number of registerable classes: %i\n", CL_NUMBER ); 98 PRINT(0)("= Number of registerable classes: %i\n", CL_NUMBER ); 99 99 PRINT(0)("= Currently cached objects: \n"); 100 100 for(int i = 0; i < CL_NUMBER; ++i) 101 101 { 102 102 if( this->managedObjectList[i] != NULL) 103 103 PRINT(0)("= o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize()); 104 104 else 105 105 PRINT(0)("= o Class Nr. %i has cached 0 object(s)\n", i); 106 106 } 107 107 PRINT(0)("=======================================================\n");
Note: See TracChangeset
for help on using the changeset viewer.