Public Member Functions | Private Attributes
RTT::mqueue::MQChannelElement< T > Class Template Reference

#include <MQChannelElement.hpp>

Inheritance diagram for RTT::mqueue::MQChannelElement< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool data_sample (typename base::ChannelElement< T >::param_t sample)
virtual bool inputReady ()
 MQChannelElement (base::PortInterface *port, types::TypeMarshaller const &transport, const ConnPolicy &policy, bool is_sender)
FlowStatus read (typename base::ChannelElement< T >::reference_t sample, bool copy_old_data)
bool signal ()
bool write (typename base::ChannelElement< T >::param_t sample)
 ~MQChannelElement ()

Private Attributes

internal::ValueDataSource< T >
::shared_ptr 
read_sample
internal::LateConstReferenceDataSource
< T >::shared_ptr 
write_sample

Detailed Description

template<typename T>
class RTT::mqueue::MQChannelElement< T >

Implements the a ChannelElement using message queues. It converts the C++ calls into MQ messages and vice versa.

Todo:

This class can be refactored into a base class with generic mqueue code and a subclass with type specific info.

This is an inspiration for a generic, transport independent channel element.

Definition at line 62 of file MQChannelElement.hpp.


Constructor & Destructor Documentation

template<typename T>
RTT::mqueue::MQChannelElement< T >::MQChannelElement ( base::PortInterface port,
types::TypeMarshaller const &  transport,
const ConnPolicy policy,
bool  is_sender 
) [inline]

Create a channel element for remote data exchange.

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

Definition at line 74 of file MQChannelElement.hpp.

template<typename T>
RTT::mqueue::MQChannelElement< T >::~MQChannelElement ( ) [inline]

Definition at line 85 of file MQChannelElement.hpp.


Member Function Documentation

template<typename T>
virtual bool RTT::mqueue::MQChannelElement< T >::data_sample ( typename base::ChannelElement< T >::param_t  sample) [inline, virtual]

Definition at line 100 of file MQChannelElement.hpp.

template<typename T>
virtual bool RTT::mqueue::MQChannelElement< T >::inputReady ( ) [inline, virtual]

This is called by an input port when it is ready to receive data. Each channel element has the responsibility to pass this notification on to the next, in the direction of the output.

Returns:
false if a fatal connection failure was encountered and the channel needs to be destroyed.

Reimplemented from RTT::base::ChannelElementBase.

Definition at line 89 of file MQChannelElement.hpp.

template<typename T>
FlowStatus RTT::mqueue::MQChannelElement< T >::read ( typename base::ChannelElement< T >::reference_t  sample,
bool  copy_old_data 
) [inline]

Read from the message queue.

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

Definition at line 156 of file MQChannelElement.hpp.

template<typename T>
bool RTT::mqueue::MQChannelElement< T >::signal ( ) [inline, virtual]

Signal will cause a read-write cycle to transfer the data from the data/buffer element to the message queue and vice versa.

Note: this virtual function is a bit abused. For a sending MQ, signal triggers a direct read on the data element. For a receiving MQ, signal is used by the dispatcher thread to provoque a read from the MQ and forward it to the next channel element.

In the sending case, signal could trigger a dispatcher thread that does the read/write cycle, but that seems only causing overhead. The receiving case must use a thread which blocks on all mq file descriptors.

Returns:
true in case the forwarding could be done, false otherwise.

Reimplemented from RTT::base::ChannelElementBase.

Definition at line 132 of file MQChannelElement.hpp.

template<typename T>
bool RTT::mqueue::MQChannelElement< T >::write ( typename base::ChannelElement< T >::param_t  sample) [inline]

Write to the message queue

Parameters:
samplethe data sample to write
Returns:
true if it could be sent.

Definition at line 166 of file MQChannelElement.hpp.


Member Data Documentation

Used as a temporary on the reading side

Definition at line 65 of file MQChannelElement.hpp.

Used in write() to refer to the sample that needs to be written

Definition at line 67 of file MQChannelElement.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Mon Oct 6 2014 03:13:59