8 #ifndef EVENTDISPATCHER_H_
9 #define EVENTDISPATCHER_H_
34 : _dispatcher(dispatcher) { };
36 virtual ~EventProcessorImpl() { };
38 void process(
const Event *evt)
41 for (std::list<EventReceiver*>::iterator iter = _dispatcher._receivers.begin();
42 iter != _dispatcher._receivers.end(); ++iter)
48 _dispatcher._stat_count++;
62 void _raise(
Event *evt,
bool detach)
66 _processor.process(evt);
81 _receivers.push_back(receiver);
86 for (std::list<EventReceiver*>::iterator iter = _receivers.begin(); iter != _receivers.end(); ++iter)
88 if ((*iter) == receiver)
90 _receivers.erase(iter);
107 static void raise(
Event *evt,
bool detach =
true) {
108 instance()._raise(evt, detach);
112 instance()._add(receiver);
116 instance()._remove(receiver);
124 return instance()._stat_count;
129 std::list<EventReceiver*> _receivers;
130 EventProcessorImpl _processor;