Elma
An event loop manager for embedded systems
Public Member Functions | List of all members
elma::Event Class Reference

Events that can be emitted, watched, and responded to with event handlers. More...

#include <event.h>

Public Member Functions

 Event (std::string name, json value)
 
 Event (std::string name)
 
json value () const
 
bool empty () const
 
std::string name () const
 
bool propagate () const
 
void stop_propagation ()
 
void reset ()
 Turn propagation back on.
 

Detailed Description

Events that can be emitted, watched, and responded to with event handlers.

Events are constructed with a jsonable value, as in

Event(3.14);
Event("hello world");
Event({1,2,3});

See https://github.com/nlohmann/json for details about how to define and manipulated json values.

Definition at line 23 of file event.h.

Constructor & Destructor Documentation

◆ Event()

elma::Event::Event ( std::string  name,
json  value 
)
inline

Construct a new event

Parameters
valueA json object

Definition at line 29 of file event.h.

Member Function Documentation

◆ empty()

bool elma::Event::empty ( ) const
inline

Determine whether the event has no data

Returns
Whether the event has no data

Definition at line 38 of file event.h.

◆ name()

std::string elma::Event::name ( ) const
inline
Returns
Whether the event has no data

Definition at line 41 of file event.h.

◆ propagate()

bool elma::Event::propagate ( ) const
inline

Determine whether the event will propagate to the next event handler

Returns
True or false

Definition at line 45 of file event.h.

◆ stop_propagation()

void elma::Event::stop_propagation ( )
inline

Prevent the event from propagating to the next event handler. Typically called within an event handler to prevent an subsequent events that are watching the same event from firing. See the Manager methods emit() and watch().

Definition at line 50 of file event.h.

◆ value()

json elma::Event::value ( ) const
inline

Get the data value associated with an event

Returns
The value

Definition at line 34 of file event.h.


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