[4838] | 1 | /*! |
---|
[9737] | 2 | * @file executor_generic.h |
---|
| 3 | * Definition of a Generic Executor |
---|
[5391] | 4 | */ |
---|
[1853] | 5 | |
---|
[7716] | 6 | /* |
---|
| 7 | orxonox - the future of 3D-vertical-scrollers |
---|
[1853] | 8 | |
---|
[7716] | 9 | Copyright (C) 2004 orx |
---|
[1853] | 10 | |
---|
[7716] | 11 | This program is free software; you can redistribute it and/or modify |
---|
| 12 | it under the terms of the GNU General Public License as published by |
---|
| 13 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 14 | any later version. |
---|
[5141] | 15 | |
---|
[7716] | 16 | ### File Specific: |
---|
| 17 | main-programmer: Benjamin Grauer |
---|
| 18 | co-programmer: ... |
---|
| 19 | */ |
---|
[5652] | 20 | |
---|
[5328] | 21 | |
---|
[9740] | 22 | |
---|
[9737] | 23 | #ifndef __EXECUTOR_GENERIC_H_ |
---|
| 24 | #define __EXECUTOR_GENERIC_H_ |
---|
[5641] | 25 | |
---|
[9740] | 26 | |
---|
[7721] | 27 | #include "executor.h" |
---|
[9730] | 28 | /** |
---|
[9736] | 29 | * @brief this is a Template Class used as an evaluater. |
---|
| 30 | * |
---|
| 31 | * Trait to determine a default Value for any Type, |
---|
| 32 | * and to define the Convertible, and how it is transformed into the |
---|
| 33 | * corresponding SubTypes over the operator(). |
---|
| 34 | * |
---|
| 35 | * This Class must be reimplemented for each Convertible and all of its |
---|
| 36 | * conversion-members. |
---|
| 37 | * |
---|
| 38 | * e.g: Convertible SubSting, that splits up into many Stings |
---|
| 39 | * conversion-members: (int) can be transformed from a String. |
---|
| 40 | */ |
---|
| 41 | template<typename FromType> class ExecutorEvaluater |
---|
| 42 | { |
---|
| 43 | public: |
---|
| 44 | /** @brief Executes the Evaluater |
---|
| 45 | * @param CallValue the Value that should be converted |
---|
| 46 | * @param defaults the default Values. |
---|
| 47 | */ |
---|
| 48 | template <typename ToType, int index> |
---|
[9747] | 49 | static ToType getValue(FromType& CallValue, const MultiType* const defaults) |
---|
[9736] | 50 | { |
---|
[9748] | 51 | assert(0 && "Might want to extend the ExecutorEvaluater::getValue function in an 'Explicit Specialized Template Class'"); |
---|
[9742] | 52 | return defaultValue; |
---|
[9736] | 53 | } |
---|
[9748] | 54 | /** @param @storeTo Stores the returned value here. @param value The Value to Store. @note invers of getValue */ |
---|
| 55 | static void storeRet(FromType& storeTo, FromType value) |
---|
| 56 | { |
---|
| 57 | assert (0 && "Might want to extend the ExecutorEvaluater::storeRet function in an 'Explicit Specialized Template Class'"); |
---|
| 58 | } |
---|
| 59 | /** @returns the Default Value of ToType */ |
---|
[9742] | 60 | static FromType& defaultValue() { static FromType defaultValue; return defaultValue; }; |
---|
[9736] | 61 | }; |
---|
[9740] | 62 | #endif /* __EXECUTOR_GENERIC_H_ */ |
---|
[9736] | 63 | |
---|
[9743] | 64 | |
---|
[9742] | 65 | #ifdef __EXECUTOR_FUNCTIONAL_NAME |
---|
[8035] | 66 | /////////// |
---|
| 67 | //// 0 //// |
---|
| 68 | /////////// |
---|
[7724] | 69 | //! @brief ExecutorClass, that can execute Functions without any parameters. |
---|
[9769] | 70 | template<class T, typename CallType, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9745] | 71 | class __EXECUTOR_FUNCTIONAL_NAME(0,) :public Executor<CallType, BaseClass> |
---|
[7716] | 72 | { |
---|
| 73 | private: |
---|
[7724] | 74 | /** @brief the FunctioPointer. */ |
---|
[7716] | 75 | void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST; |
---|
[5551] | 76 | |
---|
[7716] | 77 | public: |
---|
[7724] | 78 | /** |
---|
| 79 | * @brief constructs the Executor. |
---|
| 80 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 81 | */ |
---|
[9745] | 82 | __EXECUTOR_FUNCTIONAL_NAME(0,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST ) |
---|
[9746] | 83 | : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 84 | {}; |
---|
[7717] | 85 | |
---|
[7724] | 86 | /** |
---|
| 87 | * @brief executes the Functional |
---|
| 88 | * @param object the Object the action should be executed on. |
---|
[9742] | 89 | * @param eval the CallType to get the Parameters from. |
---|
[7724] | 90 | */ |
---|
[9769] | 91 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[7716] | 92 | { |
---|
| 93 | (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(); |
---|
| 94 | }; |
---|
[5142] | 95 | |
---|
[7724] | 96 | /** |
---|
| 97 | * @brief copies the Executor |
---|
| 98 | * @returns a new Executor that's a copy of this one. |
---|
| 99 | */ |
---|
[9735] | 100 | virtual Executor<CallType, BaseClass>* clone() const |
---|
[7719] | 101 | { |
---|
[9769] | 102 | return new __EXECUTOR_FUNCTIONAL_NAME(0,)<T, CallType, BaseClass>(this->functionPointer); |
---|
[7717] | 103 | }; |
---|
[7716] | 104 | }; |
---|
[5135] | 105 | |
---|
[8035] | 106 | |
---|
| 107 | |
---|
| 108 | /////////// |
---|
| 109 | //// 1 //// |
---|
| 110 | /////////// |
---|
[7724] | 111 | //! @brief ExecutorClass, that can execute Functions with one parameter. |
---|
[9769] | 112 | template<class T, typename CallType, typename type0, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9745] | 113 | class __EXECUTOR_FUNCTIONAL_NAME(1,) : public Executor<CallType, BaseClass> |
---|
[7716] | 114 | { |
---|
| 115 | private: |
---|
[7724] | 116 | /** @brief the FunctioPointer. */ |
---|
[7716] | 117 | void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST; |
---|
[5141] | 118 | |
---|
[7716] | 119 | public: |
---|
[7724] | 120 | /** |
---|
| 121 | * @brief constructs the Executor. |
---|
| 122 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 123 | */ |
---|
[9745] | 124 | __EXECUTOR_FUNCTIONAL_NAME(1,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 125 | : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 126 | {}; |
---|
[7717] | 127 | |
---|
[7724] | 128 | /** |
---|
| 129 | * @brief executes the Functional |
---|
| 130 | * @param object the Object the action should be executed on. |
---|
[9742] | 131 | * @param eval the CallType to get the Parameters from. |
---|
[7724] | 132 | */ |
---|
[9769] | 133 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[7716] | 134 | { |
---|
| 135 | (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
[9747] | 136 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue)); |
---|
[7716] | 137 | }; |
---|
[5153] | 138 | |
---|
[7724] | 139 | /** |
---|
| 140 | * @brief copies the Executor |
---|
| 141 | * @returns a new Executor that's a copy of this one. |
---|
| 142 | */ |
---|
[9735] | 143 | virtual Executor<CallType, BaseClass>* clone() const |
---|
[7719] | 144 | { |
---|
[9769] | 145 | return new __EXECUTOR_FUNCTIONAL_NAME(1,)<T, CallType, type0, BaseClass>(this->functionPointer); |
---|
[7717] | 146 | }; |
---|
[7716] | 147 | }; |
---|
[5145] | 148 | |
---|
[9735] | 149 | |
---|
| 150 | |
---|
[8035] | 151 | /////////// |
---|
| 152 | //// 2 //// |
---|
| 153 | /////////// |
---|
[7724] | 154 | //! @brief ExecutorClass, that can execute Functions with two parameters. |
---|
[9769] | 155 | template<class T, typename CallType, typename type0, typename type1, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9745] | 156 | class __EXECUTOR_FUNCTIONAL_NAME(2,) : public Executor<CallType, BaseClass> |
---|
[7716] | 157 | { |
---|
| 158 | private: |
---|
[7724] | 159 | /** @brief the FunctioPointer. */ |
---|
[7716] | 160 | void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST; |
---|
[5145] | 161 | |
---|
[7714] | 162 | public: |
---|
[7724] | 163 | /** |
---|
| 164 | * @brief constructs the Executor. |
---|
| 165 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 166 | */ |
---|
[9745] | 167 | __EXECUTOR_FUNCTIONAL_NAME(2,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 168 | : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 169 | {}; |
---|
[7717] | 170 | |
---|
[7724] | 171 | /** |
---|
| 172 | * @brief executes the Functional |
---|
| 173 | * @param object the Object the action should be executed on. |
---|
[9742] | 174 | * @param eval the CallType to get the Parameters from. |
---|
[7724] | 175 | */ |
---|
[9769] | 176 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[7714] | 177 | { |
---|
[7716] | 178 | (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
[9747] | 179 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), |
---|
| 180 | Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue)); |
---|
[7716] | 181 | }; |
---|
[7714] | 182 | |
---|
[7724] | 183 | /** |
---|
| 184 | * @brief copies the Executor |
---|
| 185 | * @returns a new Executor that's a copy of this one. |
---|
| 186 | */ |
---|
[9735] | 187 | virtual Executor<CallType, BaseClass>* clone() const |
---|
[7719] | 188 | { |
---|
[9769] | 189 | return new __EXECUTOR_FUNCTIONAL_NAME(2,)<T, CallType, type0, type1, BaseClass>(this->functionPointer); |
---|
[7717] | 190 | }; |
---|
[5129] | 191 | }; |
---|
[5113] | 192 | |
---|
[5632] | 193 | |
---|
[9735] | 194 | |
---|
[8035] | 195 | /////////// |
---|
| 196 | //// 3 //// |
---|
| 197 | /////////// |
---|
[7724] | 198 | //! @brief ExecutorClass, that can execute Functions with three parameters. |
---|
[9769] | 199 | template<class T, typename CallType, typename type0, typename type1, typename type2, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9745] | 200 | class __EXECUTOR_FUNCTIONAL_NAME(3,) : public Executor<CallType, BaseClass> |
---|
[7719] | 201 | { |
---|
| 202 | private: |
---|
[7724] | 203 | /** @brief the FunctioPointer. */ |
---|
[7719] | 204 | void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST; |
---|
[5326] | 205 | |
---|
[7719] | 206 | public: |
---|
[7724] | 207 | /** |
---|
| 208 | * @brief constructs the Executor. |
---|
| 209 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 210 | */ |
---|
[9745] | 211 | __EXECUTOR_FUNCTIONAL_NAME(3,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 212 | : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 213 | {}; |
---|
[7716] | 214 | |
---|
[7724] | 215 | /** |
---|
| 216 | * @brief executes the Functional |
---|
| 217 | * @param object the Object the action should be executed on. |
---|
[9742] | 218 | * @param eval the CallType to get the Parameters from. |
---|
[7724] | 219 | */ |
---|
[9769] | 220 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[7719] | 221 | { |
---|
| 222 | (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
[9747] | 223 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), |
---|
| 224 | Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue), |
---|
| 225 | Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue)); |
---|
[7719] | 226 | }; |
---|
[7718] | 227 | |
---|
[7724] | 228 | /** |
---|
| 229 | * @brief copies the Executor |
---|
| 230 | * @returns a new Executor that's a copy of this one. |
---|
| 231 | */ |
---|
[9735] | 232 | virtual Executor<CallType, BaseClass>* clone() const |
---|
[7719] | 233 | { |
---|
[9769] | 234 | return new __EXECUTOR_FUNCTIONAL_NAME(3,)<T, CallType, type0, type1, type2, BaseClass>(this->functionPointer); |
---|
[7719] | 235 | }; |
---|
| 236 | }; |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | |
---|
[8035] | 240 | /////////// |
---|
| 241 | //// 4 //// |
---|
| 242 | /////////// |
---|
[7724] | 243 | //! @brief ExecutorClass, that can execute Functions with four parameters. |
---|
[9769] | 244 | template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9745] | 245 | class __EXECUTOR_FUNCTIONAL_NAME(4,) : public Executor<CallType, BaseClass> |
---|
[7719] | 246 | { |
---|
| 247 | private: |
---|
[7724] | 248 | /** @brief the FunctioPointer. */ |
---|
[7719] | 249 | void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST; |
---|
| 250 | |
---|
| 251 | public: |
---|
[7724] | 252 | /** |
---|
| 253 | * @brief constructs the Executor. |
---|
| 254 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 255 | */ |
---|
[9745] | 256 | __EXECUTOR_FUNCTIONAL_NAME(4,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 257 | : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 258 | {}; |
---|
[7719] | 259 | |
---|
[7724] | 260 | /** |
---|
| 261 | * @brief executes the Functional |
---|
| 262 | * @param object the Object the action should be executed on. |
---|
[9742] | 263 | * @param eval the CallType to get the Parameters from. |
---|
[7724] | 264 | */ |
---|
[9769] | 265 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[7719] | 266 | { |
---|
| 267 | (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
[9747] | 268 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), |
---|
| 269 | Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue), |
---|
| 270 | Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue), |
---|
| 271 | Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue)); |
---|
[7719] | 272 | }; |
---|
| 273 | |
---|
[7724] | 274 | /** |
---|
| 275 | * @brief copies the Executor |
---|
| 276 | * @returns a new Executor that's a copy of this one. |
---|
| 277 | */ |
---|
[9735] | 278 | virtual Executor<CallType, BaseClass>* clone() const |
---|
[7719] | 279 | { |
---|
[9769] | 280 | return new __EXECUTOR_FUNCTIONAL_NAME(4,)<T, CallType, type0, type1, type2, type3, BaseClass>(this->functionPointer); |
---|
[7719] | 281 | }; |
---|
| 282 | }; |
---|
| 283 | |
---|
[8035] | 284 | |
---|
| 285 | |
---|
| 286 | /////////// |
---|
| 287 | //// 5 //// |
---|
| 288 | /////////// |
---|
[7724] | 289 | //! @brief ExecutorClass, that can execute Functions with five parameters. |
---|
[9769] | 290 | template<class T, typename CallType, typename type0, typename type1, typename type2, typename type3, typename type4, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9745] | 291 | class __EXECUTOR_FUNCTIONAL_NAME(5,) : public Executor<CallType, BaseClass> |
---|
[7719] | 292 | { |
---|
[7724] | 293 | private: |
---|
| 294 | /** @brief the FunctioPointer. */ |
---|
| 295 | void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST; |
---|
[7719] | 296 | |
---|
[7724] | 297 | public: |
---|
| 298 | /** |
---|
| 299 | * @brief constructs the Executor. |
---|
| 300 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 301 | */ |
---|
[9745] | 302 | __EXECUTOR_FUNCTIONAL_NAME(5,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 303 | : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 304 | {}; |
---|
[7719] | 305 | |
---|
[7724] | 306 | /** |
---|
| 307 | * @brief executes the Functional |
---|
| 308 | * @param object the Object the action should be executed on. |
---|
[9742] | 309 | * @param eval the CallType to get the Parameters from. |
---|
[7724] | 310 | */ |
---|
[9769] | 311 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[7724] | 312 | { |
---|
| 313 | (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
[9747] | 314 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), |
---|
| 315 | Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue), |
---|
| 316 | Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue), |
---|
| 317 | Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue), |
---|
| 318 | Evaluater<CallType>::template getValue<type4, 4>(eval, this->defaultValue)); |
---|
[7724] | 319 | }; |
---|
[7719] | 320 | |
---|
[7724] | 321 | /** |
---|
| 322 | * @brief copies the Executor |
---|
| 323 | * @returns a new Executor that's a copy of this one. |
---|
| 324 | */ |
---|
[9735] | 325 | virtual Executor<CallType, BaseClass>* clone() const |
---|
[7724] | 326 | { |
---|
[9769] | 327 | return new __EXECUTOR_FUNCTIONAL_NAME(5,)<T, CallType, type0, type1, type2, type3, type4, BaseClass>(this->functionPointer); |
---|
[7724] | 328 | }; |
---|
[7719] | 329 | }; |
---|
| 330 | |
---|
[9746] | 331 | |
---|
| 332 | //////////////////// |
---|
| 333 | //// 0 & RETURN //// |
---|
| 334 | //////////////////// |
---|
| 335 | //! @brief ExecutorClass, that can execute Functions with one parameter. |
---|
[9769] | 336 | template<class T, typename CallType, typename ReturnType, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9746] | 337 | class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass> |
---|
| 338 | { |
---|
| 339 | private: |
---|
| 340 | /** @brief the FunctioPointer. */ |
---|
[9747] | 341 | ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST; |
---|
[9746] | 342 | |
---|
| 343 | public: |
---|
| 344 | /** |
---|
| 345 | * @brief constructs the Executor. |
---|
| 346 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 347 | */ |
---|
[9747] | 348 | __EXECUTOR_FUNCTIONAL_NAME(0,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 349 | : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 350 | {}; |
---|
| 351 | |
---|
| 352 | /** |
---|
| 353 | * @brief executes the Functional |
---|
| 354 | * @param object the Object the action should be executed on. |
---|
| 355 | * @param eval the CallType to get the Parameters from. |
---|
| 356 | */ |
---|
[9769] | 357 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[9746] | 358 | { |
---|
[9747] | 359 | Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)()); |
---|
[9746] | 360 | }; |
---|
| 361 | |
---|
| 362 | /** |
---|
| 363 | * @brief copies the Executor |
---|
| 364 | * @returns a new Executor that's a copy of this one. |
---|
| 365 | */ |
---|
| 366 | virtual Executor<CallType, BaseClass>* clone() const |
---|
| 367 | { |
---|
[9769] | 368 | return new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ReturnType, BaseClass>(this->functionPointer); |
---|
[9746] | 369 | }; |
---|
| 370 | }; |
---|
| 371 | |
---|
| 372 | //////////////////// |
---|
| 373 | //// 1 & RETURN //// |
---|
| 374 | //////////////////// |
---|
| 375 | //! @brief ExecutorClass, that can execute Functions with one parameter. |
---|
[9769] | 376 | template<class T, typename CallType, typename ReturnType, typename type0, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9746] | 377 | class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass> |
---|
| 378 | { |
---|
| 379 | private: |
---|
| 380 | /** @brief the FunctioPointer. */ |
---|
[9747] | 381 | ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST; |
---|
[9746] | 382 | |
---|
| 383 | public: |
---|
| 384 | /** |
---|
| 385 | * @brief constructs the Executor. |
---|
| 386 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 387 | */ |
---|
[9747] | 388 | __EXECUTOR_FUNCTIONAL_NAME(1,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 389 | : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 390 | {}; |
---|
| 391 | |
---|
| 392 | /** |
---|
| 393 | * @brief executes the Functional |
---|
| 394 | * @param object the Object the action should be executed on. |
---|
| 395 | * @param eval the CallType to get the Parameters from. |
---|
| 396 | */ |
---|
[9769] | 397 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[9746] | 398 | { |
---|
[9747] | 399 | Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
| 400 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue))); |
---|
[9746] | 401 | }; |
---|
| 402 | |
---|
| 403 | /** |
---|
| 404 | * @brief copies the Executor |
---|
| 405 | * @returns a new Executor that's a copy of this one. |
---|
| 406 | */ |
---|
| 407 | virtual Executor<CallType, BaseClass>* clone() const |
---|
| 408 | { |
---|
[9769] | 409 | return new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ReturnType, type0, BaseClass>(this->functionPointer); |
---|
[9746] | 410 | }; |
---|
| 411 | }; |
---|
| 412 | |
---|
| 413 | |
---|
| 414 | //////////////////// |
---|
[9747] | 415 | //// 2 & RETURN //// |
---|
[9746] | 416 | //////////////////// |
---|
| 417 | //! @brief ExecutorClass, that can execute Functions with one parameter. |
---|
[9769] | 418 | template<class T, typename CallType, typename ReturnType, typename type0, typename type1, class BaseClass = BaseObject, template<typename> class Evaluater = ExecutorEvaluater> |
---|
[9746] | 419 | class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass> |
---|
| 420 | { |
---|
| 421 | private: |
---|
| 422 | /** @brief the FunctioPointer. */ |
---|
[9747] | 423 | ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST; |
---|
[9746] | 424 | |
---|
| 425 | public: |
---|
| 426 | /** |
---|
| 427 | * @brief constructs the Executor. |
---|
| 428 | * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. |
---|
| 429 | */ |
---|
[9747] | 430 | __EXECUTOR_FUNCTIONAL_NAME(2,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) |
---|
[9746] | 431 | : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) |
---|
| 432 | {}; |
---|
| 433 | |
---|
| 434 | /** |
---|
| 435 | * @brief executes the Functional |
---|
| 436 | * @param object the Object the action should be executed on. |
---|
| 437 | * @param eval the CallType to get the Parameters from. |
---|
| 438 | */ |
---|
[9769] | 439 | virtual void operator()(BaseClass* object, CallType& eval = Evaluater<CallType>::defaultValue()) const |
---|
[9746] | 440 | { |
---|
[9747] | 441 | Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( |
---|
| 442 | Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), |
---|
| 443 | Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue))); |
---|
[9746] | 444 | }; |
---|
| 445 | |
---|
| 446 | /** |
---|
| 447 | * @brief copies the Executor |
---|
| 448 | * @returns a new Executor that's a copy of this one. |
---|
| 449 | */ |
---|
| 450 | virtual Executor<CallType, BaseClass>* clone() const |
---|
| 451 | { |
---|
[9769] | 452 | return new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ReturnType, type0, type1, BaseClass>(this->functionPointer); |
---|
[9746] | 453 | }; |
---|
| 454 | }; |
---|
| 455 | |
---|
[9742] | 456 | #endif /* __EXECUTOR_FUNCTIONAL_NAME */ |
---|