Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

Namespaces | Classes
Message System

## Namespaces
| Dispatcher
| Namespace for the message dispatcher functions.

## Classes
class | IMessageListener
| Listener interface for objects that receive messages. More...
struct | MessageQueue
| Internal class for tracking message queues. More...
class | EventManager
class | Message
| Base class for messages. More...
class | MessageForwarder
| Forward messages from one queue to another. More...
class | ScriptMsgListener
| Script accessible version of Dispatcher::IMessageListener. More...

## Message Queue Management
bool | isQueueRegistered (const char *name)
| Check if a message queue is registered. More...
void | registerMessageQueue (const char *name)
| Register a message queue. More...
void | unregisterMessageQueue (const char *name)
| Unregister a message queue. More...
bool | registerMessageListener (const char *queue, IMessageListener *listener)
| Register a listener with a queue to receive messages. More...
void | unregisterMessageListener (const char *queue, IMessageListener *listener)
| Unregister a listener with a queue. More...

## Message Dispatcher
bool | dispatchMessage (const char *queue, const char *msg, const char *data)
| Dispatch a message to a queue. More...
bool | dispatchMessageObject (const char *queue, Message *msg)
| Dispatch a message object to a queue. More...

## Internal Functions
bool | lockDispatcherMutex ()
| Internal function: Lock the dispatcher mutex. More...
void | unlockDispatcherMutex ()
| Internal function: Unlock the dispatcher mutex. More...
MessageQueue * | getMessageQueue (const char *name)
| Internal function: obtain message queue. Dispatcher mutex must be locked. More...

## Detailed Description

Most of the message system docs are currently just stubs and will be fleshed out soon.

## Function Documentation

bool 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

Returns
  true for success, false for failure

See also
  dispatchMessageObject()

bool 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

Returns
  true for success, false for failure

See also
  dispatchMessage()

MessageQueue * getMessageQueue | ( | const char * | name | ) |

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

Parameters

  name | Name of the queue

Returns
  Message queue

See also
  lockDispatcherMutex(), unlockDispatcherMutex()

bool isQueueRegistered | ( | const char * | name | ) |

Check if a message queue is registered.

Parameters

  name | The name of the message queue

Returns
  true if the queue is registered, false otherwise

See also
  registerMessageQueue(), unregisterMessageQueue()

bool lockDispatcherMutex | ( |  | ) |

Internal function: Lock the dispatcher mutex.

Returns
  true for success, false for failure

See also
  unlockDispatcherMutex()

bool 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

Returns
  true for success, false otherwise

See also
  unregisterMessageListener()

void registerMessageQueue | ( | const char * | name | ) |

Register a message queue.

Parameters

  name | The name of the message queue to register

See also
  isQueueRegistered(), unregisterMessageQueue()

void unlockDispatcherMutex | ( |  | ) |

Internal function: Unlock the dispatcher mutex.

See also
  lockDispatcherMutex()

void 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()

See also
  registerMessageListener()

void unregisterMessageQueue | ( | const char * | name | ) |

Unregister a message queue.

Parameters

  name | The name of the message queue

See also
  registerMessageQueue(), isQueueRegistered()