Program Listing for File DdsBuffer.hpp

Return to documentation for file (sinspekto/DdsBuffer.hpp)

#pragma once

#include <map>
#include <QObject>
#include <QDateTime>
#include <QAbstractSeries>

#include "sinspekto/DdsDoubleBuffer.hpp"
#include "sinspekto/DdsTimepointBuffer.hpp"

namespace qml_enums{ enum class DimId; }

QT_CHARTS_USE_NAMESPACE

class DdsBuffer : public QObject
{
  Q_OBJECT

  Q_PROPERTY(QDateTime rangeTmin READ rangeTmin NOTIFY rangeTminChanged)
  Q_PROPERTY(QDateTime rangeTmax READ rangeTmax NOTIFY rangeTmaxChanged)

 public:
  explicit DdsBuffer(QObject *parent = nullptr);
  virtual ~DdsBuffer();

  QDateTime rangeTmin() const;
  QDateTime rangeTmax() const;

signals:
  void rangeTminChanged(QDateTime min);
  void rangeTmaxChanged(QDateTime max);
  void rangeTChanged();

public slots:

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

  virtual void updateBuffers() = 0;

  void clearBuffers();

  void init(int buffer_size);

protected:
  std::map<qml_enums::DimId, DdsDoubleBuffer *> m_buffers;
  DdsTimepointBuffer* m_time;
};