diff --git a/core/include/Data/DataSeries.h b/core/include/Data/DataSeries.h new file mode 100644 index 0000000..f4315f0 --- /dev/null +++ b/core/include/Data/DataSeries.h @@ -0,0 +1,50 @@ +#ifndef SCIQLOP_DATASERIES_H +#define SCIQLOP_DATASERIES_H + +#include +#include + +#include + +/** + * @brief The DataSeries class is the base (abstract) implementation of IDataSeries. + * + * It proposes to set a dimension for the values ​​data + * + * @tparam Dim The dimension of the values data + * + */ +template +class DataSeries : public IDataSeries { +public: + /// @sa IDataSeries::xAxisData() + std::shared_ptr > xAxisData() override { return m_XAxisData; } + + /// @sa IDataSeries::xAxisUnit() + QString xAxisUnit() const override { return m_XAxisUnit; } + + /// @return the values dataset + std::shared_ptr > valuesData() const { return m_ValuesData; } + + /// @sa IDataSeries::valuesUnit() + QString valuesUnit() const override { return m_ValuesUnit; } + +protected: + /// Protected ctor (DataSeries is abstract) + explicit DataSeries(std::shared_ptr > xAxisData, const QString &xAxisUnit, + std::shared_ptr > valuesData, const QString &valuesUnit) + : m_XAxisData{xAxisData}, + m_XAxisUnit{xAxisUnit}, + m_ValuesData{valuesData}, + m_ValuesUnit{valuesUnit} + { + } + +private: + std::shared_ptr > m_XAxisData; + QString m_XAxisUnit; + std::shared_ptr > m_ValuesData; + QString m_ValuesUnit; +}; + +#endif // SCIQLOP_DATASERIES_H diff --git a/core/include/Data/IDataSeries.h b/core/include/Data/IDataSeries.h new file mode 100644 index 0000000..0278a8e --- /dev/null +++ b/core/include/Data/IDataSeries.h @@ -0,0 +1,37 @@ +#ifndef SCIQLOP_IDATASERIES_H +#define SCIQLOP_IDATASERIES_H + +#include + +#include + +template +class ArrayData; + +/** + * @brief The IDataSeries aims to declare a data series. + * + * A data series is an entity that contains at least : + * - one dataset representing the x-axis + * - one dataset representing the values + * + * Each dataset is represented by an ArrayData, and is associated with a unit. + * + * An ArrayData can be unidimensional or two-dimensional, depending on the implementation of the + * IDataSeries. The x-axis dataset is always unidimensional. + * + * @sa ArrayData + */ +class IDataSeries { +public: + virtual ~IDataSeries() noexcept = default; + + /// Returns the x-axis dataset + virtual std::shared_ptr > xAxisData() = 0; + + virtual QString xAxisUnit() const = 0; + + virtual QString valuesUnit() const = 0; +}; + +#endif // SCIQLOP_IDATASERIES_H