Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8048 in orxonox.OLD for trunk/src/lib/util


Ignore:
Timestamp:
May 31, 2006, 11:10:17 PM (18 years ago)
Author:
bensch
Message:

trunk: prepare for the new Executor

Location:
trunk/src/lib/util
Files:
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/executor/executor.h

    r8035 r8048  
    5353    // EXECUTE
    5454    /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    55     virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const = 0;
     55    virtual void operator()(BaseObject* object, unsigned int count, void* values) const = 0;
    5656    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
    5757    virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0;
    58     /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes @brief here for your convenience*/
    59     void execute (BaseObject* object, const std::string& parameters = "") const { (*this)(object, parameters); };
    60 
    6158
    6259    // RETRIEVE INFORMATION
  • trunk/src/lib/util/executor/executor_functional.h

    r8035 r8048  
    123123
    124124  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    125   virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     125  virtual void operator()(BaseObject* object, unsigned int count, void* values) const
    126126  {
    127127    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
     
    163163
    164164  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    165   virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    166   {
     165  virtual void operator()(BaseObject* object, unsigned int count, void* values) const
     166  {
     167    const MultiType* mt = (const MultiType*)values;
    167168    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    168              fromMulti<type0>((count > 0)? values[0] : this->defaultValue[0]) );
     169             fromMulti<type0>((count > 0)? mt[0] : this->defaultValue[0]) );
    169170  }
    170171
     
    226227
    227228  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    228   virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    229   {
     229  virtual void operator()(BaseObject* object, unsigned int count, void* values) const
     230  {
     231    const MultiType* mt = (const MultiType*)values;
    230232    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    231              fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
    232              fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]) );
     233             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
     234             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]) );
    233235  }
    234236
     
    280282
    281283  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    282   virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    283   {
     284  virtual void operator()(BaseObject* object, unsigned int count, void* values) const
     285  {
     286    const MultiType* mt = (const MultiType*)values;
    284287    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    285              fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
    286              fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),
    287              fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]) );
     288             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
     289             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
     290             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]) );
    288291  }
    289292
     
    337340
    338341  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    339   virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    340   {
     342  virtual void operator()(BaseObject* object, unsigned int count, void* values) const
     343  {
     344    const MultiType* mt = (const MultiType*)values;
    341345    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    342              fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
    343              fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),
    344              fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]),
    345              fromMulti<type3>((count > 3) ? values[3] : this->defaultValue[3]) );
     346             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
     347             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
     348             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
     349             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]) );
    346350  }
    347351
     
    396400
    397401  /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */
    398   virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    399   {
     402  virtual void operator()(BaseObject* object, unsigned int count, void* values) const
     403  {
     404    const MultiType* mt = (const MultiType*)values;
    400405    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    401              fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
    402              fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),
    403              fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]),
    404              fromMulti<type3>((count > 3) ? values[3] : this->defaultValue[3]),
    405              fromMulti<type4>((count > 4) ? values[4] : this->defaultValue[4]) );
     406             fromMulti<type0>((count > 0) ? mt[0] : this->defaultValue[0]),
     407             fromMulti<type1>((count > 1) ? mt[1] : this->defaultValue[1]),
     408             fromMulti<type2>((count > 2) ? mt[2] : this->defaultValue[2]),
     409             fromMulti<type3>((count > 3) ? mt[3] : this->defaultValue[3]),
     410             fromMulti<type4>((count > 4) ? mt[4] : this->defaultValue[4]) );
    406411  }
    407412
     
    421426 * @brief enables us to easily retrieve an Executor of Class T with modular Argument-count, (without thinking about args at all)
    422427 */
    423 #define EXECUTOR_FUNCTIONAL_CREATOR0(ret) \
    424 template<class T> Executor* createExecutor(ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
     428#define EXECUTOR_FUNCTIONAL_CREATOR0() \
     429template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)() __EXECUTOR_FUNCTIONAL_CONST) \
    425430{ \
    426431  return new __EXECUTOR_FUNCTIONAL_NAME(0)<T>(functionPointer); \
     
    431436 * @param type0 for internal usage: the first Argument
    432437 */
    433 #define EXECUTOR_FUNCTIONAL_CREATOR1(ret, type0) \
    434 template<class T> Executor* createExecutor(ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     438#define EXECUTOR_FUNCTIONAL_CREATOR1(type0) \
     439template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    435440{ \
    436441  return new __EXECUTOR_FUNCTIONAL_NAME(1)<T, type0##_TYPE>(functionPointer); \
     
    442447 * @param type1 for internal usage: the second Argument
    443448 */
    444 #define EXECUTOR_FUNCTIONAL_CREATOR2(ret, type0, type1) \
    445 template<class T> Executor* createExecutor(ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     449#define EXECUTOR_FUNCTIONAL_CREATOR2(type0, type1) \
     450template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    446451{ \
    447452  return new __EXECUTOR_FUNCTIONAL_NAME(2)<T, type0##_TYPE, type1##_TYPE>(functionPointer); \
     
    454459 * @param type2 for internal usage: the third Argument
    455460 */
    456 #define EXECUTOR_FUNCTIONAL_CREATOR3(ret, type0, type1, type2) \
    457 template<class T> Executor* createExecutor(ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     461#define EXECUTOR_FUNCTIONAL_CREATOR3(type0, type1, type2) \
     462template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    458463{ \
    459464  return new __EXECUTOR_FUNCTIONAL_NAME(3)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE>(functionPointer); \
     
    467472 * @param type3 for internal usage: the fourth Argument
    468473 */
    469 #define EXECUTOR_FUNCTIONAL_CREATOR4(ret, type0, type1, type2, type3) \
    470 template<class T> Executor* createExecutor(ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     474#define EXECUTOR_FUNCTIONAL_CREATOR4(type0, type1, type2, type3) \
     475template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    471476{ \
    472477  return new __EXECUTOR_FUNCTIONAL_NAME(4)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE>(functionPointer); \
     
    481486 * @param type4 for internal usage: the fifth Argument
    482487 */
    483 #define EXECUTOR_FUNCTIONAL_CREATOR5(ret, type0, type1, type2, type3, type4) \
    484 template<class T> Executor* createExecutor(ret (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
     488#define EXECUTOR_FUNCTIONAL_CREATOR5(type0, type1, type2, type3, type4) \
     489template<class T> Executor* createExecutor(void (__EXECUTOR_FUNCTIONAL_FUNCTION_POINTER)(type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE) __EXECUTOR_FUNCTIONAL_CONST) \
    485490{ \
    486491    return new __EXECUTOR_FUNCTIONAL_NAME(5)<T, type0##_TYPE, type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE>(functionPointer); \
  • trunk/src/lib/util/executor/executor_xml.h

    r8042 r8048  
    6767    }
    6868
    69     virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     69    virtual void operator()(BaseObject* object, unsigned int count, void* values) const
    7070    {
    71 
     71      PRINTF(1)("missuse of XML-operator, OR IMPLEMENT.\n");
    7272    }
    7373
  • trunk/src/lib/util/executor/functor_list.h

    r8035 r8048  
    9090#ifdef FUNCTOR_LIST
    9191
    92   FUNCTOR_LIST(0)(void);
     92  FUNCTOR_LIST(0)();
    9393  //! makes functions with one string
    94   FUNCTOR_LIST(1)(void, l_STRING);
     94  FUNCTOR_LIST(1)(l_STRING);
    9595  //! makes functions with two strings
    96   FUNCTOR_LIST(2)(void, l_STRING, l_STRING);
     96  FUNCTOR_LIST(2)(l_STRING, l_STRING);
    9797  //! makes functions with three strings
    98   FUNCTOR_LIST(3)(void, l_STRING, l_STRING, l_STRING);
     98  FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING);
    9999  //! makes functions with four strings
    100   FUNCTOR_LIST(4)(void, l_STRING, l_STRING, l_STRING, l_STRING);
     100  FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING);
    101101
    102102
    103103  //! makes functions with one bool
    104   FUNCTOR_LIST(1)(void, l_BOOL);
     104  FUNCTOR_LIST(1)(l_BOOL);
    105105
    106106  //! makes functions with one int
    107   FUNCTOR_LIST(1)(void, l_INT);
     107  FUNCTOR_LIST(1)(l_INT);
    108108  //! makes functions with two ints
    109   FUNCTOR_LIST(2)(void, l_INT, l_INT);
     109  FUNCTOR_LIST(2)(l_INT, l_INT);
    110110  //! makes functions with three ints
    111   FUNCTOR_LIST(3)(void, l_INT, l_INT, l_INT);
     111  FUNCTOR_LIST(3)(l_INT, l_INT, l_INT);
    112112  //! makes functions with four ints
    113   FUNCTOR_LIST(4)(void, l_INT, l_INT, l_INT, l_INT);
     113  FUNCTOR_LIST(4)(l_INT, l_INT, l_INT, l_INT);
    114114
    115115
    116116  //! makes functions with one unsigned int
    117   FUNCTOR_LIST(1)(void, l_UINT);
     117  FUNCTOR_LIST(1)(l_UINT);
    118118  //! makes functions with two unsigned ints
    119   FUNCTOR_LIST(2)(void, l_UINT, l_UINT);
     119  FUNCTOR_LIST(2)(l_UINT, l_UINT);
    120120  //! makes functions with three unsigned ints
    121   FUNCTOR_LIST(3)(void, l_UINT, l_UINT, l_UINT);
     121  FUNCTOR_LIST(3)(l_UINT, l_UINT, l_UINT);
    122122  //! makes functions with four unsigned ints
    123   FUNCTOR_LIST(4)(void, l_UINT, l_UINT, l_UINT, l_UINT);
     123  FUNCTOR_LIST(4)(l_UINT, l_UINT, l_UINT, l_UINT);
    124124
    125125  //! makes functions with one float
    126   FUNCTOR_LIST(1)(void, l_FLOAT);
     126  FUNCTOR_LIST(1)(l_FLOAT);
    127127  //! makes functions with two floats
    128   FUNCTOR_LIST(2)(void, l_FLOAT, l_FLOAT);
     128  FUNCTOR_LIST(2)(l_FLOAT, l_FLOAT);
    129129  //! makes functions with three floats
    130   FUNCTOR_LIST(3)(void, l_FLOAT, l_FLOAT, l_FLOAT);
     130  FUNCTOR_LIST(3)(l_FLOAT, l_FLOAT, l_FLOAT);
    131131  //! makes functions with four floats
    132   FUNCTOR_LIST(4)(void, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
     132  FUNCTOR_LIST(4)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
    133133  //! makes functions with four floats
    134   FUNCTOR_LIST(5)(void, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
     134  FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
    135135
    136136  //! mixed values:
    137   FUNCTOR_LIST(2)(void, l_STRING, l_FLOAT);
    138   FUNCTOR_LIST(2)(void, l_UINT, l_LONG);
    139   FUNCTOR_LIST(2)(void, l_STRING, l_UINT);
     137  FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
     138  FUNCTOR_LIST(2)(l_UINT, l_LONG);
     139  FUNCTOR_LIST(2)(l_STRING, l_UINT);
    140140
    141   FUNCTOR_LIST(3)(void, l_STRING, l_FLOAT, l_UINT);
    142   FUNCTOR_LIST(4)(void, l_STRING, l_FLOAT, l_UINT, l_UINT);
    143   FUNCTOR_LIST(3)(void, l_STRING, l_INT, l_UINT);
    144   FUNCTOR_LIST(3)(void, l_STRING, l_UINT, l_UINT);
     141  FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT);
     142  FUNCTOR_LIST(4)(l_STRING, l_FLOAT, l_UINT, l_UINT);
     143  FUNCTOR_LIST(3)(l_STRING, l_INT, l_UINT);
     144  FUNCTOR_LIST(3)(l_STRING, l_UINT, l_UINT);
    145145
    146146#endif /* FUNCTOR_LIST */
  • trunk/src/lib/util/loading/load_param.h

    r7722 r8048  
    2525
    2626#include "executor/executor.h"
    27 #include "executor/executor_specials.h"
     27#include "executor/executor_xml.h"
    2828
    2929// Forward Declaration //
Note: See TracChangeset for help on using the changeset viewer.