Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gl_gui/signal_connector.h @ 7952

Last change on this file since 7952 was 7919, checked in by bensch, 19 years ago

orxonox/trunk: merged the gui branche back
merged with command:
https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File size: 1.3 KB
Line 
1/*!
2 * @file signal_connector.h
3 * @brief Definition of a SignalConnector class
4*/
5
6#ifndef _SIGNAL_CONNECTOR_H
7#define _SIGNAL_CONNECTOR_H
8
9#include "executor/executor.h"
10
11namespace OrxGui
12{
13
14#define DeclareSignal(name, params) \
15  public: \
16   void signal_ ##connect ##name(const SignalConnector& connector) { \
17     name ## connected.push_back(connector); \
18   }\
19  private: \
20   void  signal_ ## name params { \
21     for (unsigned int i = 0; i < name ## connected . size(); i++) \
22       name ## connected[i] ("TEST"); \
23   }\
24   std::vector<SignalConnector> name ## connected
25
26  //! A class for Conncting Signals to Objects, inside of the GUI
27  class SignalConnector
28  {
29  public:
30    SignalConnector();
31    SignalConnector(BaseObject* object, const Executor* exec);
32    SignalConnector(const SignalConnector& signalConnector);
33    ~SignalConnector();
34
35    SignalConnector& operator=(const SignalConnector& signalConnector);
36
37    void operator()(const std::string& parameters) const;
38    void execute(const std::string& parameters) const { (*this)(parameters); };
39
40    bool isClean() const { return (this->object == NULL || this->exec == NULL); }
41
42
43  private:
44    BaseObject*          object;         //!< The object to call.
45    const Executor*      exec;           //!< The Executor, that will be called, on object.
46  };
47}
48#endif /* _SIGNAL_CONNECTOR_H */
Note: See TracBrowser for help on using the repository browser.