From 3f8156a1a068120427c2baa9f0d35ff960b4c40c 2017-09-07 12:33:46 From: Alexandre Leroux Date: 2017-09-07 12:33:46 Subject: [PATCH] Creates method to retrieve nb points of a data series --- diff --git a/core/include/Data/ArrayData.h b/core/include/Data/ArrayData.h index a1aad29..ab14657 100644 --- a/core/include/Data/ArrayData.h +++ b/core/include/Data/ArrayData.h @@ -273,6 +273,13 @@ public: return m_Data.size() / m_NbComponents; } + /// @return the total size (i.e. number of values) of the array data + int totalSize() const + { + QReadLocker locker{&m_Lock}; + return m_Data.size(); + } + std::shared_ptr > sort(const std::vector &sortPermutation) { QReadLocker locker{&m_Lock}; diff --git a/core/include/Data/DataSeries.h b/core/include/Data/DataSeries.h index 63684ea..1669c91 100644 --- a/core/include/Data/DataSeries.h +++ b/core/include/Data/DataSeries.h @@ -146,6 +146,7 @@ public: /// @sa IDataSeries::valuesUnit() Unit valuesUnit() const override { return m_ValuesUnit; } + int nbPoints() const override { return m_XAxisData->totalSize() + m_ValuesData->totalSize(); } SqpRange range() const override { diff --git a/core/include/Data/IDataSeries.h b/core/include/Data/IDataSeries.h index aea7206..f7c2aa1 100644 --- a/core/include/Data/IDataSeries.h +++ b/core/include/Data/IDataSeries.h @@ -64,6 +64,10 @@ public: virtual std::shared_ptr subDataSeries(const SqpRange &range) = 0; virtual std::unique_ptr clone() const = 0; + + /// @return the total number of points contained in the data series + virtual int nbPoints() const = 0; + virtual SqpRange range() const = 0; // ///////// //