|
Last change
on this file since 4921 was
4872,
checked in by bensch, 20 years ago
|
|
orxonox/trunk: debug-information for EventSystem
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file event_handler.h |
|---|
| 3 | * Definition of the EventHandler |
|---|
| 4 | |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef _EVENT_HANDLER_H |
|---|
| 8 | #define _EVENT_HANDLER_H |
|---|
| 9 | |
|---|
| 10 | #include "base_object.h" |
|---|
| 11 | #include "key_mapper.h" |
|---|
| 12 | #include "event_def.h" |
|---|
| 13 | |
|---|
| 14 | // FORWARD DECLARATION |
|---|
| 15 | class EventListener; |
|---|
| 16 | template <class T> class tList; |
|---|
| 17 | class IniParser; |
|---|
| 18 | |
|---|
| 19 | //! The one Event Handler from Orxonox |
|---|
| 20 | class EventHandler : public BaseObject { |
|---|
| 21 | |
|---|
| 22 | public: |
|---|
| 23 | virtual ~EventHandler(); |
|---|
| 24 | /** @returns a Pointer to the only object of this Class */ |
|---|
| 25 | inline static EventHandler* getInstance() { if (!singletonRef) singletonRef = new EventHandler(); return singletonRef; }; |
|---|
| 26 | void init(IniParser* iniParser); |
|---|
| 27 | |
|---|
| 28 | void setState(elState state); |
|---|
| 29 | |
|---|
| 30 | void subscribe(EventListener* el, elState state, int eventType); |
|---|
| 31 | void unsubscribe(elState state, int eventType); |
|---|
| 32 | void unsubscribe(EventListener* el, elState state = ES_ALL); |
|---|
| 33 | void flush(elState state); |
|---|
| 34 | |
|---|
| 35 | void process(); |
|---|
| 36 | |
|---|
| 37 | void debug() const; |
|---|
| 38 | |
|---|
| 39 | private: |
|---|
| 40 | EventHandler(); |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | private: |
|---|
| 44 | static EventHandler* singletonRef; //!< the singleton reference |
|---|
| 45 | |
|---|
| 46 | EventListener*** listeners; //!< a list of registered listeners |
|---|
| 47 | elState state; //!< the state of the event handlder |
|---|
| 48 | KeyMapper* keyMapper; //!< reference to the key mapper |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | #endif /* _EVENT_HANDLER_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.