Class DdsBuffer

Inheritance Relationships

Base Type

  • public QObject

Derived Types

Class Documentation

class DdsBuffer : public QObject

Buffer class for holding data in QtChart compatible data structures.

This class has a virtual slot function updateBuffers() that needs to be defined in the derived class.

Subclassed by DdsIdVec1dBuffer, DdsIdVec2dBuffer, DdsIdVec3dBuffer, DdsIdVec4dBuffer, DdsKinematics2DBuffer, DdsKinematics6DBuffer

Public Functions

explicit DdsBuffer(QObject *parent = nullptr)

Constructor.

The initialization is deferred to an init() function.

Parameters

parent[in] QObject pointer.

virtual ~DdsBuffer()

Destructor.

QDateTime rangeTmin() const

Access function for minimum time point in buffer as QML property.

QDateTime rangeTmax() const

Access function for maximal time point in buffer as QML property.

Public Slots

void updateSeries(QAbstractSeries *series, qml_enums::DimId xDim, qml_enums::DimId yDim)

Updates a QAbstractSeries with the data currently in the buffer.

This slots updates the input data series structure with the data in the buffers held by this class. It calls either replace_data_points() and replace_double_points() depending on the dimension type. The buffer member variable can hold several buffers, and are fetched using a specific DimId enum. This enables indexing in QML scripting using e.g. Fkin.Course, instead of integer indexing.

Note

yDim cannot be a time axis, that is, not DimId::T.

Parameters
  • series[inout] Pointer to series to be updated.

  • xDim[in] First dimension identifier.

  • yDim[in] Second dimension identifier.

virtual void updateBuffers() = 0

A function that should update the buffers with new data.

A possible use case would be to read data from a DDS topic and add them to appropriately mapped buffers in this class.

For example a Vec2d DDS type would append three buffers for each sample, two in the mapped buffer (DimId::X, DimId::Y) and one for time point.

void clearBuffers()

Clears all buffers.

void init(int buffer_size)

Initialize buffer and connect signals and slots for the time range properties.

Parameters

buffer_size[in] Set capacity of DdsTimepointBuffer

Signals

void rangeTminChanged(QDateTime min)

Signal to indicate that minimum time point has changed.

Parameters

min[out] Minimum time point as a QDateTime.

void rangeTmaxChanged(QDateTime max)

Signal to indicate that maximum time point has changed.

Parameters

max[out] Maximum time point as a QDateTime.

void rangeTChanged()

Signal to indicate that time range has changed.

Properties

QDateTime rangeTmin

Minimum time point in buffer.

QDateTime rangeTmax

Maximal time point in buffer.

Protected Attributes

std::map<qml_enums::DimId, DdsDoubleBuffer*> m_buffers

A map of buffers, key is DimId, value is DdsDoubleBuffer.

DdsTimepointBuffer *m_time

Pointer to time point buffer.