Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7221 in orxonox.OLD for trunk/src/lib/util/executor/executor.h


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

File:
1 edited

Legend:

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

    r7200 r7221  
    1616//! an enumerator for the definition of the Type.
    1717typedef enum {
    18   Executor_Objective         = 0x00000001,
    19   Executor_Static            = 0x00000002,
    20 
    21   Executor_NoLoadString      = 0x00000010,
     18  Executor_Objective         = 1,
     19  Executor_Static            = 2,
     20
     21  Executor_NoLoadString      = 8,
    2222} Executor_Type;
    2323
     
    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) */
     
    8787#define   l_FLOAT_DEFGRAB(i)        this->defaultValue[i].getFloat()
    8888//! where to chek for default STRING values
     89#define   l_STRING_DEFGRAB(i)       this->defaultValue[i].getString()
     90//! where to chek for default CSTRING values
    8991#define   l_CSTRING_DEFGRAB(i)      this->defaultValue[i].getCString()
    9092
     
    190192#define ExecutorExecute1(t1) \
    191193   else if (this->paramCount == 1 && this->defaultValue[0] == t1##_PARAM) \
    192     EXECUTOREXECUTER(_1_##t1)(t1##_FUNC((const char*)parameters, t1##_DEFGRAB(0)))
     194    EXECUTOREXECUTER(_1_##t1)(t1##_FUNC(sub[0], t1##_DEFGRAB(0)))
    193195
    194196//! execute-macro for functions with two parameters
    195197#define ExecutorExecute2(t1,t2) \
    196198   else if (this->paramCount == 2 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM) \
    197     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)))
    198200
    199201//! execute-macro for functions with three parameters
    200202#define ExecutorExecute3(t1,t2,t3) \
    201203   else if (this->paramCount == 3 && this->defaultValue[0] == t1##_PARAM && this->defaultValue[1] == t2##_PARAM && this->defaultValue[2] == t3##_PARAM) \
    202     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)))
    203205
    204206//! execute-macro for functions with four parameters
    205207#define ExecutorExecute4(t1,t2,t3,t4) \
    206208   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) \
    207     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))) \
    208210
    209211
     
    211213#define ExecutorExecute5(t1,t2,t3,t4,t5) \
    212214   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) \
    213     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)))
    214216
    215217
     
    240242#define EXECUTORTYPE                   Executor_Objective
    241243//! keeps information about a Executor
    242 template<class T> class ExecutorObjective : public Executor
     244template<class T> class EXECUTOR : public Executor
    243245{
    244246  public:
    245     ExecutorObjective() : Executor() { };
     247    EXECUTOR() : Executor() { };
    246248    // COPY constuctor (virtual version)
    247249    virtual Executor* clone () const
    248250    {
    249       ExecutorObjective<T>* executor = new ExecutorObjective<T>();
     251      EXECUTOR<T>* executor = new EXECUTOR<T>();
    250252      this->cloning(executor);
    251253      executor->fp = this->fp;
     
    266268    } fp;
    267269
    268     virtual void execute (BaseObject* object, const void* parameters = NULL)
     270    virtual void execute (BaseObject* object, const std::string& parameters = "")
    269271    {
    270       SubString sub((const char*) parameters, " \n\t,", '\\');
    271       printf("%s :: %s\n", this->getName(), (const char*) parameters);
     272      SubString sub;
     273      sub.split(parameters, " \n\t,", '\\');
    272274//! FUNCTOR_LIST is the List of Executive Functions
    273275#define FUNCTOR_LIST(x) ExecutorExecute ## x
     
    305307{
    306308  public:
    307     ExecutorStatic() : Executor() { };
     309    EXECUTOR() : Executor() { };
    308310    // COPY constuctor
    309311    virtual Executor* clone () const
    310312    {
    311       ExecutorStatic<T>* executor = new ExecutorStatic<T>();
     313      EXECUTOR<T>* executor = new EXECUTOR<T>();
    312314      this->cloning(executor);
    313315      executor->fp = this->fp;
     
    329331
    330332
    331     virtual void execute (BaseObject* object, const void* parameters = NULL)
     333    virtual void execute (BaseObject* object, const std::string& parameters = "")
    332334    {
    333   SubString sub((const char*)parameters, " \n\t,");
     335      SubString sub;
     336      sub.split(parameters, " \n\t,", '\\');
    334337//! FUNCTOR_LIST is the List of Executive Functions
    335338#define FUNCTOR_LIST(x) ExecutorExecute ## x
Note: See TracChangeset for help on using the changeset viewer.