vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::EventSender Class Reference

The sending half of an EventBus: emit and enqueue, and no subscribe. More...

#include <event_bus.h>

Public Member Functions

template<typename EventT>
void emit (const EventT &event)
 Fire event synchronously to every listener now (EventBus::emit).
template<typename EventT>
void enqueue (EventT event)
 Queue event for delivery on the next flush (EventBus::enqueue).

Detailed Description

The sending half of an EventBus: emit and enqueue, and no subscribe.

What Behavior::events() hands a behavior, which must listen through Behavior::subscribe: a listener on the bus itself would outlive the behavior and its module, and a flush after reload would call unmapped code.

Copies freely; valid as long as the bus.

Member Function Documentation

◆ emit()

template<typename EventT>
void Vkm::Engine::EventSender::emit ( const EventT & event)
inline

Fire event synchronously to every listener now (EventBus::emit).

Template Parameters
EventTEvent type.
Parameters
eventPassed to each listener.

◆ enqueue()

template<typename EventT>
void Vkm::Engine::EventSender::enqueue ( EventT event)
inline

Queue event for delivery on the next flush (EventBus::enqueue).

Template Parameters
EventTEvent type.
Parameters
eventEvent to queue; moved in.

The documentation for this class was generated from the following file: