Changeset 7130 in orxonox.OLD for trunk/src/util/loading
- Timestamp:
- Feb 13, 2006, 2:59:17 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/load_param.cc
r6613 r7130 18 18 #include "load_param.h" 19 19 #include "load_param_description.h" 20 21 #include "list.h"22 20 23 21 #include <stdarg.h> -
trunk/src/util/loading/load_param.h
r6981 r7130 30 30 31 31 // Forward Declaration // 32 template<class T> class tList;33 32 class LoadClassDescription; 34 33 class LoadParamDescription; -
trunk/src/util/loading/load_param_description.cc
r5691 r7130 17 17 18 18 #include "multi_type.h" 19 #include "list.h"20 19 #include <stdarg.h> 21 20 #include "stdlibincl.h" … … 130 129 * A list, that holds all the classes that are loadable (classes not objects!!) 131 130 */ 132 tList<LoadClassDescription>* LoadClassDescription::classList = NULL;131 std::list<LoadClassDescription*>* LoadClassDescription::classList = NULL; 133 132 134 133 /** … … 146 145 147 146 if (LoadClassDescription::classList == NULL) 148 LoadClassDescription::classList = new tList<LoadClassDescription>; 149 150 LoadClassDescription::classList->add(this); 151 152 this->paramList = new tList<LoadParamDescription>; 147 LoadClassDescription::classList = new std::list<LoadClassDescription*>; 148 149 LoadClassDescription::classList->push_back(this); 153 150 } 154 151 … … 158 155 LoadClassDescription::~LoadClassDescription() 159 156 { 160 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 161 LoadParamDescription* enumParamDesc = iterator->firstElement(); 162 while (enumParamDesc) 163 { 164 delete enumParamDesc; 165 enumParamDesc = iterator->nextElement(); 166 } 167 delete iterator; 168 delete this->paramList; 157 std::list<LoadParamDescription*>::iterator it = this->paramList.begin(); 158 while (!this->paramList.empty()) 159 { 160 delete this->paramList.front(); 161 this->paramList.pop_front(); 162 } 169 163 170 164 delete[] this->className; … … 175 169 if (LoadClassDescription::classList != NULL) 176 170 { 177 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 178 LoadClassDescription* delElem = iterator->firstElement(); 179 while (delElem != NULL) 180 { 181 delete delElem; 182 delElem = iterator->nextElement(); 183 } 184 delete iterator; 171 while (!LoadClassDescription::classList->empty()) 172 { 173 delete LoadClassDescription::classList->front(); 174 LoadClassDescription::classList->pop_front(); 175 } 185 176 delete LoadClassDescription::classList; 186 177 } … … 200 191 if (LoadClassDescription::classList != NULL) 201 192 { 202 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); 203 LoadClassDescription* enumClassDesc = iterator->firstElement(); 204 while (enumClassDesc) 205 { 206 if (!strcmp(enumClassDesc->className, className)) 193 std::list<LoadClassDescription*>::iterator it = LoadClassDescription::classList->begin(); 194 while (it != LoadClassDescription::classList->end()) 195 { 196 if (!strcmp((*it)->className, className)) 207 197 { 208 delete iterator; 209 return enumClassDesc; 210 } 211 enumClassDesc = iterator->nextElement(); 212 } 213 delete iterator; 198 return (*it); 199 } 200 it++; 201 } 214 202 } 215 203 return new LoadClassDescription(className); … … 222 210 LoadParamDescription* LoadClassDescription::addParam(const char* paramName) 223 211 { 224 tIterator<LoadParamDescription>* iterator = this->paramList->getIterator(); 225 LoadParamDescription* enumParamDesc = iterator->firstElement(); 226 while (enumParamDesc) 227 { 228 if (!strcmp(enumParamDesc->paramName, paramName)) 229 { 230 delete iterator; 231 //return enumParamDesc; 212 std::list<LoadParamDescription*>::iterator it = this->paramList.begin(); 213 while (it != this->paramList.end()) 214 { 215 if (!strcmp((*it)->paramName, paramName)) 216 { 232 217 return NULL; 233 218 } 234 enumParamDesc = iterator->nextElement(); 235 } 236 delete iterator; 219 it++; 220 } 237 221 238 222 LoadParamDescription* newParam = new LoadParamDescription(paramName); 239 223 240 this->paramList ->add(newParam);224 this->paramList.push_back(newParam); 241 225 return newParam; 242 226 } … … 253 237 if (LoadClassDescription::classList != NULL) 254 238 { 255 tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator(); 256 LoadClassDescription* enumClassDesc = classIT->firstElement(); 257 while (enumClassDesc) 258 { 259 PRINT(3)("<%s>\n", enumClassDesc->className); 260 tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator(); 261 LoadParamDescription* enumParamDesc = paramIT->firstElement(); 262 while (enumParamDesc) 239 std::list<LoadClassDescription*>::iterator classDesc = LoadClassDescription::classList->begin(); 240 while (classDesc != LoadClassDescription::classList->end()) 241 { 242 PRINT(3)("<%s>\n", (*classDesc)->className); 243 std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin(); 244 while (param != (*classDesc)->paramList.end()) 263 245 { 264 enumParamDesc->print(); 265 enumParamDesc = paramIT->nextElement(); 266 } 267 delete paramIT; 268 269 PRINT(3)("</%s>\n\n", enumClassDesc->className); 270 enumClassDesc = classIT->nextElement(); 271 } 272 delete classIT; 246 (*param)->print(); 247 param++; 248 } 249 PRINT(3)("</%s>\n\n", (*classDesc)->className); 250 classDesc++; 251 } 273 252 } 274 253 else … … 283 262 * !! The strings MUST NOT be deleted !! 284 263 */ 285 tList<const char>* LoadClassDescription::searchClassWithShort(const char* classNameBegin) 286 { 287 unsigned int searchLength = strlen(classNameBegin); 288 tList<const char>* retVal = new tList<const char>; 264 std::list<const char*> LoadClassDescription::searchClassWithShort(const char* classNameBegin) 265 { 266 /// FIXME 267 // NOT USED 268 /* unsigned int searchLength = strlen(classNameBegin); 269 std::list<const char*> retVal; 289 270 290 271 tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator(); … … 301 282 delete iterator; 302 283 303 return retVal; 304 } 284 return retVal;*/ 285 } -
trunk/src/util/loading/load_param_description.h
r5708 r7130 23 23 24 24 #include "base_object.h" 25 #include <list> 25 26 26 27 // Forward Declaration // 27 template<class T> class tList;28 28 class MultiType; 29 29 … … 68 68 69 69 static void printAll(const char* fileName = NULL); 70 static tList<const char>*searchClassWithShort(const char* classNameBegin);70 static std::list<const char*> searchClassWithShort(const char* classNameBegin); 71 71 // static const LoadParamDescription* getClass(const char* className); 72 72 73 73 private: 74 static bool parametersDescription; //!< if parameter-description should be enabled.75 static tList<LoadClassDescription>*classList; //!< a list, that stores all the loadable classes. (after one instance has been loaded)76 char* className; //!< name of the class74 static bool parametersDescription; //!< if parameter-description should be enabled. 75 static std::list<LoadClassDescription*>* classList; //!< a list, that stores all the loadable classes. (after one instance has been loaded) 76 char* className; //!< name of the class 77 77 78 tList<LoadParamDescription>*paramList; //!< List of parameters this class knows.78 std::list<LoadParamDescription*> paramList; //!< List of parameters this class knows. 79 79 }; 80 80
Note: See TracChangeset
for help on using the changeset viewer.