Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2006, 6:25:19 PM (19 years ago)
Author:
bensch
Message:

EVENTS WORK :)

File:
1 edited

Legend:

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

    r7725 r7985  
    3333template<> MT_Type ExecutorParamType<const std::string&>();
    3434
    35 template<typename type> type fromString(const std::string& input, type defaultValue) {return defaultValue; };
     35template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; };
    3636template<> bool fromString<bool>(const std::string& input, bool defaultValue);
    3737template<> int fromString<int>(const std::string& input, int defaultValue);
     
    4040template<> char fromString<char>(const std::string& input, char defaultValue);
    4141template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue);
     42
     43template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ };
     44template<> bool fromMulti<bool>(const MultiType& multi);
     45template<> int fromMulti<int>(const MultiType& multi);
     46template<> unsigned int fromMulti<unsigned int>(const MultiType& multi);
     47template<> float fromMulti<float>(const MultiType& multi);
     48template<> char fromMulti<char>(const MultiType& multi);
     49template<> const std::string& fromMulti<const std::string&>(const MultiType& multi);
     50
    4251
    4352template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; };
     
    8190#endif /* EXECUTOR_FUNCTIONAL_USE_STATIC */
    8291
     92///////////
     93//// 0 ////
     94///////////
    8395//! @brief ExecutorClass, that can execute Functions without any parameters.
    8496template<class T> class __EXECUTOR_FUNCTIONAL_NAME(0) : public Executor
     
    110122  };
    111123
     124  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     125  {
     126    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)();
     127  }
     128
    112129  /**
    113130   * @brief copies the Executor
     
    120137};
    121138
     139
     140
     141///////////
     142//// 1 ////
     143///////////
    122144//! @brief ExecutorClass, that can execute Functions with one parameter.
    123145template<class T, typename type0> class __EXECUTOR_FUNCTIONAL_NAME(1) : public Executor
     
    138160    this->functionPointer = functionPointer;
    139161  };
     162
     163  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     164  {
     165    switch(count)
     166    {
     167      case 0:
     168        return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(fromMulti<type0>(this->defaultValue[0]));
     169      default:
     170       return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(fromMulti<type0>(values[0]));
     171    }
     172  }
     173
    140174
    141175  /**
     
    166200};
    167201
     202///////////
     203//// 2 ////
     204///////////
    168205//! @brief ExecutorClass, that can execute Functions with two parameters.
    169206template<class T, typename type0, typename type1> class __EXECUTOR_FUNCTIONAL_NAME(2) : public Executor
     
    197234  };
    198235
     236  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     237  {
     238  }
     239
    199240  /**
    200241   * @brief copies the Executor
     
    208249
    209250
     251///////////
     252//// 3 ////
     253///////////
    210254//! @brief ExecutorClass, that can execute Functions with three parameters.
    211255template<class T, typename type0, typename type1, typename type2> class __EXECUTOR_FUNCTIONAL_NAME(3) : public Executor
     
    240284  };
    241285
     286  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     287  {
     288  }
     289
    242290  /**
    243291   * @brief copies the Executor
     
    252300
    253301
     302///////////
     303//// 4 ////
     304///////////
    254305//! @brief ExecutorClass, that can execute Functions with four parameters.
    255306template<class T, typename type0, typename type1, typename type2, typename type3> class __EXECUTOR_FUNCTIONAL_NAME(4) : public Executor
     
    285336  };
    286337
     338  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     339  {
     340  }
     341
    287342  /**
    288343   * @brief copies the Executor
     
    295350};
    296351
     352
     353
     354///////////
     355//// 5 ////
     356///////////
    297357//! @brief ExecutorClass, that can execute Functions with five parameters.
    298358template<class T, typename type0, typename type1, typename type2, typename type3, typename type4> class __EXECUTOR_FUNCTIONAL_NAME(5) : public Executor
     
    329389  };
    330390
     391  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
     392  {
     393  }
     394
    331395  /**
    332396   * @brief copies the Executor
Note: See TracChangeset for help on using the changeset viewer.