Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
event.h File Reference

C++20 concepts for event bus types. More...

#include <concepts>
#include <type_traits>
#include <functional>
#include <string>
#include <chrono>
Include dependency graph for event.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  kcenon
 
namespace  kcenon::common
 Core interfaces.
 
namespace  kcenon::common::concepts
 C++20 concepts for compile-time type validation.
 

Concepts

concept  kcenon::common::concepts::EventType
 A type that can be used as an event in the event bus.
 
concept  kcenon::common::concepts::EventHandler
 A callable that can handle events of a specific type.
 
concept  kcenon::common::concepts::EventFilter
 A callable that filters events based on criteria.
 
concept  kcenon::common::concepts::TimestampedEvent
 An event type that includes a timestamp.
 
concept  kcenon::common::concepts::NamedEvent
 An event type that includes a module or source name.
 
concept  kcenon::common::concepts::ErrorEvent
 An event type representing an error.
 
concept  kcenon::common::concepts::MetricEvent
 An event type representing a metric measurement.
 
concept  kcenon::common::concepts::ModuleLifecycleEvent
 An event type representing module lifecycle changes.
 
concept  kcenon::common::concepts::FullErrorEvent
 A complete error event with module, message, code, and timestamp.
 
concept  kcenon::common::concepts::FullMetricEvent
 A complete metric event with timestamp.
 
concept  kcenon::common::concepts::EventBusLike
 A type that satisfies the event bus interface requirements.
 

Detailed Description

C++20 concepts for event bus types.

This header provides concepts for validating event types, handlers, and filters used in the event bus system. These concepts enable compile-time validation with clear, actionable error messages.

Requirements:

  • C++20 compiler with concepts support
  • GCC 10+, Clang 10+, MSVC 2022+

Thread Safety:

  • Concepts are evaluated at compile-time only.
  • No runtime thread-safety considerations apply.
See also
event_bus.h for simple_event_bus implementation
https://en.cppreference.com/w/cpp/language/constraints

Definition in file event.h.