event
| Type | Class |
| Namespace | conjure::core |
| Include File Path | engine/include/conjure/core/event.h |
| Source File Path | engine/src/core/time/event.cpp |
| API ↗ | Time, events and random |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | event() = default; | |
| public | event(
event &&) noexcept = default; |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~event() = default; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mState | std::shared_ptr<state> | std:: |
Functions
Public
emit
emitvoid emit(
Args... args) const;Invokes every live handler in subscription order. Safe to call re-entrantly from a handler, and safe even when a handler destroys this event.
subscribe
subscribe[[nodiscard]] event_subscription subscribe(
handler_type handler);Registers a handler. The handler runs until the returned subscription is released or destroyed. An empty handler asserts and yields an inactive subscription.
subscriber_count
subscriber_count[[nodiscard]] usize subscriber_count() const noexcept;Number of live subscriptions, including ones made during a running emit.
Private
ensure_state
ensure_statevoid ensure_state();