Event structure for inter-component communication. More...
#include <Event.hpp>
Collaboration diagram for utl::Event:Public Member Functions | |
| Event () | |
| Default constructor with current timestamp. | |
| Event (EventType t) | |
| Constructor with event type. | |
| Event (EventType t, const std::vector< std::uint8_t > &d) | |
| Constructor with event type and data. | |
| Event (EventType t, std::uint32_t src, std::uint32_t tgt=0, EventPriority prio=EventPriority::NORMAL) | |
| Constructor with all parameters. | |
| std::uint64_t | getAge () const |
| Get event age in milliseconds. | |
| bool | hasExpired (std::uint64_t maxAgeMs=5000) const |
| Check if event has expired. | |
| bool | isTargeted () const |
| Check if event is targeted to a specific component. | |
| bool | isBroadcast () const |
| Check if event is a broadcast. | |
Public Attributes | |
| EventType | type |
| Type of the event. | |
| std::uint32_t | sourceId = 0 |
| ID of the component that sent the event (0 = system) | |
| std::uint32_t | targetId = 0 |
| ID of the target component (0 = broadcast) | |
| EventPriority | priority = EventPriority::NORMAL |
| Event priority. | |
| std::chrono::steady_clock::time_point | timestamp |
| Timestamp when event was created. | |
| std::vector< std::uint8_t > | data |
| Serialized event data. | |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Get event age in milliseconds.
Definition at line 135 of file Event.hpp.
References timestamp.
Referenced by hasExpired().
Here is the caller graph for this function:
|
inline |
|
inline |
|
inline |
| std::vector<std::uint8_t> utl::Event::data |
Serialized event data.
Definition at line 96 of file Event.hpp.
Referenced by gme::RTypeServer::broadcastWorldState(), srv::AsioServer::handleBroadcastEvent(), srv::AsioServer::handleGameOverEvent(), eng::AsioClient::handleGameStart(), gme::JoinRoomScene::handleLobbyJoinResponse(), gme::JoinRoomScene::handleLobbyListResponse(), srv::AsioServer::handleSendEntityEventToClients(), srv::AsioServer::handleSendToClientEvent(), srv::AsioServer::handleStartGameRequest(), gme::GameMulti::handleWorldStateUpdate(), gme::RTypeServer::processPlayerInputEvent(), and gme::RTypeServer::processServerStartEvent().
| EventPriority utl::Event::priority = EventPriority::NORMAL |
| std::uint32_t utl::Event::sourceId = 0 |
ID of the component that sent the event (0 = system)
Definition at line 92 of file Event.hpp.
Referenced by utl::EventBus::publish().
| std::uint32_t utl::Event::targetId = 0 |
ID of the target component (0 = broadcast)
Definition at line 93 of file Event.hpp.
Referenced by isBroadcast(), isTargeted(), and utl::EventBus::updateStats().
| std::chrono::steady_clock::time_point utl::Event::timestamp |
| EventType utl::Event::type |