Changeset 9765 in orxonox.OLD for branches/new_class_id/src/lib/util/loading/load_param.cc
- Timestamp:
- Sep 19, 2006, 5:49:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/loading/load_param.cc
r9763 r9765 17 17 18 18 #include "util/loading/load_param.h" 19 #include "load_param_ description.h"19 #include "load_param_class_description.h" 20 20 #include "compiler.h" 21 21 #include "debug.h" … … 46 46 void LoadParamBase::describe(const std::string& descriptionText) 47 47 { 48 if (LoadClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty()) 48 /// TODO REIMPLEMENT 49 /* if (LoadParamClassDescription::parametersDescription && this->paramDesc && this->paramDesc->getDescription().empty()) 49 50 { 50 51 this->paramDesc->setDescription(descriptionText); 51 } 52 }*/ 52 53 } 53 54 … … 115 116 116 117 117 // const LoadParamDescription* LoadParamDescription::getClass(const char* className)118 // {119 // tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();120 // LoadClassDescription* enumClassDesc = iterator->firstElement();121 // while (enumClassDesc)122 // {123 // if (!strcmp(enumClassDesc->className, classNameBegin, className))124 // {125 // delete iterator;126 // return enumClassDesc;127 // }128 // enumClassDesc = iterator->nextElement();129 // }130 // delete iterator;131 //132 // return NULL;133 // }134 135 136 137 138 /*139 * @param object The object this Parameter is loaded too.140 * @param root: the XML-element to load this option from.141 * @param paramName: The name of the parameter loaded.142 * @param paramCount: how many parameters this loading-function takes143 * @param multi: if false LoadParam assumes only one occurence of this parameter in root, if true it assumes multiple occurences.144 * @param ...: the parameter information (1. Parameter, 2. Default Value for the Parameter, ...)145 */146 /*LoadParam::LoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName,147 int paramCount, bool multi, const void* pointerToParam, ...)148 {149 this->setClassID(CL_LOAD_PARAM, "LoadParam");150 this->executor = NULL;151 152 this->loadString = NULL;153 this->pointerToParam = pointerToParam;154 155 if (paramCount == 0 || this->pointerToParam != NULL)156 this->loadString = "none";157 else158 {159 if (likely(!multi))160 this->loadString = grabParameter(root, paramName);161 else162 {163 if (!strcmp(root->Value(), paramName))164 {165 const TiXmlNode* val = root->FirstChild();166 if( val->ToText())167 this->loadString = val->Value();168 }169 }170 }171 172 this->paramDesc = NULL;173 if (LoadClassDescription::parametersDescription)174 {175 // locating the class176 this->classDesc = LoadClassDescription::addClass(object->getClassCName());177 178 if ((this->paramDesc = this->classDesc->addParam(paramName)) != NULL)179 {180 181 this->paramDesc->paramCount = paramCount;182 this->paramDesc->types = new int[paramCount];183 this->paramDesc->defaultValues = new char*[paramCount];184 185 va_list types;186 va_start (types, pointerToParam);187 char defaultVal[512];188 for(int i = 0; i < paramCount; i++)189 {190 defaultVal[0] = '\0';191 // parameters parsed192 int tmpType = va_arg (types, int);193 this->paramDesc->types[i] = tmpType;194 switch (tmpType)195 {196 case MT_INT:197 sprintf(defaultVal, "%d", va_arg(types, int));198 break;199 // case MT_LONG:200 // sprintf(defaultVal, "%0.3f", va_arg(types, l_LONG_TYPE));201 // break;202 case MT_FLOAT:203 sprintf(defaultVal, "%0.3f", va_arg(types, double));204 break;205 case MT_STRING:206 sprintf(defaultVal, "%s", va_arg(types, l_STRING_TYPE));207 break;208 case MT_EXT1:209 sprintf(defaultVal, "");210 break;211 }212 this->paramDesc->defaultValues[i] = new char[strlen(defaultVal)+1];213 strcpy(this->paramDesc->defaultValues[i], defaultVal);214 }215 va_end(types);216 217 int argCount = 0;218 }219 }220 }*/221 222 223 224 225 226 227 228 229 230 231 118 ////////////////////// 232 119 // HELPER FUNCTIONS //
Note: See TracChangeset
for help on using the changeset viewer.