Torque2D Reference
Loading...
Searching...
No Matches
Dispatcher Namespace Reference

Namespace for the message dispatcher functions. More...

Classes

struct  _DispatchData
 Internal class used by the dispatcher.
class  IMessageListener
 Listener interface for objects that receive messages. More...
struct  MessageQueue
 Internal class for tracking message queues. More...

Functions

Message Queue Management
bool isQueueRegistered (const char *name)
 Check if a message queue is registered.
void registerMessageQueue (const char *name)
 Register a message queue.
void unregisterMessageQueue (const char *name)
 Unregister a message queue.
bool registerMessageListener (const char *queue, IMessageListener *listener)
 Register a listener with a queue to receive messages.
void 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
MessageQueuegetMessageQueue (const char *name)
 Internal function: obtain message queue. Dispatcher mutex must be locked.
bool lockDispatcherMutex ()
 Internal function: Lock the dispatcher mutex.
void unlockDispatcherMutex ()
 Internal function: Unlock the dispatcher mutex.

Detailed Description

Namespace for the message dispatcher functions.

Function Documentation

◆ dispatchMessage()

bool dispatchMessage ( const char * queue,
const char * msg,
const char * data )

Dispatch a message to a queue.

Parameters
queueQueue to dispatch the message to
msgMessage to dispatch
dataData for message
Returns
true for success, false for failure
See also
dispatchMessageObject()

◆ dispatchMessageObject()

bool dispatchMessageObject ( const char * queue,
Message * msg )

Dispatch a message object to a queue.

Parameters
queueQueue to dispatch the message to
msgMessage to dispatch
Returns
true for success, false for failure
See also
dispatchMessage()

◆ getMessageQueue()

MessageQueue * getMessageQueue ( const char * name)

Internal function: obtain message queue. Dispatcher mutex must be locked.

Parameters
nameName of the queue
Returns
Message queue
See also
lockDispatcherMutex(), unlockDispatcherMutex()

◆ isQueueRegistered()

bool isQueueRegistered ( const char * name)

Check if a message queue is registered.

Parameters
nameThe name of the message queue
Returns
true if the queue is registered, false otherwise
See also
registerMessageQueue(), unregisterMessageQueue()

◆ lockDispatcherMutex()

bool lockDispatcherMutex ( )
extern

Internal function: Lock the dispatcher mutex.

Returns
true for success, false for failure
See also
unlockDispatcherMutex()

◆ registerMessageListener()

bool registerMessageListener ( const char * queue,
IMessageListener * listener )

Register a listener with a queue to receive messages.

Parameters
queueThe name of the queue to register the listener with
listenerThe listener interface that receives messages
Returns
true for success, false otherwise
See also
unregisterMessageListener()

◆ registerMessageQueue()

void registerMessageQueue ( const char * name)

Register a message queue.

Parameters
nameThe name of the message queue to register
See also
isQueueRegistered(), unregisterMessageQueue()

◆ unlockDispatcherMutex()

void unlockDispatcherMutex ( )
extern

Internal function: Unlock the dispatcher mutex.

See also
lockDispatcherMutex()

◆ unregisterMessageListener()

void unregisterMessageListener ( const char * queue,
IMessageListener * listener )

Unregister a listener with a queue.

Parameters
queueThe name of the queue to unregister the listener
listenerThe listener interface that was passed to registerMessageListener()
See also
registerMessageListener()

◆ unregisterMessageQueue()

void unregisterMessageQueue ( const char * name)

Unregister a message queue.

Parameters
nameThe name of the message queue
See also
registerMessageQueue(), isQueueRegistered()