Dispatcher
Engine/source/util/messaging/dispatcher.cpp
Namespace for the message dispatcher functions.
Classes:
Listener interface for objects that receive messages.
Internal class for tracking message queues.
Message Queue Management
bool
isQueueRegistered(const char * name)
Check if a message queue is registered.
registerMessageQueue(const char * name)
Register a message queue.
const char *
Register an anonymous message queue.
unregisterMessageQueue(const char * name)
Unregister a message queue.
bool
registerMessageListener(const char * queue, IMessageListener * listener)
Register a listener with a queue to receive messages.
unregisterMessageListener(const char * queue, IMessageListener * listener)
Unregister a listener with a queue.
Message Dispatcher
bool
dispatchMessage(const char * queue, const char * msg, const char * data)
Dispatch a message to a queue.
bool
dispatchMessageObject(const char * queue, Message * msg)
Dispatch a message object to a queue.
Internal Functions
getMessageQueue(const char * name)
Internal function: obtain message queue.
bool
Internal function: Lock the dispatcher mutex.
Internal function: Unlock the dispatcher mutex.
Public Functions
Detailed Description
Namespace for the message dispatcher functions.
Message Queue Management
isQueueRegistered(const char * name)
Check if a message queue is registered.
Parameters:
name | The name of the message queue |
true if the queue is registered, false otherwise
registerMessageQueue(const char * name)
Register a message queue.
Parameters:
name | The name of the message queue to register |
registerAnonMessageQueue()
Register an anonymous message queue.
name of anonymous message queue for passing to other functions
unregisterMessageQueue(const char * name)
Unregister a message queue.
Parameters:
name | The name of the message queue |
registerMessageListener(const char * queue, IMessageListener * listener)
Register a listener with a queue to receive messages.
Parameters:
queue | The name of the queue to register the listener with |
listener | The listener interface that receives messages |
true for success, false otherwise
unregisterMessageListener(const char * queue, IMessageListener * listener)
Unregister a listener with a queue.
Parameters:
queue | The name of the queue to unregister the listener |
listener | The listener interface that was passed to registerMessageListener() |
Message Dispatcher
dispatchMessage(const char * queue, const char * msg, const char * data)
Dispatch a message to a queue.
Parameters:
queue | Queue to dispatch the message to |
msg | Message to dispatch |
data | Data for message |
true for success, false for failure
dispatchMessageObject(const char * queue, Message * msg)
Dispatch a message object to a queue.
Parameters:
queue | Queue to dispatch the message to |
msg | Message to dispatch |
true for success, false for failure
Internal Functions
getMessageQueue(const char * name)
Internal function: obtain message queue.
Dispatcher mutex must be locked.
Parameters:
name | Name of the queue |
Message queue
lockDispatcherMutex()
Internal function: Lock the dispatcher mutex.
true for success, false for failure
unlockDispatcherMutex()
Internal function: Unlock the dispatcher mutex.