libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ListenerAction.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
6
7namespace Ship {
8
9class Events;
10
23 public:
35 ListenerAction(EventID eventId, ListenerID listenerId, EventPriority priority, uint64_t sequence, Events* events,
36 std::shared_ptr<Tickable> tickable, EventCallback callback,
37 EventMetadata metadata = { nullptr, 0, 0 });
38
44 uint64_t GetSequence() const;
46 const EventMetadata& GetMetadata() const;
47
48 protected:
53 bool ActionRan() override;
54
55 private:
57 Events* mEvents;
59 ListenerID mListenerId;
61 EventPriority mPriority;
63 uint64_t mSequence;
65 EventCallback mEventCallback;
67 EventMetadata mMetadata;
68};
69
70} // namespace Ship
EventPriority
Priority levels that control listener dispatch order within an event.
Definition EventTypes.h:19
int32_t EventID
Numeric identifier for an event. -1 is uninitialized, IDs < -1 are internally registered,...
Definition EventTypes.h:8
void(* EventCallback)(IEvent *)
Callback signature for event listeners. The argument is the event payload cast to IEvent*.
Definition EventTypes.h:39
int64_t ListenerID
Numeric identifier for a registered listener; used to unregister later.
Definition EventTypes.h:10
Action specialization for event-driven dispatch.
Definition EventAction.h:46
Tickable event bus that dispatches listeners through Tick(EventID).
Definition Events.h:74
Event-bus listener action executed by Events::Tick(EventID).
Definition ListenerAction.h:22
const EventMetadata & GetMetadata() const
Returns the registration-site metadata recorded for this listener.
uint64_t GetSequence() const
Returns the stable registration-order sequence number.
bool ActionRan() override
Executes the listener callback against the current Events payload.
EventPriority GetPriority() const
Returns the dispatch priority used for ordering listeners.
ListenerAction(EventID eventId, ListenerID listenerId, EventPriority priority, uint64_t sequence, Events *events, std::shared_ptr< Tickable > tickable, EventCallback callback, EventMetadata metadata={ nullptr, 0, 0 })
Constructs a listener action for a single EventID.
ListenerID GetListenerId() const
Returns the event-scoped ListenerID for this action.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
Diagnostic metadata recorded for each unique call site that fires an event.
Definition EventTypes.h:44