Changeset 9746 in orxonox.OLD for branches/new_class_id/src/lib/util/executor
- Timestamp:
- Sep 16, 2006, 3:34:04 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util/executor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/executor/executor_generic.h
r9745 r9746 74 74 */ 75 75 __EXECUTOR_FUNCTIONAL_NAME(0,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST ) 76 : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 77 { 78 this->functionPointer = functionPointer; 79 }; 76 : Executor<CallType, BaseClass>(false, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 77 {}; 80 78 81 79 /** … … 118 116 */ 119 117 __EXECUTOR_FUNCTIONAL_NAME(1,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) 120 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 121 { 122 this->functionPointer = functionPointer; 123 }; 118 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 119 {}; 124 120 125 121 /** … … 163 159 */ 164 160 __EXECUTOR_FUNCTIONAL_NAME(2,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) 165 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 166 { 167 this->functionPointer = functionPointer; 168 }; 161 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 162 {}; 169 163 170 164 /** … … 209 203 */ 210 204 __EXECUTOR_FUNCTIONAL_NAME(3,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2) __EXECUTOR_FUNCTIONAL_CONST) 211 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 212 { 213 this->functionPointer = functionPointer; 214 }; 205 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 206 {}; 215 207 216 208 /** … … 256 248 */ 257 249 __EXECUTOR_FUNCTIONAL_NAME(4,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3) __EXECUTOR_FUNCTIONAL_CONST) 258 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 259 { 260 this->functionPointer = functionPointer; 261 }; 250 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 251 {}; 262 252 263 253 /** … … 304 294 */ 305 295 __EXECUTOR_FUNCTIONAL_NAME(5,) (void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1, type2, type3, type4) __EXECUTOR_FUNCTIONAL_CONST) 306 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE) 307 { 308 this->functionPointer = functionPointer; 309 }; 296 : Executor<CallType, BaseClass>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 297 {}; 310 298 311 299 /** … … 334 322 }; 335 323 324 325 //////////////////// 326 //// 0 & RETURN //// 327 //////////////////// 328 //! @brief ExecutorClass, that can execute Functions with one parameter. 329 template<class T, typename CallType, typename ret, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 330 class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass> 331 { 332 private: 333 /** @brief the FunctioPointer. */ 334 ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST; 335 336 public: 337 /** 338 * @brief constructs the Executor. 339 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 340 */ 341 __EXECUTOR_FUNCTIONAL_NAME(0,ret) (ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) 342 : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 343 {}; 344 345 /** 346 * @brief executes the Functional 347 * @param object the Object the action should be executed on. 348 * @param eval the CallType to get the Parameters from. 349 */ 350 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 351 { 352 Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)()); 353 }; 354 355 /** 356 * @brief copies the Executor 357 * @returns a new Executor that's a copy of this one. 358 */ 359 virtual Executor<CallType, BaseClass>* clone() const 360 { 361 return new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ret>(this->functionPointer); 362 }; 363 }; 364 365 //////////////////// 366 //// 1 & RETURN //// 367 //////////////////// 368 //! @brief ExecutorClass, that can execute Functions with one parameter. 369 template<class T, typename CallType, typename ret, typename type0, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 370 class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass> 371 { 372 private: 373 /** @brief the FunctioPointer. */ 374 ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST; 375 376 public: 377 /** 378 * @brief constructs the Executor. 379 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 380 */ 381 __EXECUTOR_FUNCTIONAL_NAME(1,ret) (ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) 382 : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 383 {}; 384 385 /** 386 * @brief executes the Functional 387 * @param object the Object the action should be executed on. 388 * @param eval the CallType to get the Parameters from. 389 */ 390 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 391 { 392 Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 393 Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue))); 394 }; 395 396 /** 397 * @brief copies the Executor 398 * @returns a new Executor that's a copy of this one. 399 */ 400 virtual Executor<CallType, BaseClass>* clone() const 401 { 402 return new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ret, type0>(this->functionPointer); 403 }; 404 }; 405 406 407 //////////////////// 408 //// 1 & RETURN //// 409 //////////////////// 410 //! @brief ExecutorClass, that can execute Functions with one parameter. 411 template<class T, typename CallType, typename ret, typename type0, typename type1, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 412 class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass> 413 { 414 private: 415 /** @brief the FunctioPointer. */ 416 ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST; 417 418 public: 419 /** 420 * @brief constructs the Executor. 421 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 422 */ 423 __EXECUTOR_FUNCTIONAL_NAME(2,ret) (ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) 424 : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 425 {}; 426 427 /** 428 * @brief executes the Functional 429 * @param object the Object the action should be executed on. 430 * @param eval the CallType to get the Parameters from. 431 */ 432 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 433 { 434 Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 435 Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue), 436 Evaluater<CallType>().template operator()<type1, 1>(eval, this->defaultValue))); 437 }; 438 439 /** 440 * @brief copies the Executor 441 * @returns a new Executor that's a copy of this one. 442 */ 443 virtual Executor<CallType, BaseClass>* clone() const 444 { 445 return new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ret, type0, type1>(this->functionPointer); 446 }; 447 }; 448 336 449 #endif /* __EXECUTOR_FUNCTIONAL_NAME */ -
branches/new_class_id/src/lib/util/executor/executor_lua_state.h
r9745 r9746 66 66 return (fromLua<ToType>(CallValue, index)); 67 67 } 68 template <typename ToType> 69 void storeRet(lua_State*& state, ToType value) 70 { 71 toLua<ToType>(state, value); 72 } 68 73 static lua_State*& defaultValue() { static lua_State* nullState; return nullState; }; 69 74 };
Note: See TracChangeset
for help on using the changeset viewer.