Base class for the event system. More...
#include <event.h>

Public Types | |
| using | Type = uint32_t |
| Integer type used to identify event kinds. | |
Public Member Functions | |
| Event (Type type) | |
| Constructs an Event with the given type. | |
| virtual | ~Event ()=default |
| Virtual destructor. | |
| Type | type () const |
| Returns the type identifier for this event. | |
| bool | isAccepted () const |
| Returns whether this event has been accepted. | |
| void | accept () |
| Marks the event as accepted. | |
| void | ignore () |
| Marks the event as ignored (not accepted). | |
Static Public Member Functions | |
| static Type | registerType () |
| Allocates and returns a unique event type ID. | |
Static Public Attributes | |
| static constexpr Type | InvalidType = 0 |
| Sentinel value representing an invalid or unset event type. | |
| static const Type | Timer |
| Event type for TimerEvent. | |
| static const Type | DeferredCall |
| Event type for deferred callable delivery. | |
| static const Type | SignalEvent |
| Event type for cross-thread signal dispatch. | |
| static const Type | Quit |
| Event type requesting an EventLoop to quit. | |
Base class for the event system.
Events carry a type identifier and an accepted/ignored state. Type IDs are allocated at runtime by registerType(), which uses a lock-free atomic counter so that registration is thread-safe and zero-overhead at dispatch time (integer comparison).
Built-in event types (Timer, DeferredCall, Signal, Quit) are registered as file-scope statics in event.cpp. User-defined types should be registered with Event::registerType().
|
inline |
Constructs an Event with the given type.
| type | The event type identifier. |
|
inline |
Marks the event as accepted.
An accepted event will not be propagated further by the event delivery machinery.
|
inline |
Marks the event as ignored (not accepted).
An ignored event may be propagated to a parent handler.
|
inline |
Returns whether this event has been accepted.
true if accepted, false if ignored. Allocates and returns a unique event type ID.
Each call returns a new, never-before-used ID. Thread-safe.
|
inline |
Returns the type identifier for this event.