@@ -0,0 +1,50 | |||
|
1 | #ifndef SCIQLOP_DATASERIES_H | |
|
2 | #define SCIQLOP_DATASERIES_H | |
|
3 | ||
|
4 | #include <Data/ArrayData.h> | |
|
5 | #include <Data/IDataSeries.h> | |
|
6 | ||
|
7 | #include <memory> | |
|
8 | ||
|
9 | /** | |
|
10 | * @brief The DataSeries class is the base (abstract) implementation of IDataSeries. | |
|
11 | * | |
|
12 | * It proposes to set a dimension for the values data | |
|
13 | * | |
|
14 | * @tparam Dim The dimension of the values data | |
|
15 | * | |
|
16 | */ | |
|
17 | template <int Dim> | |
|
18 | class DataSeries : public IDataSeries { | |
|
19 | public: | |
|
20 | /// @sa IDataSeries::xAxisData() | |
|
21 | std::shared_ptr<ArrayData<1> > xAxisData() override { return m_XAxisData; } | |
|
22 | ||
|
23 | /// @sa IDataSeries::xAxisUnit() | |
|
24 | QString xAxisUnit() const override { return m_XAxisUnit; } | |
|
25 | ||
|
26 | /// @return the values dataset | |
|
27 | std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; } | |
|
28 | ||
|
29 | /// @sa IDataSeries::valuesUnit() | |
|
30 | QString valuesUnit() const override { return m_ValuesUnit; } | |
|
31 | ||
|
32 | protected: | |
|
33 | /// Protected ctor (DataSeries is abstract) | |
|
34 | explicit DataSeries(std::shared_ptr<ArrayData<1> > xAxisData, const QString &xAxisUnit, | |
|
35 | std::shared_ptr<ArrayData<Dim> > valuesData, const QString &valuesUnit) | |
|
36 | : m_XAxisData{xAxisData}, | |
|
37 | m_XAxisUnit{xAxisUnit}, | |
|
38 | m_ValuesData{valuesData}, | |
|
39 | m_ValuesUnit{valuesUnit} | |
|
40 | { | |
|
41 | } | |
|
42 | ||
|
43 | private: | |
|
44 | std::shared_ptr<ArrayData<1> > m_XAxisData; | |
|
45 | QString m_XAxisUnit; | |
|
46 | std::shared_ptr<ArrayData<Dim> > m_ValuesData; | |
|
47 | QString m_ValuesUnit; | |
|
48 | }; | |
|
49 | ||
|
50 | #endif // SCIQLOP_DATASERIES_H |
@@ -0,0 +1,37 | |||
|
1 | #ifndef SCIQLOP_IDATASERIES_H | |
|
2 | #define SCIQLOP_IDATASERIES_H | |
|
3 | ||
|
4 | #include <QString> | |
|
5 | ||
|
6 | #include <memory> | |
|
7 | ||
|
8 | template <int Dim> | |
|
9 | class ArrayData; | |
|
10 | ||
|
11 | /** | |
|
12 | * @brief The IDataSeries aims to declare a data series. | |
|
13 | * | |
|
14 | * A data series is an entity that contains at least : | |
|
15 | * - one dataset representing the x-axis | |
|
16 | * - one dataset representing the values | |
|
17 | * | |
|
18 | * Each dataset is represented by an ArrayData, and is associated with a unit. | |
|
19 | * | |
|
20 | * An ArrayData can be unidimensional or two-dimensional, depending on the implementation of the | |
|
21 | * IDataSeries. The x-axis dataset is always unidimensional. | |
|
22 | * | |
|
23 | * @sa ArrayData | |
|
24 | */ | |
|
25 | class IDataSeries { | |
|
26 | public: | |
|
27 | virtual ~IDataSeries() noexcept = default; | |
|
28 | ||
|
29 | /// Returns the x-axis dataset | |
|
30 | virtual std::shared_ptr<ArrayData<1> > xAxisData() = 0; | |
|
31 | ||
|
32 | virtual QString xAxisUnit() const = 0; | |
|
33 | ||
|
34 | virtual QString valuesUnit() const = 0; | |
|
35 | }; | |
|
36 | ||
|
37 | #endif // SCIQLOP_IDATASERIES_H |
General Comments 0
You need to be logged in to leave comments.
Login now