Falcon::VMMessage Class Reference

Asynchronous message for the Virtual Machine. More...

#include <vmmsg.h>

Inheritance diagram for Falcon::VMMessage:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void addParam (const SafeItem &itm)
 Adds a paramter to the message.
void append (VMMessage *msg)
 Adds a message to be processed after this one.
Errorerror () const
 Returns the error associated with this message.
void error (Error *err)
 Transform this message in an async error notification.
const Stringname () const
 Returns the name of the message.
VMMessagenext () const
 Gets the next message to be processed after this one.
virtual void onMsgComplete (bool bProcessed)
 Called by the target VM when the message has been processed.
SafeItemparam (uint32 p) const
 Gets the nth parameter of this message.
uint32 paramCount () const
 Gets the number of parameters allocated in this message.
 VMMessage (const String &msgName)
 Creates a VMMessage without parameters.
virtual ~VMMessage ()


Detailed Description

Asynchronous message for the Virtual Machine.

When the virtual machine receives this, it executes a broadcast loop on a coroutine as soon as the message reaches the main VM loop.

Once done, the message owner is notified back via the onMessageComplete callback directly in the running VM thread.

All the items used as parameters are garbage locked when given to the message, and garbage-unlocked on message destruction (which happens after the completion notify callback is called).


Constructor & Destructor Documentation

Falcon::VMMessage::VMMessage ( const String msgName  ) 

Creates a VMMessage without parameters.

Parameters:
msgName the name of the message.

virtual Falcon::VMMessage::~VMMessage (  )  [virtual]


Member Function Documentation

void Falcon::VMMessage::addParam ( const SafeItem itm  ) 

Adds a paramter to the message.

Parameters:
itm The item to be added (will be copied and garbage locked).

void Falcon::VMMessage::append ( VMMessage msg  )  [inline]

Adds a message to be processed after this one.

This method is called by the target VM to store an incoming message at the end of the message queue, but it may be also used by the message sender to send more than one message in one spot to the target VM.

Error* Falcon::VMMessage::error (  )  const [inline]

Returns the error associated with this message.

void Falcon::VMMessage::error ( Error err  ) 

Transform this message in an async error notification.

The error is inc-reffed.

const String& Falcon::VMMessage::name (  )  const [inline]

Returns the name of the message.

VMMessage* Falcon::VMMessage::next (  )  const [inline]

Gets the next message to be processed after this one.

Should be called only by the target VM.

virtual void Falcon::VMMessage::onMsgComplete ( bool  bProcessed  )  [virtual]

Called by the target VM when the message has been processed.

The caller should create a subclass of VMMessage in case it needs to be notified about message completion and analyze asynchronous processing results.

The base class implementation does nothing.

The bProcessed parameter is set to true if at least one subscriber received the message, while it is set to false if the given VM hasn't the required slot, or if the slot is currently not subscribe by any listener.

Note:
This call happens in the target VM thread.
Parameters:
bProcessed true if called after a complete processing, false if the target VM didn't have active slots for this message.

SafeItem* Falcon::VMMessage::param ( uint32  p  )  const

Gets the nth parameter of this message.

uint32 Falcon::VMMessage::paramCount (  )  const [inline]

Gets the number of parameters allocated in this message.


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

Generated on Mon Oct 19 10:11:50 2009 for Falcon_Core by  doxygen 1.5.8