Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7990 in orxonox.OLD


Ignore:
Timestamp:
May 30, 2006, 9:07:10 PM (18 years ago)
Author:
bensch
Message:

gui: all up to 5 opts are accepted

Location:
branches/gui/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl_gui/signal_connector.cc

    r7985 r7990  
    6464  }
    6565
     66  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1) const
     67  {
     68    if (exec != NULL && object != NULL)
     69    {
     70      MultiType mt[] = { value0, value1 };
     71      (*this->exec)(this->object, 2, mt);
     72    }
     73  }
     74
     75  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2) const
     76  {
     77    if (exec != NULL && object != NULL)
     78    {
     79      MultiType mt[] = { value0, value1, value2 };
     80      (*this->exec)(this->object, 3, mt);
     81    }
     82  }
     83
     84  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3) const
     85  {
     86    if (exec != NULL && object != NULL)
     87    {
     88      MultiType mt[] = { value0, value1, value2, value3 };
     89      (*this->exec)(this->object, 4, mt);
     90    }
     91  }
     92
     93  void SignalConnector::operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3, const MultiType& value4) const
     94  {
     95    if (exec != NULL && object != NULL)
     96    {
     97      MultiType mt[] = { value0, value1, value2, value3, value4 };
     98      (*this->exec)(this->object, 5, mt);
     99    }
     100  }
    66101}
  • branches/gui/src/lib/gui/gl_gui/signal_connector.h

    r7985 r7990  
    4040
    4141  /**
    42  * @brief declares a new Signal.
    43  * @param SignalName the Name of the Signal.
     42   * @brief declares a new Signal.
     43   * @param SignalName the Name of the Signal.
    4444   */
    4545#define DeclareSignal1(SignalName, param0) \
     
    4949       SignalName ## connected[i] (val0); \
    5050    }\
     51    DeclareSignalEnd(SignalName)
     52
     53  /**
     54 * @brief declares a new Signal.
     55 * @param SignalName the Name of the Signal.
     56   */
     57#define DeclareSignal2(SignalName, param0, param1) \
     58  DeclareSignalBegin(SignalName) \
     59   void  SignalName (param0 val0, param1 val1) { \
     60     for (unsigned int i = 0; i < SignalName ## connected .size(); i++) \
     61       SignalName ## connected[i] (val0, val1); \
     62}\
    5163    DeclareSignalEnd(SignalName)
    5264
     
    8597    void operator()() const;
    8698    void operator()(const MultiType& value0) const;
     99    void operator()(const MultiType& value0, const MultiType& value1) const;
     100    void operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2) const;
     101    void operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3) const;
     102    void operator()(const MultiType& value0, const MultiType& value1, const MultiType& value2, const MultiType& value3, const MultiType& value4) const;
    87103
    88104    bool isValid() const { return (this->object && this->exec); };
  • branches/gui/src/lib/util/executor/executor_functional.h

    r7985 r7990  
    163163  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    164164  {
    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     }
     165    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     166             fromMulti<type0>((count > 0)? values[0] : this->defaultValue[0]) );
    172167  }
    173168
     
    180175  virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const
    181176  {
    182 
    183     /* // THE VERY COOL DEBUG
    184       printf("SUB[0] : %s\n", sub[0].c_str());
    185       printf("getDefault<type0>(this->defaultValue, 0):::: %d\n", getDefault<type0>(this->defaultValue, 0));
    186       printf("VALUE: %d\n", fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)));
    187     */
    188177    (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
    189178      fromString<type0>(sub[0], getDefault<type0>(this->defaultValue, 0)) );
     
    236225  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    237226  {
     227    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     228             fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
     229             fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]) );
    238230  }
    239231
     
    286278  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    287279  {
     280    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     281             fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
     282             fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),
     283             fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]) );
    288284  }
    289285
     
    338334  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    339335  {
     336    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     337             fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
     338             fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),
     339             fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]),
     340             fromMulti<type3>((count > 3) ? values[3] : this->defaultValue[3]) );
    340341  }
    341342
     
    391392  virtual void operator()(BaseObject* object, unsigned int count, const MultiType* values) const
    392393  {
     394    return (__EXECUTOR_FUNCTIONAL_FUNCTION_EXEC)(
     395             fromMulti<type0>((count > 0) ? values[0] : this->defaultValue[0]),
     396             fromMulti<type1>((count > 1) ? values[1] : this->defaultValue[1]),
     397             fromMulti<type2>((count > 2) ? values[2] : this->defaultValue[2]),
     398             fromMulti<type3>((count > 3) ? values[3] : this->defaultValue[3]),
     399             fromMulti<type4>((count > 4) ? values[4] : this->defaultValue[4]) );
    393400  }
    394401
Note: See TracChangeset for help on using the changeset viewer.