Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Mar 8, 2006, 10:46:37 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: MultiType rework (now uses std::string) this is more compliant, and better to handle

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

Legend:

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

    r7198 r7199  
    4545  this->setClassID(CL_EXECUTOR, "Executor");
    4646
    47 
    4847  // What Parameters have we got
    4948  this->defaultValue[0] = param0;
     
    5352  this->defaultValue[4] = param4;
    5453
     54  this->paramCount = 0;
    5555  for (unsigned int i = 0; i < FUNCTOR_MAX_ARGUMENTS; i++)
    5656  {
     
    6161    }
    6262  }
    63   assert (paramCount <= FUNCTOR_MAX_ARGUMENTS);
    6463}
    6564
     
    109108  {
    110109    if (*value[i] != MT_NULL)
    111     {
    112       if (this->defaultValue[i].getType() == value[i]->getType())
    113       {
    114         this->defaultValue[i] = *value[i];
    115       }
    116       else
    117       {
    118         PRINTF(1)("Unable to set this Value, as it is not of type %s\n", MultiType::MultiTypeToString(this->defaultValue[i].getType()));
    119       }
    120     }
     110        this->defaultValue[i].setValueOf(*value[i]);
    121111  }
    122112  return this;
  • trunk/src/lib/util/executor/executor.h

    r7198 r7199  
    1313#include "substring.h"
    1414#include "functor_list.h" //< MUST BE INCLUDED HERE AT LEAST ONCE.
    15 
    16 #include <stdarg.h>
    1715
    1816//! an enumerator for the definition of the Type.
     
    8987#define   l_FLOAT_DEFGRAB(i)        this->defaultValue[i].getFloat()
    9088//! where to chek for default STRING values
    91 #define   l_STRING_DEFGRAB(i)       this->defaultValue[i].getString()
     89#define   l_CSTRING_DEFGRAB(i)      this->defaultValue[i].getCString()
    9290
    9391//////////////////////////
  • trunk/src/lib/util/executor/functor_list.h

    r5995 r7199  
    2121   l_SHORT:     short
    2222   l_FLOAT:     float
    23    l_STRING:    const char*
     23   l_CSTRING:    const char*
    2424   l_XML_ELEM:  TiXmlElement*
    2525 */
     
    6060// #define l_SHORT_FUNC       atoi                 //!< The function to parse a SHORT
    6161// #define l_SHORT_NAME       "short"              //!< The name of a SHORT
    62 //#define l_SHORT_PARAM       ParameterShort       //!< the type of the parameter SHORT
     62// #define l_SHORT_PARAM      ParameterShort       //!< the type of the parameter SHORT
    6363// #define l_SHORT_DEFAULT    0                    //!< a default Value for a SHORT
    6464
     
    7474//#define l_VECTOR_DEFAULT   Vector(0,0,0)        //!< Default value for a VECTOR
    7575
    76 #define l_STRING_TYPE      const char*          //!< The type of a STRING
     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
     82#define l_STRING_TYPE      const std::string&   //!< The type of a STRING
    7783#define l_STRING_FUNC      isString             //!< The function to parse a STRING
    7884#define l_STRING_NAME      "string"             //!< The name of a STRING
     
    9399  FUNCTOR_LIST(0)();
    94100  //! makes functions with one string
    95   FUNCTOR_LIST(1)(l_STRING);
     101  FUNCTOR_LIST(1)(l_CSTRING);
    96102  //! makes functions with two strings
    97   FUNCTOR_LIST(2)(l_STRING, l_STRING);
     103  FUNCTOR_LIST(2)(l_CSTRING, l_CSTRING);
    98104  //! makes functions with three strings
    99   FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING);
     105  FUNCTOR_LIST(3)(l_CSTRING, l_CSTRING, l_CSTRING);
    100106  //! makes functions with four strings
    101   FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING);
     107  FUNCTOR_LIST(4)(l_CSTRING, l_CSTRING, l_CSTRING, l_CSTRING);
    102108
    103109  //! makes functions with one bool
     
    135141
    136142  //! mixed values:
    137   FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
     143  FUNCTOR_LIST(2)(l_CSTRING, l_FLOAT);
    138144  FUNCTOR_LIST(2)(l_UINT, l_LONG);
    139   FUNCTOR_LIST(2)(l_STRING, l_UINT);
     145  FUNCTOR_LIST(2)(l_CSTRING, l_UINT);
    140146
    141   FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT);
     147  FUNCTOR_LIST(3)(l_CSTRING, l_FLOAT, l_UINT);
    142148
    143149
Note: See TracChangeset for help on using the changeset viewer.