Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9747 in orxonox.OLD for branches/new_class_id/src/lib


Ignore:
Timestamp:
Sep 16, 2006, 9:35:30 PM (18 years ago)
Author:
bensch
Message:

orxonox/new_class_id: Indexing works again for all the Scripts.

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  
    216216    if(error != 0)
    217217    {
    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());
    219219     reportError(error);
    220220     //clean up
  • branches/new_class_id/src/lib/util/executor/executor_generic.h

    r9746 r9747  
    4747   */
    4848  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");
    5152    return defaultValue;
    5253  }
     
    127128  {
    128129    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    129       Evaluater<CallType>().template operator()<type0, 0>(eval, this->defaultValue));
     130        Evaluater<CallType>::template getValue<type0, 0>(eval, this->defaultValue));
    130131  };
    131132
     
    170171  {
    171172    (__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));
    174175  };
    175176
     
    214215  {
    215216    (__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));
    219220  };
    220221
     
    259260  {
    260261    (__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));
    265266  };
    266267
     
    305306  {
    306307    (__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));
    312313  };
    313314
     
    327328////////////////////
    328329//! @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>
     330template<class T, typename CallType, typename ReturnType, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    330331class __EXECUTOR_FUNCTIONAL_NAME(0,ret) : public Executor<CallType, BaseClass>
    331332{
    332333private:
    333334  /** @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
     337public:
     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)
    342343      : Executor<CallType, BaseClass>(true, __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
    343344  {};
     
    350351  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
    351352  {
    352     Evaluater<CallType>().template storeRet<ret>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)());
     353    Evaluater<CallType>::template storeRet<ReturnType>(eval, (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)());
    353354  };
    354355
     
    359360  virtual Executor<CallType, BaseClass>* clone() const
    360361  {
    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);
    362363  };
    363364};
     
    367368////////////////////
    368369//! @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>
     370template<class T, typename CallType, typename ReturnType, typename type0, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    370371class __EXECUTOR_FUNCTIONAL_NAME(1,ret) : public Executor<CallType, BaseClass>
    371372{
    372373private:
    373374  /** @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
     377public:
     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)
    382383      : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
    383384  {};
     
    390391  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
    391392  {
    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)));
    394395  };
    395396
     
    400401  virtual Executor<CallType, BaseClass>* clone() const
    401402  {
    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 ////
    409410////////////////////
    410411//! @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>
     412template<class T, typename CallType, typename ReturnType, typename type0, typename type1, template<typename> class Evaluater = ExecutorEvaluater, class BaseClass = BaseObject>
    412413class __EXECUTOR_FUNCTIONAL_NAME(2,ret) : public Executor<CallType, BaseClass>
    413414{
    414415private:
    415416  /** @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
     419public:
     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)
    424425      : Executor<CallType, BaseClass>(true, ExecutorParamType<type0>(), __EXECUTOR_FUNCTIONAL_FUNCTIONTYPE), functionPointer(functionPointer)
    425426  {};
     
    432433  virtual void operator()(BaseObject* object, CallType& eval = Evaluater<CallType>::defaultValue()) const
    433434  {
    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)));
    437438  };
    438439
     
    443444  virtual Executor<CallType, BaseClass>* clone() const
    444445  {
    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);
    446447  };
    447448};
  • branches/new_class_id/src/lib/util/executor/executor_lua_state.h

    r9746 r9747  
    2626
    2727#include "executor_generic.h"
     28
    2829#include "luaincl.h"
     30
    2931#ifdef FUNCTOR_CALL_TYPE
    3032 #undef FUNCTOR_CALL_TYPE
     
    4951template<> void toLua<const std::string&>(lua_State* state, const std::string& value);
    5052
    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.
    5654template<> class ExecutorEvaluater <lua_State*>
    5755{
     
    6260   */
    6361  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)
    6563  {
    66     return (fromLua<ToType>(CallValue, index));
     64    return (fromLua<ToType>(CallValue, index+1));
    6765  }
    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)
    7068  {
    71     toLua<ToType>(state, value);
     69    toLua<FromType>(state, value);
    7270  }
    7371  static lua_State*& defaultValue() { static lua_State* nullState; return nullState; };
  • branches/new_class_id/src/lib/util/executor/executor_substring.h

    r9745 r9747  
    7171   */
    7272  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)
    7474  {
    7575    return (CallValue.size() > index) ?
Note: See TracChangeset for help on using the changeset viewer.