Changeset 9735 in orxonox.OLD for branches/new_class_id/src/lib
- Timestamp:
- Sep 15, 2006, 4:16:06 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util/executor
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/executor/executor.h
r9734 r9735 39 39 * Functions with many types (@see functor_list.h) 40 40 */ 41 template <typename CallType > class Executor41 template <typename CallType, class BaseClass = BaseObject> class Executor 42 42 { 43 43 public: 44 44 //! an enumerator for the definition of the Type. 45 45 typedef enum { 46 FunctionDefault, 47 FunctionStatic, 48 FunctionConst, 46 FunctionDefault, //!< The function is neither Static nor Constant 47 FunctionStatic, //!< The Function is Static and pointing to either a Static Member or a C-style function. 48 FunctionConst, //!< The Function is Constant and pointing to a Member that does not change the Object. 49 49 } FunctionType; 50 50 … … 67 67 68 68 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 69 virtual void operator()(Base Object* object, CallType& values) const = 0;69 virtual void operator()(BaseClass* object, CallType& values) const = 0; 70 70 71 71 /** … … 103 103 } 104 104 105 /** @returns the Clone as a new Copy of the Executor. */ 105 106 virtual Executor<CallType>* clone () const = 0; 106 107 … … 193 194 protected: 194 195 const bool bRetVal; //!< True if the Executor has a return Value. 195 unsigned intparamCount; //!< the count of parameters.196 const unsigned int paramCount; //!< the count of parameters. 196 197 MultiType defaultValue[7]; //!< Default Values. 197 198 -
branches/new_class_id/src/lib/util/executor/executor_functional.h
r9734 r9735 61 61 { 62 62 public: 63 /** @brief Executes the Evaluator 64 * @param CallValue the Value that should be converted 65 * @param defaults the default Values. 66 */ 63 67 ToType operator()(FromType& CallValue, const MultiType* const defaults) 64 68 { … … 79 83 //! The Function-Pointer, and how to save it internally. 80 84 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER T::*functionPointer 85 #define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE Executor<CallType, BaseClass>::FunctionDefault 81 86 82 87 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST //! USING CONST FUNCTIONALS … … 88 93 #undef __EXECUTOR_FUNCTIONAL_CONST 89 94 #define __EXECUTOR_FUNCTIONAL_CONST const 95 #undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE 96 #define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE Executor<CallType, BaseClass>::FunctionConst 90 97 #undef __EXECUTOR_FUNCTIONAL_NAME 91 98 #define __EXECUTOR_FUNCTIONAL_NAME(ParamCount) Executor##ParamCount##Params_const … … 109 116 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER 110 117 #define __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER *functionPointer 118 #undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE 119 #define __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE Executor<CallType, BaseClass>::FunctionStatic 111 120 112 121 //#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */ … … 121 130 #ifndef __EXECUTOR_FUNCTIONAL_NOT_INCLUDE_THIS 122 131 132 133 134 123 135 /////////// 124 136 //// 0 //// 125 137 /////////// 126 138 //! @brief ExecutorClass, that can execute Functions without any parameters. 127 template<class T, typename CallType, template<typename, typename, int> class Evaluater = ExecutorEvaluater >128 class __EXECUTOR_FUNCTIONAL_NAME(0) :public Executor<CallType >139 template<class T, typename CallType, template<typename, typename, int> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 140 class __EXECUTOR_FUNCTIONAL_NAME(0) :public Executor<CallType, BaseClass> 129 141 { 130 142 private: … … 138 150 */ 139 151 __EXECUTOR_FUNCTIONAL_NAME(0) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST ) 140 : Executor<CallType >(false)152 : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 141 153 { 142 154 this->functionPointer = functionPointer; … … 157 169 * @returns a new Executor that's a copy of this one. 158 170 */ 159 virtual Executor<CallType >* clone() const171 virtual Executor<CallType, BaseClass>* clone() const 160 172 { 161 173 return new __EXECUTOR_FUNCTIONAL_NAME(0)<T, CallType>(this->functionPointer); … … 165 177 166 178 179 180 167 181 /////////// 168 182 //// 1 //// 169 183 /////////// 170 184 //! @brief ExecutorClass, that can execute Functions with one parameter. 171 template<class T, typename CallType, typename type0, template<typename, typename, int> class Evaluater = ExecutorEvaluater >172 class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor<CallType >185 template<class T, typename CallType, typename type0, template<typename, typename, int> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 186 class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor<CallType, BaseClass> 173 187 { 174 188 private: … … 182 196 */ 183 197 __EXECUTOR_FUNCTIONAL_NAME(1) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) 184 : Executor<CallType >(false, ExecutorParamType<type0>())198 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 185 199 { 186 200 this->functionPointer = functionPointer; … … 202 216 * @returns a new Executor that's a copy of this one. 203 217 */ 204 virtual Executor<CallType >* clone() const218 virtual Executor<CallType, BaseClass>* clone() const 205 219 { 206 220 return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, CallType, type0>(this->functionPointer); … … 208 222 }; 209 223 224 225 226 227 210 228 /////////// 211 229 //// 2 //// 212 230 /////////// 213 231 //! @brief ExecutorClass, that can execute Functions with two parameters. 214 template<class T, typename CallType, typename type0, typename type1, template<typename, typename, int> class Evaluater = ExecutorEvaluater >215 class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor<CallType >232 template<class T, typename CallType, typename type0, typename type1, template<typename, typename, int> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 233 class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor<CallType, BaseClass> 216 234 { 217 235 private: … … 225 243 */ 226 244 __EXECUTOR_FUNCTIONAL_NAME(2) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) 227 : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>())245 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 228 246 { 229 247 this->functionPointer = functionPointer; … … 246 264 * @returns a new Executor that's a copy of this one. 247 265 */ 248 virtual Executor<CallType >* clone() const266 virtual Executor<CallType, BaseClass>* clone() const 249 267 { 250 268 return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, CallType, type0, type1>(this->functionPointer); … … 253 271 254 272 273 274 275 255 276 /////////// 256 277 //// 3 //// 257 278 /////////// 258 279 //! @brief ExecutorClass, that can execute Functions with three parameters. 259 template<class T, typename CallType, typename type0, typename type1, typename type2, template<typename, typename, int> class Evaluater = ExecutorEvaluater >260 class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor<CallType >280 template<class T, typename CallType, typename type0, typename type1, typename type2, template<typename, typename, int> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 281 class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor<CallType, BaseClass> 261 282 { 262 283 private: … … 270 291 */ 271 292 __EXECUTOR_FUNCTIONAL_NAME(3) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) 272 : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())293 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 273 294 { 274 295 this->functionPointer = functionPointer; … … 292 313 * @returns a new Executor that's a copy of this one. 293 314 */ 294 virtual Executor<CallType >* clone() const315 virtual Executor<CallType, BaseClass>* clone() const 295 316 { 296 317 return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, CallType, type0, type1, type2>(this->functionPointer); … … 300 321 301 322 323 324 302 325 /////////// 303 326 //// 4 //// 304 327 /////////// 305 328 //! @brief ExecutorClass, that can execute Functions with four parameters. 306 template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, template<typename, typename, int> class Evaluater = ExecutorEvaluater >307 class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor<CallType >329 template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, template<typename, typename, int> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 330 class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor<CallType, BaseClass> 308 331 { 309 332 private: … … 317 340 */ 318 341 __EXECUTOR_FUNCTIONAL_NAME(4) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) 319 : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())342 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 320 343 { 321 344 this->functionPointer = functionPointer; … … 340 363 * @returns a new Executor that's a copy of this one. 341 364 */ 342 virtual Executor<CallType >* clone() const365 virtual Executor<CallType, BaseClass>* clone() const 343 366 { 344 367 return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, CallType, type0, type1, type2, type3>(this->functionPointer); … … 348 371 349 372 373 374 375 350 376 /////////// 351 377 //// 5 //// 352 378 /////////// 353 379 //! @brief ExecutorClass, that can execute Functions with five parameters. 354 template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, typename type4, template<typename, typename, int> class Evaluater = ExecutorEvaluater >355 class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor<CallType >380 template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, typename type4, template<typename, typename, int> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 381 class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor<CallType, BaseClass> 356 382 { 357 383 private: … … 365 391 */ 366 392 __EXECUTOR_FUNCTIONAL_NAME(5) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) 367 : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())393 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 368 394 { 369 395 this->functionPointer = functionPointer; … … 389 415 * @returns a new Executor that's a copy of this one. 390 416 */ 391 virtual Executor<CallType >* clone() const417 virtual Executor<CallType, BaseClass>* clone() const 392 418 { 393 419 return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, CallType, type0, type1, type2, type3, type4>(this->functionPointer); … … 489 515 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_EXEC 490 516 #undef __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER 517 #undef __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE 491 518 492 519 #ifdef EXECUTOR_FUNCTIONAL_USE_CONST -
branches/new_class_id/src/lib/util/executor/executor_xml.h
r9734 r9735 19 19 * What must be defined is a XML-root to search the ParameterName under an a Function to call. 20 20 */ 21 template<class T > class ExecutorXML : public Executor<const TiXmlElement*>21 template<class T, class BaseClass = BaseObject> class ExecutorXML : public Executor<const TiXmlElement*> 22 22 { 23 23 public:
Note: See TracChangeset
for help on using the changeset viewer.