From 2be6c7467d6b7c71da4b4e4e33585671b75c8b35 2017-08-31 10:28:46 From: Alexandre Leroux Date: 2017-08-31 10:28:46 Subject: [PATCH] Adds erase() method for ArrayData and DataSeries --- diff --git a/core/include/Data/ArrayData.h b/core/include/Data/ArrayData.h index 226bc18..5125f6b 100644 --- a/core/include/Data/ArrayData.h +++ b/core/include/Data/ArrayData.h @@ -296,6 +296,16 @@ public: m_Data, m_NbComponents, false)}}; } + void erase(ArrayDataIterator first, ArrayDataIterator last) + { + auto firstImpl = dynamic_cast *>(first->impl()); + auto lastImpl = dynamic_cast *>(last->impl()); + + if (firstImpl && lastImpl) { + m_Data.erase(firstImpl->m_It, lastImpl->m_It); + } + } + /// Inserts at the end of the array data the values passed as a parameter. This /// method is intended to be used in the context of generating a back insert iterator, or only /// if it's ensured that the total size of the vector is consistent with the number of diff --git a/core/include/Data/DataSeries.h b/core/include/Data/DataSeries.h index 8ab0160..b82e7d9 100644 --- a/core/include/Data/DataSeries.h +++ b/core/include/Data/DataSeries.h @@ -191,6 +191,18 @@ public: std::make_unique >(*this, false)}}; } + void erase(DataSeriesIterator first, DataSeriesIterator last) + { + auto firstImpl + = dynamic_cast *>(first->impl()); + auto lastImpl = dynamic_cast *>(last->impl()); + + if (firstImpl && lastImpl) { + m_XAxisData->erase(firstImpl->m_XIt, lastImpl->m_XIt); + m_ValuesData->erase(firstImpl->m_ValuesIt, lastImpl->m_ValuesIt); + } + } + /// @sa IDataSeries::minXAxisData() DataSeriesIterator minXAxisData(double minXAxisData) const override {