Contents

class

SushiEngine::EventBus::Bus

Owns every channel of one host and delivers pending events phase by phase.

Declared in
engine/foundation/event_bus/include/SushiEngine/event_bus/bus.hpp
Inherits
SushiEngine::EventBus::IBus

Every IBus virtual is noexcept, so a throwing handler or an allocation failure inside the bus terminates rather than propagate. A phase with a subscriber must be drained every frame, or end_frame cannot advance that channel's trim point.

Public Methods

Bus

Constructs an empty bus bound to the calling thread as main thread.

~Bus
operator=
register_channel

Registers the channel for one event type, or returns the existing one.

find_channel

Finds the channel registered for id.

publish

Appends event to channel for the next drain of each phase.

publish_immediate

Calls every live subscriber of the channel now, on the main thread.

subscribe

Adds a subscriber that the drain of its phase calls per batch.

unsubscribe

Removes one subscription; no call reaches it after this returns.

unsubscribe_owner

Removes every subscription owner made.

has_subscribers

Whether channel currently has at least one live subscriber.

drain

Delivers every event phase has not seen, channel by channel.

end_frame

Drops every event that each phase with a subscriber has seen.

statistics

Returns the counters since the last reset.

reset_statistics

Zeroes the counters.