OpenCurves  0.9
RTMessage Class Referenceabstract

Base message handling for real time data plot communications. More...

#include <rtmessage.h>

Inheritance diagram for RTMessage:
RTBinaryMessage RTStringMessage

Public Member Functions

virtual ~RTMessage ()
 Virtual destructor.
 
virtual void setMessage (QByteArray &buffer)=0
 Called to fill out the send buffer with the contained message. More...
 
virtual int readMessage (const QByteArray &buffer)=0
 Called to read incoming data from the given buffer. More...
 
virtual QStringList headings () const =0
 Request the list of headings for the plot. More...
 
virtual unsigned populateValues (std::vector< double > &values) const =0
 Request the latest values. More...
 

Detailed Description

Base message handling for real time data plot communications.

Implementations support reading and writing messages for real-time plot communications. There are two key implementations; RTStringMessage and RTBinaryMessage.

For sending, only setMessage() is called. For reading, the sequence is:

The headings() stops once a valid set of headings is returned. This is to support string based messaging where the number of headings is not given in advance, but stops requesting headings once known.

Member Function Documentation

virtual QStringList RTMessage::headings ( ) const
pure virtual

Request the list of headings for the plot.

Returns
The headings or an empty list if not yet known.

Implemented in RTBinaryMessage, and RTStringMessage.

virtual unsigned RTMessage::populateValues ( std::vector< double > &  values) const
pure virtual

Request the latest values.

Uses a std::vector, not QVector because the former can be cleared without reallocation (at the time of writing).

Parameters
valuesResized and populated to the latest values set.
Returns
The number of values available.

Implemented in RTBinaryMessage, and RTStringMessage.

virtual int RTMessage::readMessage ( const QByteArray &  buffer)
pure virtual

Called to read incoming data from the given buffer.

Parameters
bufferThe buffer to read from.
Returns
The number of bytes read on success, negative on error. Zero if nothing to read.

Implemented in RTBinaryMessage, and RTStringMessage.

virtual void RTMessage::setMessage ( QByteArray &  buffer)
pure virtual

Called to fill out the send buffer with the contained message.

Parameters
bufferThe buffer to write to.

Implemented in RTBinaryMessage, and RTStringMessage.


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