C++ TargetRTS
|
Provides the API for working with messages of a certain protocol event to be sent on a certain port, optionally carrying a data object. More...
#include <RTOutSignal.h>
Public Member Functions | |
int | invoke (RTMessage *replyBuffers) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message). | |
int | invokeAt (int index, RTMessage *replyBuffer) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message). | |
int | invoke () |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message). | |
int | invokeAt (int index) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message). | |
int | reply (void) |
Make a reply to respond to an invoke. | |
int | send (int priority=General) |
Send a message of the specified protocol event and on the specified port (optionally passing a specified data object with the sent message). | |
int | sendAt (int index, int priority=General) |
Send a message of the specified protocol event and on the specified port (optionally passing a specified data object with the sent message). | |
RTOutSignal (RTProtocol *port, int signal, const void *data, const RTObject_class *type, bool rValueRef=false) | |
Public Attributes | |
RTProtocol * | _port |
The port to which the message should be sent. | |
int | _signal |
The signal id of the protocol event for the message to send. | |
const void * | _data |
The data object to pass with the message, or NULL in case the protocol event has no data. | |
const RTObject_class * | _type |
The type descriptor of the data object, or NULL in case the protocol event has no data. | |
bool | _rValueRef |
The data object for the message to send is by default copied. | |
Provides the API for working with messages of a certain protocol event to be sent on a certain port, optionally carrying a data object.
Each protocol event is translated to a function on a class that inherits from RTProtocol, and such a function returns an RTOutSignal object that is bound to a specific port and protocol event (and optionally also a data object). This is true if the protocol event is outgoing, or if it is incoming and the port is conjugated. Call functions on that object to send or invoke such messages, or to make a reply to respond to an invoke.
int RTOutSignal::invoke | ( | ) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message).
No reply data can be passed back to the caller and the callee does not have to make an explicit reply (it is implicitly made when completing the invoke).
int RTOutSignal::invoke | ( | RTMessage * | replyBuffers | ) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message).
replyBuffers | A caller-supplied message object that stores the reply message(s) resulting from the invoke. The caller is responsible for allocating and deleting the message(s) when they are no longer required. To verify that a returned message is valid call RTMessage::isValid() once the invoke returns. The callee must make an explicit reply call even if no data needs to be passed back to the caller. |
int RTOutSignal::invokeAt | ( | int | index | ) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message).
The message is invoked at the specified port index. No reply data can be passed back to the caller and the callee does not have to make an explicit reply (it is implicitly made when completing the invoke).
[in] | index | Port index (0-based). |
int RTOutSignal::invokeAt | ( | int | index, |
RTMessage * | replyBuffer | ||
) |
Invoke a message of the specified protocol event and on the specified port (optionally passing a specified data object with the invoke message).
The message is invoked at the specified port index.
[in] | index | Port index (0-based). |
replyBuffer | A caller-supplied message object that stores the reply message(s) resulting from the invoke. The caller is responsible for allocating and deleting the message(s) when they are no longer required. To verify that a returned message is valid call RTMessage::isValid() once the invoke returns. The callee must make an explicit reply call even if no data needs to be passed back to the caller. |
int RTOutSignal::reply | ( | void | ) |
Make a reply to respond to an invoke.
The reply message is of the specified protocol event and is made on the specified port (optionally passing a specified data object with the reply message).
int RTOutSignal::send | ( | int | priority = General | ) |
Send a message of the specified protocol event and on the specified port (optionally passing a specified data object with the sent message).
priority | The priority at which the message should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
int RTOutSignal::sendAt | ( | int | index, |
int | priority = General |
||
) |
Send a message of the specified protocol event and on the specified port (optionally passing a specified data object with the sent message).
The message is sent at the specified port index.
[in] | index | Port index (0-based). |
priority | The priority at which the message should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
bool RTOutSignal::_rValueRef |
The data object for the message to send is by default copied.
Sometimes it may be better (for performance reasons) to instead move the data object. This is expressed by using an rvalue of the type when sending the event, for example: myPort.myEvent(std::move(data)).send(); If this is set to false (the default), the data will be copied, otherwise it will be moved.