Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 10, 2006, 7:18:03 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: now the branche works again, as it did before

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/util/executor/executor.h

    r7212 r7214  
    4848
    4949    /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */
    50     virtual void execute (BaseObject* object, const void* parameters = NULL) = 0;
     50    virtual void execute (BaseObject* object, const std::string& parameters = "") = 0;
    5151
    5252    /** @returns the Type of this Function (either static or objective) */
     
    192192#define ExecutorExecute1(t1) \
    193193   else if (this->paramCount == 1 && this->defaultValue[0] == t1##_PARAM) \
    194     EXECUTOREXECUTER(_1_##t1)(t1##_FUNC((const char*)parameters, t1##_DEFGRAB(0)))
     194    EXECUTOREXECUTER(_1_##t1)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)))
    195195
    196196//! execute-macro for functions with two parameters
    197197#define ExecutorExecute2(t1,t2) \
    198198   else if (this->paramCount == 2 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM) \
    199     EXECUTOREXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)))
     199    EXECUTOREXECUTER(_2_##t1##_##t2)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)))
    200200
    201201//! execute-macro for functions with three parameters
    202202#define ExecutorExecute3(t1,t2,t3) \
    203203   else if (this->paramCount == 3 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM) \
    204     EXECUTOREXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)))
     204    EXECUTOREXECUTER(_3_##t1##_##t2##_##t3)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)), t3##_FUNC(sub[2], t3##_DEFGRAB(2)))
    205205
    206206//! execute-macro for functions with four parameters
    207207#define ExecutorExecute4(t1,t2,t3,t4) \
    208208   else if (this->paramCount == 4 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM && this->defaultValue[3] == t4##_PARAM) \
    209     EXECUTOREXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3))) \
     209    EXECUTOREXECUTER(_4_##t1##_##t2##_##t3##_##t4)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)), t3##_FUNC(sub[2], t3##_DEFGRAB(2)), t4##_FUNC(sub[3], t4##_DEFGRAB(3))) \
    210210
    211211
     
    213213#define ExecutorExecute5(t1,t2,t3,t4,t5) \
    214214   else if (this->paramCount == 5 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM && this->defaultValue[3] == t4##_PARAM && this->defaultValue[4] == t5##_PARAM) \
    215     EXECUTOREXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub.getString(0), t1##_DEFGRAB(0)), t2##_FUNC(sub.getString(1), t2##_DEFGRAB(1)), t3##_FUNC(sub.getString(2), t3##_DEFGRAB(2)), t4##_FUNC(sub.getString(3), t4##_DEFGRAB(3)), t5##_FUNC(sub.getString(4), t5##_DEFGRAB(4)))
     215    EXECUTOREXECUTER(_5_##t1##_##t2##_##t3##_##t4##_##t5)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)), t2##_FUNC(sub[1], t2##_DEFGRAB(1)), t3##_FUNC(sub[2], t3##_DEFGRAB(2)), t4##_FUNC(sub[3], t4##_DEFGRAB(3)), t5##_FUNC(sub[4], t5##_DEFGRAB(4)))
    216216
    217217
     
    242242#define EXECUTORTYPE                   Executor_Objective
    243243//! keeps information about a Executor
    244 template<class T> class ExecutorObjective : public Executor
     244template<class T> class EXECUTOR : public Executor
    245245{
    246246  public:
    247     ExecutorObjective() : Executor() { };
     247    EXECUTOR() : Executor() { };
    248248    // COPY constuctor (virtual version)
    249249    virtual Executor* clone () const
    250250    {
    251       ExecutorObjective<T>* executor = new ExecutorObjective<T>();
     251      EXECUTOR<T>* executor = new EXECUTOR<T>();
    252252      this->cloning(executor);
    253253      executor->fp = this->fp;
     
    268268    } fp;
    269269
    270     virtual void execute (BaseObject* object, const void* parameters = NULL)
     270    virtual void execute (BaseObject* object, const std::string& parameters = "")
    271271    {
    272272      SubString sub;
    273       printf("===%s\n", (const char*)parameters);
    274       if (parameters != NULL)
    275         sub.split((const char*)parameters, " \n\t,", '\\');
     273      printf("===%s\n", parameters.c_str());
     274      sub.split(parameters, " \n\t,", '\\');
     275      sub.debug();
    276276//! FUNCTOR_LIST is the List of Executive Functions
    277277#define FUNCTOR_LIST(x) ExecutorExecute ## x
     
    309309{
    310310  public:
    311     ExecutorStatic() : Executor() { };
     311    EXECUTOR() : Executor() { };
    312312    // COPY constuctor
    313313    virtual Executor* clone () const
    314314    {
    315       ExecutorStatic<T>* executor = new ExecutorStatic<T>();
     315      EXECUTOR<T>* executor = new EXECUTOR<T>();
    316316      this->cloning(executor);
    317317      executor->fp = this->fp;
     
    333333
    334334
    335     virtual void execute (BaseObject* object, const void* parameters = NULL)
     335    virtual void execute (BaseObject* object, const std::string& parameters = "")
    336336    {
    337337      SubString sub;
    338       if (parameters != NULL)
    339         sub.split((const char*)parameters, " \n\t,", '\\');
     338      sub.split(parameters, " \n\t,", '\\');
    340339//! FUNCTOR_LIST is the List of Executive Functions
    341340#define FUNCTOR_LIST(x) ExecutorExecute ## x
Note: See TracChangeset for help on using the changeset viewer.