Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 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

Location:
trunk/src/lib/util/executor
Files:
4 edited

Legend:

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

    r7201 r7221  
    105105  value[4] = &value4;
    106106
    107   printf("%s ::: paramCount: %d\n", this->getName(), this->paramCount);
    108107  for (unsigned int i = 0; i < this->paramCount; i++)
    109108  {
    110109    if (*value[i] != MT_NULL)
    111110    {
    112       printf("1:::: %d : %s \n",i, MultiType::MultiTypeToString(this->defaultValue[i].getType()));
    113 
    114       this->defaultValue[i].debug();
    115       //this->defaultValue[i].setValueOf(*value[i]);
    116       //printf("2::::%s\n", MultiType::MultiTypeToString(this->defaultValue[i].getType()));
    117       //this->defaultValue[i].debug();
    118     //this->defaultValue[i].setValueOf(*value[i]);
     111      this->defaultValue[i].setValueOf(*value[i]);
    119112    }
    120113  }
  • 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
  • trunk/src/lib/util/executor/executor_specials.h

    r7197 r7221  
    6060     * @param loadString ignored in this case
    6161     */
    62     virtual void execute(BaseObject* object, const void* parameters = NULL)
     62    virtual void execute(BaseObject* object, const std::string& = "")
    6363    {
    6464      if (object != NULL && this->element != NULL)
  • trunk/src/lib/util/executor/functor_list.h

    r7199 r7221  
    2121   l_SHORT:     short
    2222   l_FLOAT:     float
    23    l_CSTRING:    const char*
     23   l_STRING:    const std::string&
    2424   l_XML_ELEM:  TiXmlElement*
    2525 */
     
    7474//#define l_VECTOR_DEFAULT   Vector(0,0,0)        //!< Default value for a VECTOR
    7575
    76 #define l_CSTRING_TYPE     const char*          //!< The type of a STRING
    77 #define l_CSTRING_FUNC     isString             //!< The function to parse a STRING
    78 #define l_CSTRING_NAME     "string"             //!< The name of a STRING
    79 #define l_CSTRING_PARAM    MT_STRING            //!< the type of the parameter STRING
    80 #define l_CSTRING_DEFAULT  ""                   //!< a default Value for an STRING
    81 
    8276#define l_STRING_TYPE      const std::string&   //!< The type of a STRING
    8377#define l_STRING_FUNC      isString             //!< The function to parse a STRING
    8478#define l_STRING_NAME      "string"             //!< The name of a STRING
    85 #define l_STRING_PARAM     MT_STRING            //!< the type of the parameter STRING
     79#define l_STRING_PARAM     MT_STRING           //!< the type of the parameter STRING
    8680#define l_STRING_DEFAULT   ""                   //!< a default Value for an STRING
    8781
     
    9993  FUNCTOR_LIST(0)();
    10094  //! makes functions with one string
    101   FUNCTOR_LIST(1)(l_CSTRING);
     95  FUNCTOR_LIST(1)(l_STRING);
    10296  //! makes functions with two strings
    103   FUNCTOR_LIST(2)(l_CSTRING, l_CSTRING);
     97  FUNCTOR_LIST(2)(l_STRING, l_STRING);
    10498  //! makes functions with three strings
    105   FUNCTOR_LIST(3)(l_CSTRING, l_CSTRING, l_CSTRING);
     99  FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING);
    106100  //! makes functions with four strings
    107   FUNCTOR_LIST(4)(l_CSTRING, l_CSTRING, l_CSTRING, l_CSTRING);
     101  FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING);
     102
    108103
    109104  //! makes functions with one bool
     
    141136
    142137  //! mixed values:
    143   FUNCTOR_LIST(2)(l_CSTRING, l_FLOAT);
     138  FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
    144139  FUNCTOR_LIST(2)(l_UINT, l_LONG);
    145   FUNCTOR_LIST(2)(l_CSTRING, l_UINT);
     140  FUNCTOR_LIST(2)(l_STRING, l_UINT);
    146141
    147   FUNCTOR_LIST(3)(l_CSTRING, l_FLOAT, l_UINT);
     142  FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT);
    148143
    149144
Note: See TracChangeset for help on using the changeset viewer.