C++ TargetRTS
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
RTOutSignal Struct Reference

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.
 

Detailed Description

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.

Member Function Documentation

◆ invoke() [1/2]

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).

Returns
1 if the invoke was successful, 0 otherwise.

◆ invoke() [2/2]

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).

Parameters
replyBuffersA 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.
Returns
1 if the invoke was successful, 0 otherwise.

◆ invokeAt() [1/2]

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).

Parameters
[in]indexPort index (0-based).
Returns
1 if the invoke was successful, 0 otherwise.

◆ invokeAt() [2/2]

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.

Parameters
[in]indexPort index (0-based).
replyBufferA 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.
Returns
1 if the invoke was successful, 0 otherwise.

◆ reply()

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).

Returns
1 if the reply was successful, 0 otherwise.

◆ send()

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).

Parameters
priorityThe 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.
Returns
1 if the message was successfully sent, 0 otherwise.

◆ sendAt()

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.

Parameters
[in]indexPort index (0-based).
priorityThe 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.
Returns
1 if the message was successfully sent, 0 otherwise.

Member Data Documentation

◆ _rValueRef

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.


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