Public Member Functions | Private Attributes
micros_rtt::MQChannelElement< M > Class Template Reference

#include <mq_channel_element.hpp>

Inheritance diagram for micros_rtt::MQChannelElement< M >:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

template<typename M>
class micros_rtt::MQChannelElement< M >

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 40 of file mq_channel_element.hpp.


Constructor & Destructor Documentation

template<typename M>
micros_rtt::MQChannelElement< M >::MQChannelElement ( ConnectionBasePtr  connection,
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 55 of file mq_channel_element.hpp.

template<typename M>
micros_rtt::MQChannelElement< M >::~MQChannelElement ( ) [inline]

Definition at line 64 of file mq_channel_element.hpp.


Member Function Documentation

template<typename M>
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.

template<typename M>
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.

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

Reimplemented from micros_rtt::ChannelElementBase.

Definition at line 69 of file mq_channel_element.hpp.

template<typename M>
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.

Returns:
true in case the forwarding could be done, false otherwise. Read from the message queue.
Parameters:
samplestores the resulting data sample.
Returns:
true if an item could be read.

Definition at line 144 of file mq_channel_element.hpp.

template<typename M>
bool micros_rtt::MQChannelElement< M >::write ( typename ChannelElement< M >::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 163 of file mq_channel_element.hpp.


Member Data Documentation

template<typename M>
SerializedMessage micros_rtt::MQChannelElement< M >::read_m [private]

Definition at line 48 of file mq_channel_element.hpp.

template<typename M>
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.

template<typename M>
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.


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


micros_rtt
Author(s): Zaile Jiang , Xiaodong Yi , Minglong Li
autogenerated on Sat Jun 8 2019 19:02:21