Struct EventSystem

Inheritance Relationships

Base Type

Struct Documentation

struct EventSystem : public CE::State::Singleton<EventSystem>

Global access to the default persistent event bus.

Independent owned buses may isolate a subsystem or application lifecycle; all buses use immediate producer-thread delivery unless explicitly adapted.

Public Types

using Callback = ::CE::Events::EventBus::Callback

Default-bus alias with the identical EventBus::Callback contract.

using Registration = ::CE::Events::EventBus::Registration

Default-bus alias with the identical EventBus::Registration contract.

using Delivery = ::CE::Events::EventBus::Delivery

Default-bus alias with the identical EventBus::Delivery contract.

using ErrorHandler = ::CE::Events::EventBus::ErrorHandler

Default-bus alias with the identical EventBus::ErrorHandler contract.

Public Functions

EventSystem() = default

Construct a facade owning its own bus; Singleton access selects the process default facade.

See also

Detailed guide

inline ::CE::Events::EventBus &bus()

Declaration: [[nodiscard]]

Borrow the facade’s bus without changing its delivery thread or listener lifetime.

See also

Detailed guide

Registration register_listener(const std::string &event, Callback callback, Delivery delivery = Delivery{}, ErrorHandler errors = ErrorHandler{})

Forward to the owned bus’s register_listener operation.

See also

CE::Events::EventBus::register_listener The payload, error-delivery, invalidation and wait contracts are identical; global access does not choose a callback thread.

See also

Detailed guide

void dispatch(const std::string &event, const std::any &payload)

Forward to the owned bus’s dispatch operation.

See also

CE::Events::EventBus::dispatch The payload, error-delivery, invalidation and wait contracts are identical; global access does not choose a callback thread.

See also

Detailed guide

template<::CE::Events::EventPayload Payload>
inline Registration register_listener(const ::CE::Events::EventChannel<Payload> &event, typename ::CE::Events::EventChannel<Payload>::Callback callback, Delivery delivery = Delivery{}, ErrorHandler errors = ErrorHandler{})

Register an owned typed listener on the default facade’s bus.

See also

CE::Events::EventBus::register_listener Exact name/type isolation, persistent identifiers and deferred error/capture lifetime are unchanged.

See also

Detailed guide

template<::CE::Events::EventPayload Payload, typename Value>
inline void dispatch(const ::CE::Events::EventChannel<Payload> &event, Value &&payload)

Requires: std::same_as<std::remove_cvref_t<Value>, Payload> && std::is_constructible_v<Payload, Value&&>

Forward exact-type owned payload dispatch to this facade’s bus.

See also

CE::Events::EventBus::dispatch Payload construction, immediate exceptions and deferred error reporting obey the owned bus contract.

See also

Detailed guide

inline bool unregister_listener(const Registration &registration)

Forward to the owned bus’s unregister_listener operation.

See also

CE::Events::EventBus::unregister_listener The payload, error-delivery, invalidation and wait contracts are identical; global access does not choose a callback thread.

See also

Detailed guide

inline void wait_for_listener(const Registration &registration) const

Forward to the owned bus’s wait_for_listener operation.

See also

CE::Events::EventBus::wait_for_listener The payload, error-delivery, invalidation and wait contracts are identical; global access does not choose a callback thread.

See also

Detailed guide

inline bool unregister_and_wait(const Registration &registration)

Forward to the owned bus’s unregister_and_wait operation.

See also

CE::Events::EventBus::unregister_and_wait The payload, error-delivery, invalidation and wait contracts are identical; global access does not choose a callback thread.

See also

Detailed guide