#include <mq_channel_element.hpp>
Public Member Functions | |
virtual bool | data_sample (typename ChannelElement< M >::param_t sample) |
virtual bool | inputReady () |
MQChannelElement (ConnectionBasePtr connection, bool is_sender) | |
FlowStatus | read (typename ChannelElement< M >::reference_t sample, bool copy_old_data) |
bool | write (typename ChannelElement< M >::param_t sample) |
~MQChannelElement () | |
Private Attributes | |
SerializedMessage | read_m |
DataObjectLockFree< M >::shared_ptr | read_sample |
DataObjectLockFree< M >::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 40 of file mq_channel_element.hpp.
micros_rtt::MQChannelElement< M >::MQChannelElement | ( | ConnectionBasePtr | connection, |
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 55 of file mq_channel_element.hpp.
micros_rtt::MQChannelElement< M >::~MQChannelElement | ( | ) | [inline] |
Definition at line 64 of file mq_channel_element.hpp.
virtual bool micros_rtt::MQChannelElement< M >::data_sample | ( | typename ChannelElement< M >::param_t | sample | ) | [inline, virtual] |
Definition at line 81 of file mq_channel_element.hpp.
virtual bool micros_rtt::MQChannelElement< M >::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 micros_rtt::ChannelElementBase.
Definition at line 69 of file mq_channel_element.hpp.
FlowStatus micros_rtt::MQChannelElement< M >::read | ( | typename ChannelElement< M >::reference_t | sample, |
bool | copy_old_data | ||
) | [inline] |
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.
sample | stores the resulting data sample. |
Definition at line 144 of file mq_channel_element.hpp.
bool micros_rtt::MQChannelElement< M >::write | ( | typename ChannelElement< M >::param_t | sample | ) | [inline] |
Write to the message queue
sample | the data sample to write |
Definition at line 163 of file mq_channel_element.hpp.
SerializedMessage micros_rtt::MQChannelElement< M >::read_m [private] |
Definition at line 48 of file mq_channel_element.hpp.
DataObjectLockFree<M>::shared_ptr micros_rtt::MQChannelElement< M >::read_sample [private] |
Used as a temporary on the reading side
Definition at line 43 of file mq_channel_element.hpp.
DataObjectLockFree<M>::shared_ptr micros_rtt::MQChannelElement< M >::write_sample [private] |
Used in write() to refer to the sample that needs to be written
Definition at line 45 of file mq_channel_element.hpp.