#include <MQChannelElement.hpp>
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 |
Implements the a ChannelElement using message queues. It converts the C++ calls into MQ messages and vice versa.
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.
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.
transport | The type specific object that will be used to marshal the data. |
Definition at line 74 of file MQChannelElement.hpp.
RTT::mqueue::MQChannelElement< T >::~MQChannelElement | ( | ) | [inline] |
Definition at line 85 of file MQChannelElement.hpp.
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.
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.
Reimplemented from RTT::base::ChannelElementBase.
Definition at line 89 of file MQChannelElement.hpp.
FlowStatus RTT::mqueue::MQChannelElement< T >::read | ( | typename base::ChannelElement< T >::reference_t | sample, |
bool | copy_old_data | ||
) | [inline] |
Read from the message queue.
sample | stores the resulting data sample. |
Definition at line 156 of file MQChannelElement.hpp.
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.
Reimplemented from RTT::base::ChannelElementBase.
Definition at line 132 of file MQChannelElement.hpp.
bool RTT::mqueue::MQChannelElement< T >::write | ( | typename base::ChannelElement< T >::param_t | sample | ) | [inline] |
Write to the message queue
sample | the data sample to write |
Definition at line 166 of file MQChannelElement.hpp.
internal::ValueDataSource<T>::shared_ptr RTT::mqueue::MQChannelElement< T >::read_sample [private] |
Used as a temporary on the reading side
Definition at line 65 of file MQChannelElement.hpp.
internal::LateConstReferenceDataSource<T>::shared_ptr RTT::mqueue::MQChannelElement< T >::write_sample [private] |
Used in write() to refer to the sample that needs to be written
Definition at line 67 of file MQChannelElement.hpp.