|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Pure virtual interface for event bus implementation. More...
#include <event_bus_interface.h>


Public Member Functions | |
| virtual | ~interface_event_bus ()=default |
| template<concepts::EventType E> | |
| common::VoidResult | publish_event (const E &event) |
| Publish an event to all subscribers. | |
| template<concepts::EventType E> | |
| common::Result< subscription_token > | subscribe_event (std::function< void(const E &)> handler, event_priority priority=event_priority::normal) |
| Subscribe to events of a specific type. | |
| template<concepts::EventType E, concepts::EventHandler< E > H> | |
| common::Result< subscription_token > | subscribe_event (H &&handler, event_priority priority=event_priority::normal) |
| Subscribe to events with a callable handler. | |
| virtual common::VoidResult | unsubscribe_event (const subscription_token &token)=0 |
| Unsubscribe from events using subscription token. | |
| template<concepts::EventType E> | |
| common::VoidResult | clear_subscriptions () |
| Clear all subscriptions for a specific event type. | |
| template<concepts::EventType E> | |
| size_t | get_subscriber_count () const |
| Get the number of subscribers for an event type. | |
| virtual bool | is_active () const =0 |
| Check if event bus is active. | |
| virtual common::VoidResult | start ()=0 |
| Start the event bus. | |
| virtual common::VoidResult | stop ()=0 |
| Stop the event bus. | |
| virtual size_t | get_pending_event_count () const =0 |
| Get pending event count. | |
| virtual common::VoidResult | process_pending_events ()=0 |
| Process all pending events synchronously. | |
Protected Member Functions | |
| virtual common::VoidResult | publish_event_impl (std::type_index event_type, std::any event)=0 |
| virtual common::Result< subscription_token > | subscribe_event_impl (std::type_index event_type, std::function< void(const std::any &)> handler, uint64_t handler_id, event_priority priority)=0 |
| virtual common::VoidResult | clear_subscriptions_impl (std::type_index event_type)=0 |
| virtual size_t | get_subscriber_count_impl (std::type_index event_type) const =0 |
Pure virtual interface for event bus implementation.
The event bus provides a centralized communication mechanism for loosely coupled components using publish-subscribe pattern. It supports typed events, priority-based handler execution, and subscription management via tokens.
Definition at line 251 of file event_bus_interface.h.
|
virtualdefault |
|
inline |
Clear all subscriptions for a specific event type.
| E | The event type to clear subscriptions for (must satisfy concepts::EventType) |
Definition at line 321 of file event_bus_interface.h.
References clear_subscriptions_impl().

|
protectedpure virtual |
Implemented in kcenon::monitoring::event_bus.
Referenced by clear_subscriptions().

|
pure virtual |
Get pending event count.
Implemented in kcenon::monitoring::event_bus.
|
inline |
Get the number of subscribers for an event type.
| E | The event type to check (must satisfy concepts::EventType) |
Definition at line 331 of file event_bus_interface.h.
References get_subscriber_count_impl().

|
protectedpure virtual |
Implemented in kcenon::monitoring::event_bus.
Referenced by get_subscriber_count().

|
pure virtual |
Check if event bus is active.
Implemented in kcenon::monitoring::event_bus.
|
pure virtual |
Process all pending events synchronously.
Implemented in kcenon::monitoring::event_bus.
|
inline |
Publish an event to all subscribers.
| E | The type of event to publish (must satisfy concepts::EventType) |
| event | The event to publish |
The event type must be a class type and copy-constructible. Using C++20 Concepts provides clear compile-time error messages when these requirements are not met.
Definition at line 266 of file event_bus_interface.h.
References publish_event_impl().

|
protectedpure virtual |
Implemented in kcenon::monitoring::event_bus.
Referenced by publish_event().

|
pure virtual |
Start the event bus.
Implemented in kcenon::monitoring::event_bus.
|
pure virtual |
Stop the event bus.
Implemented in kcenon::monitoring::event_bus.
|
inline |
Subscribe to events with a callable handler.
| E | The type of event to subscribe to (must satisfy concepts::EventType) |
| H | The handler type (must satisfy concepts::EventHandler<E>) |
| handler | The handler callable |
| priority | Priority for handler execution |
This overload accepts any callable that satisfies the EventHandler concept, providing more flexibility than the std::function overload.
Definition at line 303 of file event_bus_interface.h.
References subscribe_event().

|
inline |
Subscribe to events of a specific type.
| E | The type of event to subscribe to (must satisfy concepts::EventType) |
| handler | The handler function for the event |
| priority | Priority for handler execution |
The event type must be a class type and copy-constructible. Using C++20 Concepts provides clear compile-time error messages when these requirements are not met.
Definition at line 282 of file event_bus_interface.h.
References subscribe_event_impl().
Referenced by subscribe_event().


|
protectedpure virtual |
Implemented in kcenon::monitoring::event_bus.
Referenced by subscribe_event().

|
pure virtual |
Unsubscribe from events using subscription token.
| token | The subscription token |
Implemented in kcenon::monitoring::event_bus.