FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
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.
 

Protected Member Functions

 EventHandler (const EventHandler< EVENT > &)=default
 
EventHandler< EVENT > & operator= (const EventHandler< EVENT > &)=default
 
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 285 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 313 of file events.h.

Member Function Documentation

◆ 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

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