CEL

Public API Reference

iMessageChannel Struct Reference

This is an message channel. More...

#include <physicallayer/messaging.h>

Inheritance diagram for iMessageChannel:

List of all members.

Public Member Functions

virtual csRef< iMessageDispatcherCreateMessageDispatcher (iMessageSender *sender, const char *msg_id, iMessageReceiverFilter *receiver_filter=0)=0
 Create a message dispatcher.
virtual void RemoveMessageDispatcher (iMessageDispatcher *msgdest)=0
 Remove a message dispatcher.
virtual bool SendMessage (const char *msgid, iMessageSender *sender, iCelParameterBlock *params, iCelDataArray *ret=0)=0
 Send a message for a specific message id.
virtual void Subscribe (iMessageReceiver *receiver, const char *mask)=0
 Subscribe to this channel for all messages that match with the given mask.
virtual void Unsubscribe (iMessageReceiver *receiver, const char *mask=0)=0
 Unsubscribe from this channel.


Detailed Description

This is an message channel.

Objects interested in receiving messages from this channel can implement iMessageReceiver and register themselves to this channel. Objects interested in sending messages to this channel can implement iMessageSender.

Messages in this system are hierarchical. For example 'cel.object.mesh.select.down' could be the message from the mesh select property class.

Definition at line 46 of file messaging.h.


Member Function Documentation

virtual csRef<iMessageDispatcher> iMessageChannel::CreateMessageDispatcher ( iMessageSender sender,
const char *  msg_id,
iMessageReceiverFilter receiver_filter = 0 
) [pure virtual]

Create a message dispatcher.

If you are a message sender (iMessageSender) then you can use this method to get handles for sending messages for a specific message ID. This ID should be a fully qualified message ID (and not a message ID mask). For example 'cel.object.mesh.select.down'. The optional receiver_filter can be used to ignore certain receivers that don't match some external criterium.

virtual void iMessageChannel::RemoveMessageDispatcher ( iMessageDispatcher msgdest  )  [pure virtual]

Remove a message dispatcher.

Use this if you are no longer interested in sending messages. Note that it is safe to not remove a message dispatcher. If the channel or sender goes away message dispatcher are cleaned up automatically.

virtual bool iMessageChannel::SendMessage ( const char *  msgid,
iMessageSender sender,
iCelParameterBlock params,
iCelDataArray *  ret = 0 
) [pure virtual]

Send a message for a specific message id.

Use this if you only want to send a message once. You don't have to create a message dispatcher if you do this but note that this is less optimal when you have to send multiple messages.

Parameters:
msgid is the message ID.
sender is the sender from this message.
params contains the parameters for this message.
ret if this is not 0 then it can be used to collect information from the receivers. If 0 then information from the receivers is simply ignored.
Returns:
false if this message was not handled or recognized by any message receiver. If it was handled by at least one receiver then this will return true.

virtual void iMessageChannel::Subscribe ( iMessageReceiver receiver,
const char *  mask 
) [pure virtual]

Subscribe to this channel for all messages that match with the given mask.

virtual void iMessageChannel::Unsubscribe ( iMessageReceiver receiver,
const char *  mask = 0 
) [pure virtual]

Unsubscribe from this channel.

Parameters:
mask if this mask is given then all subscriptions that match with this mask will be unsubscribed. Otherwise all subscriptions for this receiver will be unsubscribed.


The documentation for this struct was generated from the following file:

Generated for CEL: Crystal Entity Layer 1.4.0 by doxygen 1.5.8