|
libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
|
Event-bus listener action executed by Events::Tick(EventID).
More...
#include <ListenerAction.h>
Public Member Functions | |
| 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. | |
| EventPriority | GetPriority () const |
| Returns the dispatch priority used for ordering listeners. | |
| uint64_t | GetSequence () const |
| Returns the stable registration-order sequence number. | |
| const EventMetadata & | GetMetadata () const |
| Returns the registration-site metadata recorded for this listener. | |
Public Member Functions inherited from Ship::EventAction | |
| EventAction (EventID eventId, std::shared_ptr< Tickable > tickable) | |
| Constructs an EventAction for the given EventID. | |
| EventAction (EventID eventId, std::shared_ptr< Tickable > tickable, EventActionCppCallback callback, uintptr_t callbackPointerData=0) | |
| Constructs an EventAction with a C++ callback override. | |
| EventAction (EventID eventId, std::shared_ptr< Tickable > tickable, uintptr_t callback, uintptr_t callbackPointerData=0) | |
| Constructs an EventAction with a C-style callback override. | |
| virtual | ~EventAction ()=default |
| EventID | GetEventId () const |
| Returns the EventID this action corresponds to. | |
| bool | HasCallback () const |
| Returns true when a callback override is configured. | |
| bool | GetHasCppCallback () const |
| Returns true when callback target is the C++ callback form. | |
| bool | GetHasRawCallback () const |
| Returns true when callback target is the raw function-pointer form. | |
| const EventActionCallback & | GetCallback () const |
| Returns the currently configured callback target. | |
| EventAction & | SetCallback (const EventActionCallback &callback) |
| Configures callback override from callback variant. | |
| EventAction & | SetCallback (const EventActionCallback &callback, uintptr_t callbackPointerData) |
| Configures callback override from callback variant. | |
| EventAction & | SetCallback (EventActionCppCallback callback) |
| Configures a C++ callback override. | |
| EventAction & | SetCallback (EventActionCppCallback callback, uintptr_t callbackPointerData) |
| Configures a C++ callback override. | |
| EventAction & | SetCallback (uintptr_t callback) |
| Configures a C-style callback override. | |
| EventAction & | SetCallback (uintptr_t callback, uintptr_t callbackPointerData) |
| Configures a C-style callback override. | |
| EventAction & | ClearCallback () |
| Clears callback override and restores fallback dispatch. | |
| uintptr_t | GetCallbackPointerData () const |
| Returns the callback pointer-sized data used by both callback forms. | |
| EventAction & | SetCallbackPointerData (uintptr_t callbackPointerData) |
| Updates callback pointer-sized data without changing callback target. | |
Public Member Functions inherited from Ship::Action | |
| Action (std::shared_ptr< Tickable > tickable) | |
| Constructs an Action associated with a Tickable. | |
| virtual | ~Action ()=default |
| std::shared_ptr< Tickable > | GetTickable () const |
| Returns the Tickable that owns this Action, or nullptr if expired. | |
| bool | Run () |
| Executes the Action if it is currently running. | |
| bool | IsRunning () const |
| Returns true if this Action is currently in the running state. | |
| bool | Start (const bool force=false) |
| Starts the Action so that subsequent Run() calls will execute it. | |
| bool | Stop (const bool force=false) |
| Stops the Action so that subsequent Run() calls become no-ops. | |
| virtual bool | CanStart () |
| Permission hook; override to prevent starting. Defaults to true. | |
| virtual bool | CanStop () |
| Permission hook; override to prevent stopping. Defaults to true. | |
| virtual void | Started (const bool forced) |
| Notification hook called after the Action has been started. | |
| virtual void | Stopped (const bool forced) |
| Notification hook called after the Action has been stopped. | |
| double | GetTime (const ClockType clockType) const |
| Returns the wall-clock time for a profiling checkpoint. | |
Public Member Functions inherited from Ship::Part | |
| Part () | |
| Constructs a Part and assigns it a unique ID. | |
| Part (std::shared_ptr< Context > context) | |
| Constructs a Part with an explicit Context reference and unique ID. | |
| virtual | ~Part ()=default |
| uint64_t | GetId () const |
| Returns the unique identifier for this Part. | |
| bool | operator== (const Part &other) const |
| Compares two Parts for equality by their unique IDs. | |
| std::shared_ptr< Context > | GetContext () const |
| Returns the Context this Part belongs to, or nullptr if unset. | |
| void | SetContext (std::shared_ptr< Context > ctx) |
| Sets the Context this Part belongs to. | |
Protected Member Functions | |
| bool | ActionRan () override |
Executes the listener callback against the current Events payload. | |
Protected Member Functions inherited from Ship::Part | |
| virtual void | OnAdded (bool forced) |
| Called after this Part has been added to a PartList. | |
| virtual void | OnRemoved (bool forced) |
| Called after this Part has been removed from a PartList. | |
Event-bus listener action executed by Events::Tick(EventID).
ListenerAction is the payload-aware action type used by the global Events component. It extends EventAction with listener identity, dispatch priority, registration order, and registration-site metadata.
During ActionRan(), the action reads the currently active payload from the owning Events component's dispatch context and invokes its stored EventCallback.
| Ship::ListenerAction::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.
| eventId | EventID this listener subscribes to. |
| listenerId | Event-scoped listener identifier. |
| priority | Dispatch priority; lower values fire first. |
| sequence | Stable registration-order sequence within the event. |
| events | Non-owning pointer to the owning Events component. |
| tickable | Owning Events tickable (may be null for stack-allocated Events). |
| callback | Listener callback invoked with the active event payload. |
| metadata | Registration-site diagnostic metadata. |
|
overrideprotectedvirtual |
Executes the listener callback against the current Events payload.
Reimplemented from Ship::EventAction.
| ListenerID Ship::ListenerAction::GetListenerId | ( | ) | const |
Returns the event-scoped ListenerID for this action.
| const EventMetadata & Ship::ListenerAction::GetMetadata | ( | ) | const |
Returns the registration-site metadata recorded for this listener.
| EventPriority Ship::ListenerAction::GetPriority | ( | ) | const |
Returns the dispatch priority used for ordering listeners.
| uint64_t Ship::ListenerAction::GetSequence | ( | ) | const |
Returns the stable registration-order sequence number.