Changeset 5653 in orxonox.OLD for trunk/src/util/loading
- Timestamp:
- Nov 20, 2005, 6:43:58 PM (19 years ago)
- Location:
- trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/loading/load_param.cc
r5652 r5653 107 107 } 108 108 109 /** 110 * Constructs a new LoadParameter 111 * @param root the XML-element to load this Parameter from 112 * @param paramName the Parameter to load 113 * @param object the BaseObject, to load this parameter on to (will be cast to executor's Parameter) 114 * @param executor the Executor, that executes the loading procedure. 115 */ 109 116 LoadParamBase::LoadParamBase(const TiXmlElement* root, const char* paramName, BaseObject* object, const Executor& executor) 110 117 { … … 123 130 } 124 131 125 132 /** 133 * This is a VERY SPECIAL deconsrtuctor. 134 * It is made, so that it loads the Parameters on destruction. 135 * meaning, if an Executor a valid Object exist, and all 136 * Execution-Conditions are met, they are executed here. 137 */ 126 138 LoadParamBase::~LoadParamBase() 127 139 { 128 140 if (likely(this->executor != NULL)) 129 141 { 130 printf("%s: %s", this->paramName, this->loadString);131 142 if (likely(this->object != NULL && this->executor != NULL) && 132 143 ( this->loadString != NULL || 133 144 ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString))) 134 145 { 135 printf(" - exec");146 PRINTF(4)("Loading '%s' with Parameters '%s' onto: '%s'(%s)\n", this->paramName, this->loadString, this->object->getName(), this->object->getClassName()); 136 147 this->executor->execute(this->object, this->loadString); 137 148 } 138 printf ("\n");139 149 delete this->executor; 140 150 } … … 142 152 } 143 153 144 154 /** 155 * set the default values of the executor 156 * @param count how many default values to set. 157 * @param ... the default values !! must be at least count parameters!! 158 */ 145 159 LoadParamBase* LoadParamBase::defaultValues(unsigned int count, ...) 146 160 { -
trunk/src/util/loading/load_param.h
r5652 r5653 284 284 #include "functor_list.h" 285 285 #undef FUNCTOR_LIST 286 287 //! makes functions with one Vector loadable288 //LoadParam1(l_VECTOR);289 290 // loads a Ti-XML-element291 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const TiXmlElement*), bool multi = false)292 : LoadParamBase(root, pt2Object, paramName, 1, multi, NULL, "XML")293 {294 if (root != NULL)295 {296 const TiXmlElement* elem = root->FirstChildElement(paramName);297 if (elem != NULL)298 (*pt2Object.*function)(elem);299 else300 PRINTF(4)("%s of %s is empty\n", paramName, pt2Object->getClassName());301 }302 else303 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());304 }305 306 //LoadParamPT(l_XML_ELEM);307 286 }; 308 287
Note: See TracChangeset
for help on using the changeset viewer.