FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
events::EventHandler< EVENT > Class Template Referenceabstract

Abstract event handler, used by Dispatcher to get called back when an event of the expected type is dispatched. More...

#include <fastarduino/events.h>

Inheritance diagram for events::EventHandler< EVENT >:
Collaboration diagram for events::EventHandler< EVENT >:

Public Member Functions

uint8_t type () const INLINE
 The type of event that this handler accepts and can act upon. More...
 

Protected Member Functions

virtual void on_event (const EVENT &event)=0
 This pure virtual method is called by Dispatcher::dispatch() when event.type() matches the type supported by this EventHandler. More...
 
 EventHandler (uint8_t type=Type::NO_EVENT) INLINE
 Create an Event Handler for given type of event. More...
 

Friends

class Dispatcher< EVENT >
 

Additional Inherited Members

Detailed Description

template<typename EVENT>
class events::EventHandler< EVENT >

Abstract event handler, used by Dispatcher to get called back when an event of the expected type is dispatched.

Template Parameters
EVENTthe events::Event<T> dispatched
See also
Dispatcher::dispatch()

Definition at line 287 of file events.h.

Constructor & Destructor Documentation

◆ EventHandler()

template<typename EVENT >
events::EventHandler< EVENT >::EventHandler ( uint8_t  type = Type::NO_EVENT)
inlineexplicitprotected

Create an Event Handler for given type of event.

Parameters
typethe evnt type handled by this handler

Definition at line 317 of file events.h.

Member Function Documentation

◆ type()

template<typename EVENT >
uint8_t events::EventHandler< EVENT >::type ( ) const
inline

The type of event that this handler accepts and can act upon.

Definition at line 295 of file events.h.

◆ on_event()

template<typename EVENT >
virtual void events::EventHandler< EVENT >::on_event ( const EVENT &  event)
protectedpure virtual

This pure virtual method is called by Dispatcher::dispatch() when event.type() matches the type supported by this EventHandler.

Parameters
eventthe event to handle

Friends And Related Function Documentation

◆ Dispatcher< EVENT >

template<typename EVENT >
friend class Dispatcher< EVENT >
friend

Definition at line 320 of file events.h.


The documentation for this class was generated from the following file: