Class DdsDoubleBuffer

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class DdsDoubleBuffer : public QObject

Buffer class for holding floating point scaler data in a QML compatible data structure.

QPointF Qt data type is used for the data range. This makes it available in QML and compatible with e.g. QtChart.

Note

This class is not currently exposed as a QML element, but rather used by DdsBuffer.

Public Functions

explicit DdsDoubleBuffer(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsDoubleBuffer()

Destructor.

QPointF range() const

Access function for minimum and maximum value of the buffered data.

void setCapacity(int buffer_size)

Pre-allocate capacity of the circular buffer.

inline boost::circular_buffer<double> &Buffer()

Access function to the circular buffer that stores the data.

Returns

Reference to the circular buffer.

Public Slots

void updateRange(double min, double max)

Updates the data range of the buffer.

If provided min or max value is different from already registered range, the function emits rangeChanged(). It uses Qt qFuzzyCompare() to decide if the range has changed.

Parameters
  • min[in] New minimum data value.

  • max[in] New maximum data value.

Signals

void rangeChanged(QPointF range)

Signal to indicate that data range has changed.

Properties

QPointF range

The value range in the buffer.

Private Members

boost::circular_buffer<double> m_buffer

A ring buffer with time points, held as double.

QPointF m_range

Data range of buffer. QPointF.x() is minimum, QPoint.y() is maximum.