Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::EventHandler Concept Referenceexport

A callable that can handle events of a specific type. More...

#include <event.h>

Concept definition

template<typename H, typename E>
concept kcenon::common::concepts::EventHandler = std::invocable<H, const E&> &&
std::is_void_v<std::invoke_result_t<H, const E&>>
A callable that can handle events of a specific type.
Definition event.h:71

Detailed Description

A callable that can handle events of a specific type.

Event handlers receive events by const reference and return void. They should not throw exceptions to avoid disrupting event dispatch.

Example usage:

template<EventType E, EventHandler<E> H>
uint64_t subscribe(H&& handler) {
return event_bus.subscribe<E>(std::forward<H>(handler));
}
uint64_t subscribe(HandlerFunc &&func)
Subscribe to events of a specific type.
Definition event_bus.h:281
simple_event_bus event_bus
Definition event_bus.h:443

Definition at line 71 of file event.h.