FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
Utility to dispatch an event to a list of EventHandler
s that are registered for its type.
More...
#include <fastarduino/events.h>
Public Member Functions | |
Dispatcher (const Dispatcher &)=delete | |
Dispatcher & | operator= (const Dispatcher &)=delete |
void | dispatch (const EVENT &event) |
Dispatch the given event to the right EventHandler , based on the event type. More... | |
Public Member Functions inherited from containers::LinkedList< EventHandler< EVENT > > | |
void | insert (T &item) INLINE |
Insert item at the beginning of this list. More... | |
bool | remove (T &item) INLINE |
Remove item from this list. More... | |
void | traverse (F func) |
Traverse all items of this list and execute f functor. More... | |
Additional Inherited Members | |
Public Types inherited from containers::LinkedList< EventHandler< EVENT > > | |
using | T = EventHandler< EVENT > |
The type of items in this list. More... | |
Utility to dispatch an event to a list of EventHandler
s that are registered for its type.
You first create an EventHandler
subclass, intantiate it and register it to a Dispatcher
; for this, you use containers::LinkedList
API which Dispatcher
derives from.
NOTE: you should never call any Dispatcher
method from an ISR because these methods may last too long for an ISR.
EVENT | the events::Event<T> handled |
|
inline |
Dispatch the given event
to the right EventHandler
, based on the event type.
Note that if several registered EventHandler
s match this event
type, then they will all be called with that event.
event | the event to dispatch to the right event handler |