Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9734 in orxonox.OLD for branches/new_class_id


Ignore:
Timestamp:
Sep 15, 2006, 3:55:51 PM (18 years ago)
Author:
bensch
Message:

new_class_id: better constructs for the Executor.

Location:
branches/new_class_id/src/lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/shell/shell_command.cc

    r9728 r9734  
    2020
    2121#include "compiler.h"
     22#include "helper_functions.h"
    2223#include "debug.h"
    2324
  • branches/new_class_id/src/lib/shell/shell_completion.cc

    r9715 r9734  
    2222#include "shell_command.h"
    2323
    24 #include "substring.h"
     24#include "helper_functions.h"
    2525#include "debug.h"
    2626
  • branches/new_class_id/src/lib/shell/shell_completion_plugin.cc

    r9697 r9734  
    2121#include "shell_command.h"
    2222
    23 #include "substring.h"
     23#include "helper_functions.h"
    2424#include "loading/resource_manager.h"
    2525
  • branches/new_class_id/src/lib/util/executor/executor.h

    r9733 r9734  
    105105  virtual Executor<CallType>* clone () const = 0;
    106106
     107
    107108protected:
    108   Executor(bool hasRetVal,
    109            const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,
    110            const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,
    111            const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,
    112            const MultiType& param6 = MT_NULL)
    113       : bRetVal(hasRetVal)
    114   {
    115     // What Parameters have we got
     109  //! Now follows a List of Executor Constructors, to be fast in creating.
     110  Executor(bool hasRetVal, FunctionType functionType = FunctionDefault)
     111  : bRetVal(hasRetVal), paramCount(0), functionType(functionType)
     112  { };
     113
     114  Executor(bool hasRetVal, const MultiType& param0,
     115           FunctionType functionType = FunctionDefault)
     116  : bRetVal(hasRetVal), paramCount(1), functionType(functionType)
     117  {
     118    this->defaultValue[0] = param0;
     119  };
     120
     121  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
     122           FunctionType functionType = FunctionDefault)
     123  : bRetVal(hasRetVal), paramCount(2), functionType(functionType)
     124  {
     125    this->defaultValue[0] = param0;
     126    this->defaultValue[1] = param1;
     127  };
     128
     129  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
     130           const MultiType& param2,
     131           FunctionType functionType = FunctionDefault)
     132  : bRetVal(hasRetVal), paramCount(3), functionType(functionType)
     133  {
     134    this->defaultValue[0] = param0;
     135    this->defaultValue[1] = param1;
     136    this->defaultValue[2] = param2;
     137  };
     138
     139  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
     140           const MultiType& param2, const MultiType& param3,
     141           FunctionType functionType = FunctionDefault)
     142  : bRetVal(hasRetVal), paramCount(4), functionType(functionType)
     143  {
     144    this->defaultValue[0] = param0;
     145    this->defaultValue[1] = param1;
     146    this->defaultValue[2] = param2;
     147    this->defaultValue[3] = param3;
     148  };
     149
     150  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
     151           const MultiType& param2, const MultiType& param3,
     152           const MultiType& param4,
     153           FunctionType functionType = FunctionDefault)
     154  : bRetVal(hasRetVal), paramCount(5), functionType(functionType)
     155  {
     156    this->defaultValue[0] = param0;
     157    this->defaultValue[1] = param1;
     158    this->defaultValue[2] = param2;
     159    this->defaultValue[3] = param3;
     160    this->defaultValue[4] = param4;
     161  };
     162
     163  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
     164           const MultiType& param2, const MultiType& param3,
     165           const MultiType& param4, const MultiType& param5,
     166           FunctionType functionType = FunctionDefault)
     167  : bRetVal(hasRetVal), paramCount(6), functionType(functionType)
     168  {
     169    this->defaultValue[0] = param0;
     170    this->defaultValue[1] = param1;
     171    this->defaultValue[2] = param2;
     172    this->defaultValue[3] = param3;
     173    this->defaultValue[4] = param4;
     174    this->defaultValue[5] = param5;
     175  };
     176
     177  Executor(bool hasRetVal, const MultiType& param0, const MultiType& param1,
     178           const MultiType& param2, const MultiType& param3,
     179           const MultiType& param4, const MultiType& param5,
     180           const MultiType& param6,
     181           FunctionType functionType = FunctionDefault)
     182  : bRetVal(hasRetVal), paramCount(7), functionType(functionType)
     183  {
    116184    this->defaultValue[0] = param0;
    117185    this->defaultValue[1] = param1;
     
    121189    this->defaultValue[5] = param5;
    122190    this->defaultValue[6] = param6;
    123 
    124     this->paramCount = 0;
    125     for (unsigned int i = 0; i <= EXECUTOR_MAX_ARGUMENTS; i++)
    126     {
    127       if (this->defaultValue[i] == MT_NULL || i == EXECUTOR_MAX_ARGUMENTS)
    128       {
    129         this->paramCount = i;
    130         break;
    131       }
    132       else
    133         this->defaultValue[i].storeString();
    134     }
    135   }
    136 
    137 
     191  };
    138192
    139193protected:
     194  const bool                  bRetVal;          //!< True if the Executor has a return Value.
    140195  unsigned int                paramCount;       //!< the count of parameters.
    141196  MultiType                   defaultValue[7];  //!< Default Values.
    142197
    143   FunctionType          functionType;     //!< What Type of Function it is.
    144 private:
    145   const bool                  bRetVal;          //!< True if the Executor has a return Value.
     198  const FunctionType          functionType;     //!< What Type of Function it is.
    146199};
    147200
  • branches/new_class_id/src/lib/util/executor/executor_functional.cc

    r9730 r9734  
    1515
    1616#include "executor_functional.h"
     17#include "helper_functions.h"
    1718
    1819template<> bool fromString<bool>(const std::string& input, bool defaultValue) { return isBool(input, defaultValue); };
  • branches/new_class_id/src/lib/util/executor/executor_functional.h

    r9733 r9734  
    140140      : Executor<CallType>(false)
    141141  {
    142     this->functionType = Executor<CallType>::FunctionDefault;
    143142    this->functionPointer = functionPointer;
    144143  };
     
    185184      : Executor<CallType>(false, ExecutorParamType<type0>())
    186185  {
    187     this->functionType = Executor<CallType>::FunctionDefault;
    188186    this->functionPointer = functionPointer;
    189187  };
     
    229227      : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>())
    230228  {
    231     this->functionType = Executor<CallType>::FunctionDefault;
    232229    this->functionPointer = functionPointer;
    233230  };
     
    275272      : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
    276273  {
    277     this->functionType = Executor<CallType>::FunctionDefault;
    278274    this->functionPointer = functionPointer;
    279275  };
     
    323319      : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>())
    324320  {
    325     this->functionType = Executor<CallType>::FunctionDefault;
    326321    this->functionPointer = functionPointer;
    327322  };
     
    372367      : Executor<CallType>(false, ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>(), ExecutorParamType<type3>(), ExecutorParamType<type4>())
    373368  {
    374     this->functionType = Executor<CallType>::FunctionDefault;
    375369    this->functionPointer = functionPointer;
    376370  };
  • branches/new_class_id/src/lib/util/executor/executor_lua.h

    r9733 r9734  
    5151  {
    5252    this->functionPointer = function;
    53     this->functionType = Executor<lua_State*>::FunctionDefault;
    5453  }
    5554
     
    8887  {
    8988    this->functionPointer = function;
    90     this->functionType = Executor<lua_State*>::FunctionDefault;
    9189  }
    9290
     
    124122  {
    125123    this->functionPointer = function;
    126     this->functionType = Executor<lua_State*>::FunctionDefault;
    127124  }
    128125
     
    161158  {
    162159    this->functionPointer = function;
    163     this->functionType = Executor<lua_State*>::FunctionDefault;
    164160  }
    165161
     
    200196  {
    201197    this->functionPointer = function;
    202     this->functionType = Executor<lua_State*>::FunctionDefault;
    203198  }
    204199
     
    246241  {
    247242    this->functionPointer = function;
    248     this->functionType = Executor<lua_State*>::FunctionDefault;
    249243  }
    250244
     
    282276  {
    283277    this->functionPointer = function;
    284     this->functionType = Executor<lua_State*>::FunctionDefault;
    285278  }
    286279
     
    317310  {
    318311    this->functionPointer = function;
    319     this->functionType = Executor<lua_State*>::FunctionDefault;
    320312  }
    321313
     
    354346  {
    355347    this->functionPointer = function;
    356     this->functionType = Executor<lua_State*>::FunctionDefault;
    357348  }
    358349
     
    392383  {
    393384    this->functionPointer = function;
    394     this->functionType = Executor<lua_State*>::FunctionDefault;
    395385  }
    396386
     
    430420  {
    431421    this->functionPointer = function;
    432     this->functionType = Executor<lua_State*>::FunctionDefault;
    433422  }
    434423
     
    471460  {
    472461    this->functionPointer = function;
    473     this->functionType = Executor<lua_State*>::FunctionDefault;
    474462  }
    475463
     
    514502  {
    515503    this->functionPointer = function;
    516     this->functionType = Executor<lua_State*>::FunctionDefault;
    517504  }
    518505
  • branches/new_class_id/src/lib/util/executor/executor_xml.h

    r9733 r9734  
    4040    this->paramName = paramName;
    4141    this->functionPointer = function;
    42     this->functionType = FunctionDefault;
    4342  }
    4443
Note: See TracChangeset for help on using the changeset viewer.