19#ifndef LM_EVENTDISPATCHER__
20#define LM_EVENTDISPATCHER__
44class EventDispatcher {
49 std::list<IEventListener*> listeners;
59 EventDispatcher(
const EventDispatcher& other);
64 virtual ~EventDispatcher();
69 EventDispatcher& operator=(
const EventDispatcher& other);
94 this->listeners.push_back(listener);
128 virtual void clear();
145 return this->listeners.size();
154 return (!this->listeners.empty());
virtual bool hasListeners()
Tells whether there are listeners for events.
virtual void clear()
Clears all the IEventListeners from the EventDispatcher.
virtual void raise(IEvent &event)
Raises an IEvent, causing it to be dispatched to each registered IEventListener.
static EventDispatcher & instance()
An instance retrieval method that follows the Singleton pattern.
virtual IEventListener & getAt(int idx)
Returns the IEventListener at a specified index.
virtual void addListener(IEventListener *listener)
Adds an IEventListener to the list.
virtual int countListeners() const
Counts the number of registered listeners.
virtual void removeListener(int idx)
Removes an IEventListener from the list.
static uint32_t idx[BOARD_NUM]
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.