Defines the Event structure and related utilities for event messaging.
More...
#include <cstdint>
#include <cstddef>
#include <type_traits>
#include <string>
#include "events/Notification.h"
#include "events/GpioEvent.h"
Go to the source code of this file.
|
struct | Event |
| Represents a framework event, optionally carrying payload data. More...
|
|
|
template<typename Enum , typename T > |
Event | userEvent (Enum e, const T &data) |
| Helper to create a user-defined Event with a payload.
|
|
template<typename Enum > |
Event | userEvent (Enum e, const char *data, size_t size) |
|
- Version
- 1.1
- Date
- 2025-04-22
- Copyright
- Copyright (c) 2025, Ian Archbell
- License:\n MIT
Definition in file Event.h.
◆ userEvent() [1/2]
template<typename Enum >
Event userEvent |
( |
Enum |
e, |
|
|
const char * |
data, |
|
|
size_t |
size |
|
) |
| |
|
inline |
Definition at line 119 of file Event.h.
119 {
120 static_assert(std::is_enum<Enum>::value, "Enum type required");
121 return Event(
static_cast<uint8_t
>(e), data, size);
122}
Represents a framework event, optionally carrying payload data.
◆ userEvent() [2/2]
template<typename Enum , typename T >
Event userEvent |
( |
Enum |
e, |
|
|
const T & |
data |
|
) |
| |
|
inline |
- Template Parameters
-
Enum | The enum type. |
T | The data type of the payload. |
- Parameters
-
e | The enum value. |
data | The data to attach. |
- Returns
- Event The constructed user event with payload.
Definition at line 114 of file Event.h.
114 {
115 return Event(
static_cast<uint8_t
>(e), &data,
sizeof(T));
116}