Isle
Loading...
Searching...
No Matches
MxNotificationManager Class Reference

[AI] Central registry and dispatcher of asynchronous notifications between MxCore objects. More...

#include <mxnotificationmanager.h>

Inheritance diagram for MxNotificationManager:
Collaboration diagram for MxNotificationManager:

Public Member Functions

 MxNotificationManager ()
 [AI] Constructs a new NotificationManager, initializing all state to defaults. More...
 
 ~MxNotificationManager () override
 [AI] Destroys the NotificationManager. More...
 
MxResult Tickle () override
 [AI] Processes and dispatches all queued notifications to their targets. More...
 
virtual MxResult Create (MxU32 p_frequencyMS, MxBool p_createThread)
 [AI] Initializes the notification manager, setting up queues and optionally registering with the tickle manager. More...
 
void Register (MxCore *p_listener)
 [AI] Registers a listener object to receive notifications. More...
 
void Unregister (MxCore *p_listener)
 [AI] Removes a previously registered listener and flushes any pending notifications for it. More...
 
MxResult Send (MxCore *p_listener, const MxNotificationParam &p_param)
 [AI] Queues a notification to be sent to a specific registered listener. More...
 
MxNotificationPtrListGetQueue ()
 [AI] Returns a pointer to the current notification queue (for debug/inspection). More...
 
void SetActive (MxBool p_active)
 [AI] Sets the notification manager active or inactive. More...
 
MxBool IsEmpty () const
 [AI] Returns whether the notification queue is empty. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Detailed Description

[AI] Central registry and dispatcher of asynchronous notifications between MxCore objects.

[AI] Forward declaration for a manager used to send or process notifications throughout the engine.

[AI]

[AI] Manages an internal queue of notifications, a thread lock for concurrency, and the registration of observers (listeners). Responsible for routing queued notifications to the correct object on each tick.

Definition at line 66 of file mxnotificationmanager.h.

Constructor & Destructor Documentation

◆ MxNotificationManager()

MxNotificationManager::MxNotificationManager ( )

[AI] Constructs a new NotificationManager, initializing all state to defaults.

[AI]

Definition at line 30 of file mxnotificationmanager.cpp.

◆ ~MxNotificationManager()

MxNotificationManager::~MxNotificationManager ( )
override

[AI] Destroys the NotificationManager.

Flushes notifications, cleans up memory, and unregisters itself from the tickle manager. [AI]

Definition at line 39 of file mxnotificationmanager.cpp.

Member Function Documentation

◆ Create()

MxResult MxNotificationManager::Create ( MxU32  p_frequencyMS,
MxBool  p_createThread 
)
virtual

[AI] Initializes the notification manager, setting up queues and optionally registering with the tickle manager.

[AI]

Parameters
p_frequencyMSThe tick frequency (ms) to process notifications. [AI]
p_createThreadWhether to create an internal thread for processing. [AI]
Returns
SUCCESS if initialized, FAILURE otherwise. [AI]

Definition at line 50 of file mxnotificationmanager.cpp.

◆ GetQueue()

MxNotificationPtrList * MxNotificationManager::GetQueue ( )
inline

[AI] Returns a pointer to the current notification queue (for debug/inspection).

[AI]

Returns
Pointer to queue list structure. [AI]

Definition at line 126 of file mxnotificationmanager.h.

◆ IsEmpty()

MxBool MxNotificationManager::IsEmpty ( ) const
inline

[AI] Returns whether the notification queue is empty.

[AI]

Returns
TRUE if empty or no queue exists, FALSE otherwise. [AI]

Definition at line 138 of file mxnotificationmanager.h.

◆ Register()

void MxNotificationManager::Register ( MxCore p_listener)

[AI] Registers a listener object to receive notifications.

[AI]

Parameters
p_listenerPointer to the MxCore-derived listener object to register.

[AI] Registers the object's ID; only registered listeners may be sent notifications. Thread-safe.

Definition at line 168 of file mxnotificationmanager.cpp.

◆ Send()

MxResult MxNotificationManager::Send ( MxCore p_listener,
const MxNotificationParam p_param 
)

[AI] Queues a notification to be sent to a specific registered listener.

[AI]

Parameters
p_listenerTarget listener object (must be registered) [AI]
p_paramNotification parameter (will be cloned inside the notification) [AI]
Returns
SUCCESS if enqueued, FAILURE otherwise (e.g., not registered or queue inactive) [AI]

Definition at line 67 of file mxnotificationmanager.cpp.

◆ SetActive()

void MxNotificationManager::SetActive ( MxBool  p_active)
inline

[AI] Sets the notification manager active or inactive.

[AI]

Parameters
p_activeIf FALSE, prevents notifications from being queued or dispatched. [AI]

Definition at line 132 of file mxnotificationmanager.h.

◆ Tickle()

MxResult MxNotificationManager::Tickle ( )
overridevirtual

[AI] Processes and dispatches all queued notifications to their targets.

[AI]

[AI] Called by the tickle loop to flush the notification queue, invoking Notify(param) on each registered target. Thread-safe.

Reimplemented from MxCore.

Definition at line 90 of file mxnotificationmanager.cpp.

◆ Unregister()

void MxNotificationManager::Unregister ( MxCore p_listener)

[AI] Removes a previously registered listener and flushes any pending notifications for it.

[AI]

Parameters
p_listenerPointer to the listener object (to remove by ID). [AI]

[AI] Also flushes any queued (but undelivered) notifications intended for this object. Thread-safe.

Definition at line 182 of file mxnotificationmanager.cpp.


The documentation for this class was generated from the following files: