Orocos Real-Time Toolkit  2.5.0
Public Member Functions | Protected Attributes
RTT::mqueue::MQSendRecv Class Reference

Implements the sending/receiving of mqueue messages. More...

#include <rtt/transports/mqueue/MQSendRecv.hpp>

Inheritance diagram for RTT::mqueue::MQSendRecv:
RTT::mqueue::MQChannelElement< T >

List of all members.

Public Member Functions

 MQSendRecv (types::TypeMarshaller const &transport)
 Create a channel element for remote data exchange.
void setupStream (base::DataSourceBase::shared_ptr ds, base::PortInterface *port, ConnPolicy const &policy, bool is_sender)
void cleanupStream ()
virtual void mqNewSample (base::DataSourceBase::shared_ptr ds)
 Adapts the mq send/receive buffer size according to the data in mqdata_source, or the value set in mdata_size;.
virtual bool mqReady (base::DataSourceBase::shared_ptr ds, base::ChannelElementBase *chan)
 Works only in receive mode, waits for a new sample and adapts the receive buffer to match it's size.
bool mqRead (base::DataSourceBase::shared_ptr ds)
 Read from the message queue.
bool mqWrite (base::DataSourceBase::shared_ptr ds)
 Write to the message queue.

Protected Attributes

types::TypeMarshaller const & mtransport
 Transport marshaller used for size calculations and data updates.
void * marshaller_cookie
 A private blob that is returned by mtransport.getCookie().
mqd_t mqdes
 MQueue file descriptor.
char * buf
 Send/Receive buffer.
bool mis_sender
 True if this object is a sender.
bool minit_done
 True if setupStream() was called, false after cleanupStream().
int max_size
 The size of buf.
std::string mqname
 The name of the queue, as specified in the ConnPolicy when creating the stream, or self-calculated when that name was empty.
int mdata_size
 The size of the data, as specified in the ConnPolicy when creating the stream, or calculated using the transport when that size was zero.

Detailed Description

Implements the sending/receiving of mqueue messages.

It can only be OR sender OR receiver (logical XOR).

Definition at line 54 of file MQSendRecv.hpp.


Constructor & Destructor Documentation

Create a channel element for remote data exchange.

Parameters:
transportThe type specific object that will be used to marshal the data.

Definition at line 63 of file MQSendRecv.cpp.


Member Function Documentation

Adapts the mq send/receive buffer size according to the data in mqdata_source, or the value set in mdata_size;.

Parameters:
sample

Definition at line 181 of file MQSendRecv.cpp.

References buf, RTT::types::TypeMarshaller::getSampleSize(), max_size, mdata_size, and mtransport.

Read from the message queue.

Parameters:
samplestores the resulting data sample.
Returns:
true if an item could be read.

Definition at line 239 of file MQSendRecv.cpp.

References buf, marshaller_cookie, max_size, mqdes, mtransport, and RTT::types::TypeMarshaller::updateFromBlob().

Referenced by RTT::mqueue::MQChannelElement< T >::signal().

Works only in receive mode, waits for a new sample and adapts the receive buffer to match it's size.

Returns:

Definition at line 191 of file MQSendRecv.cpp.

References buf, marshaller_cookie, max_size, minit_done, mis_sender, mqdes, mtransport, and RTT::types::TypeMarshaller::updateFromBlob().

Referenced by RTT::mqueue::MQChannelElement< T >::inputReady().

Write to the message queue.

Parameters:
dsthe data sample to write
is_data_sampletrue if the sample is used for initialization, false if it is a proper write
Returns:
true if it could be sent.

Definition at line 254 of file MQSendRecv.cpp.

References buf, RTT::types::TypeMarshaller::fillBlob(), marshaller_cookie, max_size, mqdes, and mtransport.

Referenced by RTT::mqueue::MQChannelElement< T >::write().


Member Data Documentation

char* RTT::mqueue::MQSendRecv::buf [protected]

Send/Receive buffer.

It is initialized to the size of the value provided by the ConnPolicy or, if the policy has a zero data size, the sample given to setupStream

Its size is saved in max_size

Definition at line 79 of file MQSendRecv.hpp.

Referenced by mqNewSample(), mqRead(), mqReady(), and mqWrite().

A private blob that is returned by mtransport.getCookie().

It is used by the marshallers if they need private internal data to do the marshalling

Definition at line 67 of file MQSendRecv.hpp.

Referenced by mqRead(), mqReady(), and mqWrite().


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