QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::MessageManager Struct Reference
[Messaging]

The manager of the messaging platform. More...

#include <Q/gamedev.h>

Inheritance diagram for Q::MessageManager:

Com::Unknown List of all members.

Public Types

typedef Com::Ptr< MessageManagerPTR

Public Member Functions

virtual Utils::Result createMessageType (const char *, MessageType **)=0
virtual Utils::Result send (MessagePeer *from, MessagePeer *to, Message *, MessageResult *result)=0
virtual Utils::Result send (MessagePeer *from, MessagePeer *to, Message *, MessageResult *, float delay)=0
virtual Utils::Result add (MessagePeer *receiver, MessagePeer *sender)=0
virtual Utils::Result add (MessagePeer *receiver, MessagePeer *sender, MessageType *)=0
virtual Utils::Result add (MessagePeer *receiver, MessagePeer *sender, unsigned int categoryMask)=0
virtual Utils::Result remove (MessagePeer *, MessagePeer *)=0
virtual Utils::Result remove (MessagePeer *)=0

Static Public Member Functions

PTR theManager ()

Static Public Attributes

Com::UUID IID
Com::UUID CLSID

Detailed Description

The manager of the messaging platform.

The MessageManager singleton object is the main platform for messaging. Only one instance of MessageManager is ever created - subsequent attempts to create the manager return the same object as the first time. Its main role is to send and route messages. Messages may be sent to a particular target or broadcasted; they may be anonymous; they may be sent synchronously or asynchronously, with or without a delay. The optional reply can also be synchronous or asynchronous. The manager also connects and disconnects peers. MessagePeer connection is used when messages are broadcasted. Peers must be removed from the manager when they become invalid (i.e. destroyed) so that all the other peers and messaging users get notified. It is particularly useful for scripting to prevent it from sending messages to invalid targets.

See also:
Message

MessagePeer


Member Typedef Documentation

typedef Com::Ptr<MessageManager> Q::MessageManager::PTR
 

A COM pointer to an object of this class


Member Function Documentation

virtual Utils::Result Q::MessageManager::add MessagePeer receiver,
MessagePeer sender,
unsigned int  categoryMask
[pure virtual]
 

Connect 2 peers for broadcasted messages. The receiver will receive all messages from the sender peer whose type category matches the specified category bit mask categoryMask. Users define categories for their message types and can them reduce the broadcasting overload by connect peers with filters that accept or block all messages they choose to. In a single connection between two peers, filters can be asymmetric: each receiver can use different filter, if the user symmetrically called that method with a different filter for each side. By default, when a filtering connection is established, the sender has no filter (i.e. accept all messages) on its side if no filter was previously in place. Read the messaging tutorial for further details. Samples messagingt and messaging2t illustrate filtering.

virtual Utils::Result Q::MessageManager::add MessagePeer receiver,
MessagePeer sender,
MessageType
[pure virtual]
 

Connect 2 peers for broadcasted messages. The receiver will receive all messages whose type is the specified type from the sender peer

virtual Utils::Result Q::MessageManager::add MessagePeer receiver,
MessagePeer sender
[pure virtual]
 

Connect 2 peers for broadcasted messages (no filtering). The receiver will receive any messages from the sender peer (no filter).

virtual Utils::Result Q::MessageManager::createMessageType const char *  ,
MessageType ** 
[pure virtual]
 

Returns the MessageType object associated with the specified name if it exists, and creates one if it does not.

Note:
The reference count of the MessageType will be one after creation. The caller should release this reference using Com::Unknown::release.

virtual Utils::Result Q::MessageManager::remove MessagePeer  )  [pure virtual]
 

Invalidate a peer. This method is essential to notify all messaging users that the peer can no longer be used. For instance, delayed messages will be cancelled and the scripting engine will automatically reset all the variables storing the specified peer.

virtual Utils::Result Q::MessageManager::remove MessagePeer ,
MessagePeer
[pure virtual]
 

Disconnect peers

virtual Utils::Result Q::MessageManager::send MessagePeer from,
MessagePeer to,
Message ,
MessageResult ,
float  delay
[pure virtual]
 

Send a message asynchronously. The message is sent to the specified destination if it is not nil, otherwise it is broadcasted. If a valid result is specified, the sender may expect the destination to return a result by callback

Parameters:
from indicates where the message was sent from. It might be null for anonymous sending.
to indicates the target. It might be null, in which case the message is broadcasted to all peers connected to the sender.
delay The delay before the message gets sent. If this delay is zero, the message will be sent asynchronously at the end of the very same frame.
Warning:
If the sending delay is zero, the message will be sent withing the same frame. If there is a loop among asynchonous message sending with zero delays (e.g. peer keeping on sending a message to itself with delay zero. Or messages bouncing between two peers with delay zero), the frame will remain the same and it will therefore loop in the message loop and the user code.

virtual Utils::Result Q::MessageManager::send MessagePeer from,
MessagePeer to,
Message ,
MessageResult result
[pure virtual]
 

Send a message synchronously. The message is sent to the specified destination if it is not nil, otherwise it is broadcasted. If a valid result is specified, the sender may expect the destination to return a result by callback

Parameters:
from indicates where the message was sent from. It might be null for anonymous sending.
to indicates the target. It might be null, in which case the message is broadcasted to all peers connected to the sender.
result The result for dynamic invocation. When not null, the receiver is expected to fill in whatever part of the result is relevant to it.

MessageManager::PTR Q::MessageManager::theManager  )  [inline, static]
 

The singleton MessageManager


Member Data Documentation

Com::UUID Q::MessageManager::CLSID [static]
 

COM CLSID f2d80091-974f-4a2a-98ee-3f7f4bb7b5cb

Com::UUID Q::MessageManager::IID [static]
 

COM IID 904ed15b-ec42-478a-84a1-1b43ac0d714c

Reimplemented from Com::Unknown.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004