Changeset 9746 in orxonox.OLD for branches/new_class_id/src/lib
- Timestamp:
- Sep 16, 2006, 3:34:04 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/effects/cloud_effect.cc
r9716 r9746 50 50 51 51 CREATE_SCRIPTABLE_CLASS(CloudEffect, CloudEffect::classID(), 52 addMethod("skyColor", Executor Lua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor))53 ->addMethod("cloudColor", Executor Lua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))54 ->addMethod("activate", Executor Lua0<CloudEffect>(&CloudEffect::activate))55 ->addMethod("deactivate", Executor Lua0<CloudEffect>(&CloudEffect::deactivate))52 addMethod("skyColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellSkyColor)) 53 ->addMethod("cloudColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellCloudColor)) 54 ->addMethod("activate", Executor0<CloudEffect, lua_State*>(&CloudEffect::activate)) 55 ->addMethod("deactivate", Executor0<CloudEffect, lua_State*>(&CloudEffect::deactivate)) 56 56 ); 57 57 -
branches/new_class_id/src/lib/graphics/effects/fog_effect.cc
r9716 r9746 21 21 #include "script_class.h" 22 22 #include "cloud_effect.h" 23 #include "debug.h" 23 24 24 25 ObjectListDefinition(FogEffect); … … 32 33 33 34 CREATE_SCRIPTABLE_CLASS(FogEffect, FogEffect::classID(), 34 addMethod("fadeIn", Executor Lua0<FogEffect>(&FogEffect::fadeInFog))35 ->addMethod("fadeOut", Executor Lua0<FogEffect>(&FogEffect::fadeOutFog))36 ->addMethod("activate", Executor Lua0<FogEffect>(&FogEffect::activate))37 ->addMethod("deactivate", Executor Lua0<FogEffect>(&FogEffect::deactivate))35 addMethod("fadeIn", Executor0<FogEffect, lua_State*>(&FogEffect::fadeInFog)) 36 ->addMethod("fadeOut", Executor0<FogEffect, lua_State*>(&FogEffect::fadeOutFog)) 37 ->addMethod("activate", Executor0<FogEffect, lua_State*>(&FogEffect::activate)) 38 ->addMethod("deactivate", Executor0<FogEffect, lua_State*>(&FogEffect::deactivate)) 38 39 ); 39 40 -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc
r9716 r9746 27 27 #include "cloud_effect.h" 28 28 #include "script_class.h" 29 #include "debug.h" 29 30 #include "class_id_DEPRECATED.h" 30 31 … … 35 36 36 37 CREATE_SCRIPTABLE_CLASS(LightningEffect, LightningEffect::classID(), 37 addMethod("activate", Executor Lua0<LightningEffect>(&LightningEffect::activate))38 ->addMethod("deactivate", Executor Lua0<LightningEffect>(&LightningEffect::deactivate))38 addMethod("activate", Executor0<LightningEffect, lua_State*>(&LightningEffect::activate)) 39 ->addMethod("deactivate", Executor0<LightningEffect, lua_State*>(&LightningEffect::deactivate)) 39 40 ); 40 41 -
branches/new_class_id/src/lib/graphics/effects/rain_effect.cc
r9716 r9746 30 30 #include "cloud_effect.h" 31 31 #include "script_class.h" 32 #include "debug.h" 32 33 33 34 #include "class_id_DEPRECATED.h" … … 44 45 45 46 CREATE_SCRIPTABLE_CLASS(RainEffect, RainEffect::classID(), 46 addMethod("startRaining", Executor Lua0<RainEffect>(&RainEffect::startRaining))47 ->addMethod("stopRaining", Executor Lua0<RainEffect>(&RainEffect::stopRaining))48 ->addMethod("activate", Executor Lua0<RainEffect>(&RainEffect::activate))49 ->addMethod("deactivate", Executor Lua0<RainEffect>(&RainEffect::deactivate))47 addMethod("startRaining", Executor0<RainEffect, lua_State*>(&RainEffect::startRaining)) 48 ->addMethod("stopRaining", Executor0<RainEffect, lua_State*>(&RainEffect::stopRaining)) 49 ->addMethod("activate", Executor0<RainEffect, lua_State*>(&RainEffect::activate)) 50 ->addMethod("deactivate", Executor0<RainEffect, lua_State*>(&RainEffect::deactivate)) 50 51 ); 51 52 -
branches/new_class_id/src/lib/graphics/effects/snow_effect.cc
r9716 r9746 38 38 39 39 CREATE_SCRIPTABLE_CLASS(SnowEffect, SnowEffect::classID(), 40 addMethod("activate", Executor Lua0<SnowEffect>(&SnowEffect::activate))41 ->addMethod("deactivate", Executor Lua0<SnowEffect>(&SnowEffect::deactivate))40 addMethod("activate", Executor0<SnowEffect, lua_State*>(&SnowEffect::activate)) 41 ->addMethod("deactivate", Executor0<SnowEffect, lua_State*>(&SnowEffect::deactivate)) 42 42 ); 43 43 -
branches/new_class_id/src/lib/script_engine/script.cc
r9720 r9746 26 26 27 27 CREATE_SCRIPTABLE_CLASS(Script, Script::classID(), 28 addMethod("addObject", Executor Lua2<Script,const std::string&, const std::string& >(&Script::addObject))29 ->addMethod("registerClass", Executor Lua1<Script,const std::string&>(&Script::registerClass))30 ->addMethod("selectFunction", Executor Lua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))31 ->addMethod("executeFunction", Executor Lua0ret<Script,bool >(&Script::executeFunction))28 addMethod("addObject", Executor2<Script, lua_State*,const std::string&, const std::string& >(&Script::addObject)) 29 ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass)) 30 ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction)) 31 ->addMethod("executeFunction", Executor0ret<Script, lua_State*,bool >(&Script::executeFunction)) 32 32 ); 33 33 -
branches/new_class_id/src/lib/script_engine/script_method.h
r9727 r9746 9 9 #include <vector> 10 10 11 #include "executor/executor_lua .h"12 11 #include "executor/executor_lua_state.h" 12 #include "executor/executor_member.h" 13 13 14 14 class ScriptMethod -
branches/new_class_id/src/lib/util/Makefile.am
r9743 r9746 8 8 libORXexecutor_a_SOURCES = \ 9 9 executor/executor.cc \ 10 executor/executor_lua.cc \11 10 executor/executor_lua_state.cc \ 12 11 executor/executor_substring.cc … … 49 48 executor/executor.h \ 50 49 executor/executor_xml.h \ 51 executor/executor_lua.h \52 50 executor/executor_lua_state.h \ 53 51 executor/executor_substring.h \ -
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.