Event Lifecycle
Extend and customise events as they move across SnowFox.
DrainEnqueueArg
Passed to event::drain::enqueue
events to provide access to:
void add()
: Marks the drain as added to the loop manager.bool added()
: returnsfalse
if the drain was already in the loop manager.std::string drain()
: Returns the id of the drain that triggered the event.
EventLifecycleArg
The EventLifecycleArg
is a BaseLifecycleArg
that stores
a reference to an Event
instance.
It is passed to event::*
lifecycle events that require an
Event
instance to operate on.
event::_identify
A special step in the lifecycle of an event that is triggered
just after an event is created but before the event::initialise
step.
This step generates the id (and possibly the correlation id) of an
Event
instance.
The Event
reference to operate on is passed to the handler in an
EventLifecycleArg
instance.
Every component that instantiates an object should use the
sf::core::lifecycle::EventLifecycle::Init
method to ensure the
event is initialised correctly.
event::drain::enqueue
Triggered by EventDrains when data is enqueued to be sent.
Used to automatically add drains that need to be flushed to the
current LoopManager
and to keep track of enqueue operations.
event::initialise
This step is triggered when an Event
is initialised and identified.
The Event
reference to operate on is passed to the handler in an
EventLifecycleArg
instance.
Every component that instantiates an object should use the
sf::core::lifecycle::Event::Initialise
method to ensure the
event is initialised correctly.