Changeset 9771 in orxonox.OLD for branches/new_class_id/src/lib/util/loading/load_param_class_description.cc
- Timestamp:
- Sep 19, 2006, 11:33:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/load_param_class_description.cc
r9768 r9771 22 22 * A list, that holds all the classes that are loadable (classes not objects!!) 23 23 */ 24 LoadParamClassDescription::ClassDescription SetLoadParamClassDescription::_classList;24 LoadParamClassDescription::ClassDescriptionMap LoadParamClassDescription::_classList; 25 25 26 26 /** … … 48 48 49 49 50 51 void LoadParamClassDescription::describeClass(const ClassID& classID, 52 const std::string& paramName, 53 const std::string& descriptionText) 54 { 55 ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName); 56 57 } 58 59 60 void LoadParamClassDescription::setValuesOf(const ClassID& classID, 61 const std::string& paramName, 62 unsigned int paramCount, 63 const MultiType* const defaultValues, 64 bool retVal) 65 { 66 ParamDescriptionMap::iterator it = LoadParamClassDescription::getParamDescription(classID, paramName); 67 68 } 69 70 50 71 /** 51 * prints out all loadable Classes, and their parameters 72 * @brief finds the Iterator to the ParameterDescription paramName matching classID 73 * @param classID the ClassID to match. 74 * @param paramName the name of the parameter in the Class. 75 * @returns the iterator on match. 76 * 77 * @note this function creates the Element classID.name()::paramName on the go if it does not exist. 78 */ 79 LoadParamClassDescription::ParamDescriptionMap::iterator 80 LoadParamClassDescription::getParamDescription(const ClassID& classID, const std::string& paramName) 81 { 82 /// Locate the ClassDescription first 83 ClassDescriptionMap::iterator classIt = LoadParamClassDescription::_classList.find(classID); 84 if (classIt == LoadParamClassDescription::_classList.end()) 85 { 86 LoadParamClassDescription::_classList[classID] = LoadParamClassDescription(classID.name()); 87 classIt = LoadParamClassDescription::_classList.find(classID); 88 printf("Inserted %s\n", classID.name().c_str()); 89 printAll(""); 90 } 91 // At this position the class-iterator should point to a valid usefull position. 92 assert(classIt != LoadParamClassDescription::_classList.end()); 93 94 /// Now locate the description with paramName. 95 ParamDescriptionMap::iterator paramIt = (*classIt).second._parameters.find(paramName); 96 if (paramIt == (*classIt).second._parameters.end()) 97 { 98 (*classIt).second._parameters[paramName] = LoadParamDescription(paramName); 99 paramIt = (*classIt).second._parameters.find(paramName); 100 } 101 // at this position the param-iterator should 102 assert (paramIt != (*classIt).second._parameters.end()); 103 104 return (paramIt); 105 } 106 107 108 109 110 /** 111 * @brief prints out all loadable Classes, and their parameters 52 112 * @param fileName prints the output to a File 53 113 * @todo implement it … … 55 115 void LoadParamClassDescription::printAll(const std::string& fileName) 56 116 { 57 PRINT( 3)("===============================================================\n");58 PRINT( 3)(" Listing all the Loadable Options (loaded since Game started).\n\n");59 for (ClassDescription Set::const_iterator classIt = LoadParamClassDescription::_classList.begin();60 classIt != LoadParamClassDescription::_classList. begin();117 PRINT(0)("===============================================================\n"); 118 PRINT(0)(" Listing all the Loadable Options (loaded since Game started).\n\n"); 119 for (ClassDescriptionMap::const_iterator classIt = LoadParamClassDescription::_classList.begin(); 120 classIt != LoadParamClassDescription::_classList.end(); 61 121 classIt ++) 62 122 { 63 PRINT( 3)("<%s>\n", (*classIt)._className.c_str());64 for (ParamDescription Set::const_iterator param = (*classIt)._parameters.begin();65 param != (*classIt). _parameters.end();123 PRINT(0)("<%s>\n", (*classIt).second._className.c_str()); 124 for (ParamDescriptionMap::const_iterator param = (*classIt).second._parameters.begin(); 125 param != (*classIt).second._parameters.end(); 66 126 ++param) 67 127 { 68 (*param).print();128 /// (*param).second.print(); 69 129 } 70 PRINT( 3)("</%s>\n\n", (*classIt)._className.c_str());130 PRINT(0)("</%s>\n\n", (*classIt).second._className.c_str()); 71 131 } 72 PRINT( 3)("===============================================================\n");132 PRINT(0)("===============================================================\n"); 73 133 }
Note: See TracChangeset
for help on using the changeset viewer.