Changeset 9006 in orxonox.OLD for trunk/src/lib/util/executor
- Timestamp:
- Jul 2, 2006, 2:11:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor_lua.h
r8894 r9006 44 44 public: 45 45 /** 46 47 46 * @brief Constructor of a ExecutorXML 47 * @param function a Function to call 48 48 */ 49 49 ExecutorLua0(void(T::*function)()) 50 50 : Executor() 51 51 { 52 52 this->functionPointer = function; … … 91 91 public: 92 92 /** 93 94 93 * @brief Constructor of a ExecutorXML 94 * @param function a Function to call 95 95 */ 96 96 ExecutorLua1(void(T::*function)(type0)) 97 98 { 99 this->functionPointer = function; 100 this->functorType = Executor_Objective | Executor_NoLoadString; 101 } 102 103 /** 104 105 106 97 : Executor(ExecutorParamType<type0>()) 98 { 99 this->functionPointer = function; 100 this->functorType = Executor_Objective | Executor_NoLoadString; 101 } 102 103 /** 104 * @brief executes the Command on BaseObject 105 * @param object the BaseObject to execute this Executor on 106 * @param loadString ignored in this case 107 107 */ 108 108 virtual void operator()(BaseObject* object, const SubString& = SubString()) const … … 120 120 121 121 /** 122 122 * @returns a _new_ Copy of this Executor 123 123 */ 124 124 virtual Executor* clone () const … … 140 140 public: 141 141 /** 142 143 142 * @brief Constructor of a ExecutorXML 143 * @param function a Function to call 144 144 */ 145 145 ExecutorLua2(void(T::*function)(type0, type1)) 146 146 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>()) 147 147 { 148 148 this->functionPointer = function; … … 166 166 167 167 (dynamic_cast<T*>(object)->*(functionPointer))( 168 fromLua<type0>(state, 1),169 168 fromLua<type0>(state, 1), 169 fromLua<type1>(state, 2) ); 170 170 } 171 171 … … 217 217 (dynamic_cast<T*>(object)->*(functionPointer))( 218 218 fromLua<type0>(state, 1), 219 220 219 fromLua<type1>(state, 2), 220 fromLua<type2>(state, 3) ); 221 221 } 222 222 … … 268 268 (dynamic_cast<T*>(object)->*(functionPointer))( 269 269 fromLua<type0>(state, 1), 270 271 272 270 fromLua<type1>(state, 2), 271 fromLua<type2>(state, 3), 272 fromLua<type3>(state, 4) ); 273 273 } 274 274 … … 300 300 public: 301 301 /** 302 303 302 * @brief Constructor of a ExecutorXML 303 * @param function a Function to call 304 304 */ 305 305 ExecutorLua0ret(ret (T::*function)()) 306 306 : Executor() 307 307 { 308 308 this->functionPointer = function; … … 329 329 330 330 /** 331 331 * @returns a _new_ Copy of this Executor 332 332 */ 333 333 virtual Executor* clone () const … … 349 349 public: 350 350 /** 351 352 351 * @brief Constructor of a ExecutorXML 352 * @param function a Function to call 353 353 */ 354 354 ExecutorLua1ret(ret (T::*function)(type0)) 355 355 : Executor(ExecutorParamType<type0>()) 356 356 { 357 357 this->functionPointer = function; … … 375 375 376 376 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 377 377 fromLua<type0>(state, 1))); 378 378 } 379 379 … … 397 397 public: 398 398 /** 399 400 399 * @brief Constructor of a ExecutorXML 400 * @param function a Function to call 401 401 */ 402 402 ExecutorLua2ret(ret (T::*function)(type0, type1)) 403 403 : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>()) 404 404 { 405 405 this->functionPointer = function; … … 423 423 424 424 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 425 426 425 fromLua<type0>(state, 1), 426 fromLua<type1>(state, 2) )); 427 427 } 428 428 … … 608 608 ExecutorParamType<type2>(), ExecutorParamType<type3>(), 609 609 ExecutorParamType<type4>(), ExecutorParamType<type5>()) 610 {611 this->functionPointer = function;612 this->functorType = Executor_Objective | Executor_NoLoadString;613 }614 615 /** 616 * @brief executes the Command on BaseObject617 * @param object the BaseObject to execute this Executor on618 * @param loadString ignored in this case619 */ 620 virtual void operator()(BaseObject* object, const SubString& = SubString()) const621 {622 PRINTF(1)("no usefull executor\n");623 }624 625 virtual void operator()(BaseObject* object, int& count, void* values) const626 {627 lua_State* state = (lua_State*)values;628 count = 1;629 630 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))(631 fromLua<type0>(state, 1),632 fromLua<type1>(state, 2),633 fromLua<type2>(state, 3),634 fromLua<type3>(state, 4),635 fromLua<type4>(state, 5),636 fromLua<type5>(state, 6) ));637 }638 639 /** 640 * @returns a _new_ Copy of this Executor641 */ 642 virtual Executor* clone () const643 {644 return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer);645 }610 { 611 this->functionPointer = function; 612 this->functorType = Executor_Objective | Executor_NoLoadString; 613 } 614 615 /** 616 * @brief executes the Command on BaseObject 617 * @param object the BaseObject to execute this Executor on 618 * @param loadString ignored in this case 619 */ 620 virtual void operator()(BaseObject* object, const SubString& = SubString()) const 621 { 622 PRINTF(1)("no usefull executor\n"); 623 } 624 625 virtual void operator()(BaseObject* object, int& count, void* values) const 626 { 627 lua_State* state = (lua_State*)values; 628 count = 1; 629 630 toLua<ret>(state, (dynamic_cast<T*>(object)->*(functionPointer))( 631 fromLua<type0>(state, 1), 632 fromLua<type1>(state, 2), 633 fromLua<type2>(state, 3), 634 fromLua<type3>(state, 4), 635 fromLua<type4>(state, 5), 636 fromLua<type5>(state, 6) )); 637 } 638 639 /** 640 * @returns a _new_ Copy of this Executor 641 */ 642 virtual Executor* clone () const 643 { 644 return new ExecutorLua6ret<T, ret, type0, type1, type2, type3, type4, type5>(this->functionPointer); 645 } 646 646 private: 647 647 ret (T::*functionPointer)(type0, type1, type2, type3, type4, type5);
Note: See TracChangeset
for help on using the changeset viewer.