#include <vmmsg.h>
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. | |
Error * | error () const |
Returns the error associated with this message. | |
void | error (Error *err) |
Transform this message in an async error notification. | |
const String & | name () const |
Returns the name of the message. | |
VMMessage * | next () 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. | |
SafeItem * | param (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 () |
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).
Falcon::VMMessage::VMMessage | ( | const String & | msgName | ) |
virtual Falcon::VMMessage::~VMMessage | ( | ) | [virtual] |
void Falcon::VMMessage::addParam | ( | const SafeItem & | itm | ) |
Adds a paramter to the message.
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.
bProcessed | true if called after a complete processing, false if the target VM didn't have active slots for this message. |
uint32 Falcon::VMMessage::paramCount | ( | ) | const [inline] |
Gets the number of parameters allocated in this message.