Changeset 9747 in orxonox.OLD for branches/new_class_id/src/lib
- Timestamp:
- Sep 16, 2006, 9:35:30 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/script_engine/script.cc
r9746 r9747 216 216 if(error != 0) 217 217 { 218 PRINTF(1)("Script '%s' : Failed to execute function '%s': \n",currentFile.c_str(),currentFunction.c_str());218 printf("Script '%s' : Failed to execute function '%s': \n",currentFile.c_str(),currentFunction.c_str()); 219 219 reportError(error); 220 220 //clean up -
branches/new_class_id/src/lib/util/executor/executor_generic.h
r9746 r9747 47 47 */ 48 48 template <typename ToType, int index> 49 ToType operator()(FromType& CallValue, const MultiType* const defaults) 50 { 49 static ToType getValue(FromType& CallValue, const MultiType* const defaults) 50 { 51 assert(0 && "Might be by mistake"); 51 52 return defaultValue; 52 53 } … … 127 128 { 128 129 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 129 Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue));130 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue)); 130 131 }; 131 132 … … 170 171 { 171 172 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 172 Evaluater<CallType> ().template operator()<type0, 0>(eval, this->defaultValue),173 Evaluater<CallType> ().template operator()<type1, 1>(eval, this->defaultValue));173 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), 174 Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue)); 174 175 }; 175 176 … … 214 215 { 215 216 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 216 Evaluater<CallType> ().template operator()<type0, 0>(eval, this->defaultValue),217 Evaluater<CallType> ().template operator()<type1, 1>(eval, this->defaultValue),218 Evaluater<CallType> ().template operator()<type2, 2>(eval, this->defaultValue));217 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), 218 Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue), 219 Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue)); 219 220 }; 220 221 … … 259 260 { 260 261 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 261 Evaluater<CallType> ().template operator()<type0, 0>(eval, this->defaultValue),262 Evaluater<CallType> ().template operator()<type1, 1>(eval, this->defaultValue),263 Evaluater<CallType> ().template operator()<type2, 2>(eval, this->defaultValue),264 Evaluater<CallType> ().template operator()<type3, 3>(eval, this->defaultValue));262 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), 263 Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue), 264 Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue), 265 Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue)); 265 266 }; 266 267 … … 305 306 { 306 307 (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 307 Evaluater<CallType> ().template operator()<type0, 0>(eval, this->defaultValue),308 Evaluater<CallType> ().template operator()<type1, 1>(eval, this->defaultValue),309 Evaluater<CallType> ().template operator()<type2, 2>(eval, this->defaultValue),310 Evaluater<CallType> ().template operator()<type3, 3>(eval, this->defaultValue),311 Evaluater<CallType> ().template operator()<type4, 4>(eval, this->defaultValue));308 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), 309 Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue), 310 Evaluater<CallType>::template getValue<type2, 2>(eval, this->defaultValue), 311 Evaluater<CallType>::template getValue<type3, 3>(eval, this->defaultValue), 312 Evaluater<CallType>::template getValue<type4, 4>(eval, this->defaultValue)); 312 313 }; 313 314 … … 327 328 //////////////////// 328 329 //! @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 template<class T, typename CallType, typename ReturnType, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 330 331 class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass> 331 332 { 332 333 private: 333 334 /** @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)335 ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST; 336 337 public: 338 /** 339 * @brief constructs the Executor. 340 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 341 */ 342 __EXECUTOR_FUNCTIONAL_NAME(0,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) 342 343 : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 343 344 {}; … … 350 351 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 351 352 { 352 Evaluater<CallType> ().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)());353 Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)()); 353 354 }; 354 355 … … 359 360 virtual Executor<CallType, BaseClass>* clone() const 360 361 { 361 return new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ret>(this->functionPointer);362 return new __EXECUTOR_FUNCTIONAL_NAME(0,ret)<T, CallType, ReturnType>(this->functionPointer); 362 363 }; 363 364 }; … … 367 368 //////////////////// 368 369 //! @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 template<class T, typename CallType, typename ReturnType, typename type0, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 370 371 class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass> 371 372 { 372 373 private: 373 374 /** @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)375 ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST; 376 377 public: 378 /** 379 * @brief constructs the Executor. 380 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 381 */ 382 __EXECUTOR_FUNCTIONAL_NAME(1,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0) __EXECUTOR_FUNCTIONAL_CONST) 382 383 : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 383 384 {}; … … 390 391 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 391 392 { 392 Evaluater<CallType> ().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(393 Evaluater<CallType> ().template operator()<type0, 0>(eval, this->defaultValue)));393 Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 394 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue))); 394 395 }; 395 396 … … 400 401 virtual Executor<CallType, BaseClass>* clone() const 401 402 { 402 return new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ret, type0>(this->functionPointer);403 }; 404 }; 405 406 407 //////////////////// 408 //// 1& RETURN ////403 return new __EXECUTOR_FUNCTIONAL_NAME(1,ret)<T, CallType, ReturnType, type0>(this->functionPointer); 404 }; 405 }; 406 407 408 //////////////////// 409 //// 2 & RETURN //// 409 410 //////////////////// 410 411 //! @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 template<class T, typename CallType, typename ReturnType, typename type0, typename type1, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject> 412 413 class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass> 413 414 { 414 415 private: 415 416 /** @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)417 ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST; 418 419 public: 420 /** 421 * @brief constructs the Executor. 422 * @param __EXECUTOR_FUNCTIONAL_FUNCTION_POINTER the FunctionPointer to the Calling Function. 423 */ 424 __EXECUTOR_FUNCTIONAL_NAME(2,ret) (ReturnType (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0, type1) __EXECUTOR_FUNCTIONAL_CONST) 424 425 : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer) 425 426 {}; … … 432 433 virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const 433 434 { 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)));435 Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)( 436 Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue), 437 Evaluater<CallType>::template getValue<type1, 1>(eval, this->defaultValue))); 437 438 }; 438 439 … … 443 444 virtual Executor<CallType, BaseClass>* clone() const 444 445 { 445 return new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ret, type0, type1>(this->functionPointer);446 return new __EXECUTOR_FUNCTIONAL_NAME(2,ret)<T, CallType, ReturnType, type0, type1>(this->functionPointer); 446 447 }; 447 448 }; -
branches/new_class_id/src/lib/util/executor/executor_lua_state.h
r9746 r9747 26 26 27 27 #include "executor_generic.h" 28 28 29 #include "luaincl.h" 30 29 31 #ifdef FUNCTOR_CALL_TYPE 30 32 #undef FUNCTOR_CALL_TYPE … … 49 51 template<> void toLua<const std::string&>(lua_State* state, const std::string& value); 50 52 51 /** 52 * @brief to remove writing errors, this function is Used. 53 * @param sub The SubString to use 54 * @param default The default Values. 55 */ 53 //! A Class, that evaluates a lua_State and converts indices into different Types. 56 54 template<> class ExecutorEvaluater <lua_State*> 57 55 { … … 62 60 */ 63 61 template <typename ToType, int index> 64 ToType operator()(lua_State*& CallValue, const MultiType* const defaults)62 static ToType getValue(lua_State*& CallValue, const MultiType* const defaults) 65 63 { 66 return (fromLua<ToType>(CallValue, index ));64 return (fromLua<ToType>(CallValue, index+1)); 67 65 } 68 template <typename ToType>69 void storeRet(lua_State*& state, ToType value)66 template <typename FromType> 67 static void storeRet(lua_State*& state, FromType value) 70 68 { 71 toLua< ToType>(state, value);69 toLua<FromType>(state, value); 72 70 } 73 71 static lua_State*& defaultValue() { static lua_State* nullState; return nullState; }; -
branches/new_class_id/src/lib/util/executor/executor_substring.h
r9745 r9747 71 71 */ 72 72 template <typename ToType, int index> 73 ToType operator()(const SubString& CallValue, const MultiType* const defaults)73 static ToType getValue(const SubString& CallValue, const MultiType* const defaults) 74 74 { 75 75 return (CallValue.size() > index) ?
Note: See TracChangeset
for help on using the changeset viewer.