IDataSeries.h
63 lines
| 1.6 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r125 | #ifndef SCIQLOP_IDATASERIES_H | ||
#define SCIQLOP_IDATASERIES_H | ||||
Alexandre Leroux
|
r308 | #include <Common/MetaTypes.h> | ||
Alexandre Leroux
|
r125 | |||
#include <memory> | ||||
r233 | #include <QString> | |||
Alexandre Leroux
|
r125 | template <int Dim> | ||
class ArrayData; | ||||
Alexandre Leroux
|
r177 | struct Unit { | ||
explicit Unit(const QString &name = {}, bool timeUnit = false) | ||||
: m_Name{name}, m_TimeUnit{timeUnit} | ||||
{ | ||||
} | ||||
QString m_Name; ///< Unit name | ||||
bool m_TimeUnit; ///< The unit is a unit of time | ||||
}; | ||||
Alexandre Leroux
|
r125 | /** | ||
* @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<ArrayData<1> > xAxisData() = 0; | ||||
Alexandre Leroux
|
r310 | /// Returns the x-axis dataset (as const) | ||
virtual const std::shared_ptr<ArrayData<1> > xAxisData() const = 0; | ||||
Alexandre Leroux
|
r177 | virtual Unit xAxisUnit() const = 0; | ||
Alexandre Leroux
|
r125 | |||
Alexandre Leroux
|
r177 | virtual Unit valuesUnit() const = 0; | ||
r233 | ||||
virtual void merge(IDataSeries *dataSeries) = 0; | ||||
Alexandre Leroux
|
r310 | |||
virtual std::unique_ptr<IDataSeries> clone() const = 0; | ||||
r364 | ||||
virtual void lockRead() = 0; | ||||
virtual void lockWrite() = 0; | ||||
virtual void unlock() = 0; | ||||
Alexandre Leroux
|
r125 | }; | ||
r233 | // Required for using shared_ptr in signals/slots | |||
Alexandre Leroux
|
r308 | SCIQLOP_REGISTER_META_TYPE(IDATASERIES_PTR_REGISTRY, std::shared_ptr<IDataSeries>) | ||
r233 | ||||
Alexandre Leroux
|
r125 | #endif // SCIQLOP_IDATASERIES_H | ||