libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <atomic>
11#include <cstdint>
13
15
29class Event {
30 public:
32 using Type = uint32_t;
33
35 static constexpr Type InvalidType = 0;
36
45
47 static const Type Timer;
48
50 static const Type DeferredCall;
51
53 static const Type SignalEvent;
54
56 static const Type Quit;
57
62 Event(Type type) : _type(type) {}
63
65 virtual ~Event() = default;
66
71 Type type() const { return _type; }
72
77 bool isAccepted() const { return _accepted; }
78
85 void accept() { _accepted = true; }
86
92 void ignore() { _accepted = false; }
93
94 private:
95 Type _type;
96 bool _accepted = false;
97};
98
Base class for the event system.
Definition event.h:29
Event(Type type)
Constructs an Event with the given type.
Definition event.h:62
static const Type DeferredCall
Event type for deferred callable delivery.
Definition event.h:50
bool isAccepted() const
Returns whether this event has been accepted.
Definition event.h:77
virtual ~Event()=default
Virtual destructor.
Type type() const
Returns the type identifier for this event.
Definition event.h:71
static constexpr Type InvalidType
Sentinel value representing an invalid or unset event type.
Definition event.h:35
void ignore()
Marks the event as ignored (not accepted).
Definition event.h:92
static const Type Quit
Event type requesting an EventLoop to quit.
Definition event.h:56
static Type registerType()
Allocates and returns a unique event type ID.
static const Type Timer
Event type for TimerEvent.
Definition event.h:47
void accept()
Marks the event as accepted.
Definition event.h:85
static const Type SignalEvent
Event type for cross-thread signal dispatch.
Definition event.h:53
uint32_t Type
Integer type used to identify event kinds.
Definition event.h:32
Dynamic array container wrapping std::vector.
Definition list.h:40
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19