C++ TargetRTS
|
Represents a message used for communication between capsule instances. More...
#include <RTMessage.h>
Public Types | |
enum | DeliverResult { Accepted , Deferred , Rejected } |
Public Member Functions | |
void | clear (void) |
Destroy the data object stored in the message, and reset the message object to make it ready to be used in another communication. | |
RTMessage (const RTMessage &) | |
int | isRTData (void) const |
Determines if the message carries a data object which is an RTDataObject. | |
void | setDeferred (void) |
Mark this message as deferred. | |
void | resetDeferred (void) |
Mark this message as not deferred. | |
int | isDeferred (void) const |
Determines if this message has been deferred, i.e. | |
void | setInvalid (void) |
int | isValid (void) const |
A message is considered valid as soon as its protocol event (i.e. | |
void | setSignal (int id) |
Set the signal id of the message, i.e. | |
int | getSignal (void) const |
Get the signal id of the message, i.e. | |
const char * | getSignalName (void) const |
Get the signal name of the message, i.e. | |
void | setPriority (int prio) |
Set the priority of the message. | |
int | getPriority (void) const |
Get the priority of the message. | |
void * | getData (void) const |
Get the data object carried by the message, if any. | |
void | setData (const void *data, const RTObject_class *type) |
Set the data object of the message. | |
void | setData (const RTDataObject &data) |
Set the data object of the message. | |
void | internData (bool moveData=false) |
Intern the data object of the message. | |
const RTObject_class * | getType (void) const |
Get the type of the data object of the message, if any. | |
RTProtocol * | sap (void) const |
Return the capsule port on which this message was received. | |
int | sapId (void) const |
Return the id of the capsule port on which this message was received. | |
int | sapIndex0 (void) const |
Return the index (0-based) of the replicated port on which this message was received. | |
int | sapIndex (void) const |
Return the index (1-based) of the replicated port on which this message was received. | |
DeliverResult | deliver (void) |
Attempt to deliver the message to its specified receiver. | |
RTMessage & | operator= (const RTMessage &) |
int | defer (void) const |
Defer the message by placing it in the defer queue. | |
void | setDestination (RTActor *cap, RTProtocol *port, int index) |
Set the destination (i.e. | |
RTActor * | receiver (void) const |
Return the currently set receiver for the message. | |
RTController * | context (void) const |
Return the controller of the message receiver. | |
Public Attributes | |
RTMessage * | next |
int | _sendPortId |
int | _sendPortIndex |
int | _sendProbeId |
RTTimespec | _sendTime |
union { | |
void * data | |
const void * const_data | |
}; | |
short | signal |
unsigned char | priority |
Protected Types | |
enum | { MaskDeferred = 1 , MaskDataOwned = 2 } |
Protected Member Functions | |
void | _internData (bool moveData) |
Protected Attributes | |
unsigned char | _flags |
RTActor * | _receiver |
RTProtocol * | _port |
int | _portIndex |
const RTObject_class * | _type |
Represents a message used for communication between capsule instances.
The message may carry a data object. A message object is usually an instance of a protocol event. However, there are also internal messages used by the TargetRTS itself.
void RTMessage::clear | ( | void | ) |
Destroy the data object stored in the message, and reset the message object to make it ready to be used in another communication.
This function is called internally by the TargetRTS and there is usually no need to call it directly.
RTController * RTMessage::context | ( | void | ) | const |
Return the controller of the message receiver.
int RTMessage::defer | ( | void | ) | const |
Defer the message by placing it in the defer queue.
You can later recall a deferred message by calling one of the recall functions of RTInSignal or RTProtocol.
DeliverResult RTMessage::deliver | ( | void | ) |
Attempt to deliver the message to its specified receiver.
This function is called by the TargetRTS when a message is sent, and it's normally not useful to call it directly.
void * RTMessage::getData | ( | void | ) | const |
Get the data object carried by the message, if any.
int RTMessage::getPriority | ( | void | ) | const |
Get the priority of the message.
See RTPriority.h for a list of valid message priorities.
int RTMessage::getSignal | ( | void | ) | const |
Get the signal id of the message, i.e.
the id of its protocol event.
const char * RTMessage::getSignalName | ( | void | ) | const |
Get the signal name of the message, i.e.
the name of its protocol event.
const RTObject_class * RTMessage::getType | ( | void | ) | const |
Get the type of the data object of the message, if any.
void RTMessage::internData | ( | bool | moveData = false | ) |
Intern the data object of the message.
Normally this means the data object will be copied into the message but if moveData is true, the data object will instead be moved into the message.
int RTMessage::isDeferred | ( | void | ) | const |
Determines if this message has been deferred, i.e.
placed in a defer queue.
int RTMessage::isRTData | ( | void | ) | const |
Determines if the message carries a data object which is an RTDataObject.
Mainly provided for backwards compatibility.
int RTMessage::isValid | ( | void | ) | const |
A message is considered valid as soon as its protocol event (i.e.
signal id) has been setup.
RTActor * RTMessage::receiver | ( | void | ) | const |
Return the currently set receiver for the message.
void RTMessage::resetDeferred | ( | void | ) |
Mark this message as not deferred.
This function is called internally by the TargetRTS and there is usually no need to call it directly.
RTProtocol * RTMessage::sap | ( | void | ) | const |
Return the capsule port on which this message was received.
int RTMessage::sapId | ( | void | ) | const |
Return the id of the capsule port on which this message was received.
int RTMessage::sapIndex | ( | void | ) | const |
Return the index (1-based) of the replicated port on which this message was received.
It's for example useful to get this index if you want to send a message back to the sender.
int RTMessage::sapIndex0 | ( | void | ) | const |
Return the index (0-based) of the replicated port on which this message was received.
It's for example useful to get this index if you want to send a message back to the sender.
void RTMessage::setData | ( | const RTDataObject & | data | ) |
Set the data object of the message.
[in] | data | Data object. |
void RTMessage::setData | ( | const void * | data, |
const RTObject_class * | type | ||
) |
Set the data object of the message.
[in] | data | Data object. |
[in] | type | Type descriptor of the data object. |
void RTMessage::setDeferred | ( | void | ) |
Mark this message as deferred.
This function is called internally by the TargetRTS and there is usually no need to call it directly.
void RTMessage::setDestination | ( | RTActor * | cap, |
RTProtocol * | port, | ||
int | index | ||
) |
Set the destination (i.e.
receiver) of the message. This function is called by the TargetRTS when a message is sent, and it's normally not useful to call it directly.
[in] | cap | Receiver capsule instance. |
[in] | port | The receiver port on the capsule instance to which the message is sent. |
[in] | index | The 0-based index of the receiver port (in case it is replicated). |
void RTMessage::setPriority | ( | int | prio | ) |
Set the priority of the message.
See RTPriority.h for a list of valid message priorities.
[in] | prio | Priority for the message. |
void RTMessage::setSignal | ( | int | id | ) |
Set the signal id of the message, i.e.
the id of its the protocol event.
[in] | id | Numeric id of the protocol event of the message. |