##// END OF EJS Templates
Updates merge() method (2)...
Alexandre Leroux -
r623:ae1634210b26
parent child
Show More
@@ -235,6 +235,17 public:
235 235 m_Data, m_NbComponents, false)}};
236 236 }
237 237
238 /// Inserts at the end of the array data the values passed as a parameter. This
239 /// method is intended to be used in the context of generating a back insert iterator, or only
240 /// if it's ensured that the total size of the vector is consistent with the number of
241 /// components of the array data
242 /// @param values the values to insert
243 /// @sa http://en.cppreference.com/w/cpp/iterator/back_inserter
244 void push_back(const QVector<double> &values)
245 {
246 Q_ASSERT(values.size() % m_NbComponents == 0);
247 m_Data.append(values);
248 }
238 249
239 250 /**
240 251 * @return the data at a specified index
@@ -91,6 +91,10 class SCIQLOP_CORE_EXPORT DataSeries : public IDataSeries {
91 91 friend class DataSeriesMergeHelper;
92 92
93 93 public:
94 /// Tag needed to define the push_back() method
95 /// @sa push_back()
96 using value_type = DataSeriesIteratorValue;
97
94 98 /// @sa IDataSeries::xAxisData()
95 99 std::shared_ptr<ArrayData<1> > xAxisData() override { return m_XAxisData; }
96 100 const std::shared_ptr<ArrayData<1> > xAxisData() const { return m_XAxisData; }
@@ -230,6 +234,22 public:
230 234 virtual void lockWrite() { m_Lock.lockForWrite(); }
231 235 virtual void unlock() { m_Lock.unlock(); }
232 236
237 // ///// //
238 // Other //
239 // ///// //
240
241 /// Inserts at the end of the data series the value of the iterator passed as a parameter. This
242 /// method is intended to be used in the context of generating a back insert iterator
243 /// @param iteratorValue the iterator value containing the values to insert
244 /// @sa http://en.cppreference.com/w/cpp/iterator/back_inserter
245 /// @sa merge()
246 /// @sa value_type
247 void push_back(const value_type &iteratorValue)
248 {
249 m_XAxisData->push_back(QVector<double>{iteratorValue.x()});
250 m_ValuesData->push_back(iteratorValue.values());
251 }
252
233 253 protected:
234 254 /// Protected ctor (DataSeries is abstract). The vectors must have the same size, otherwise a
235 255 /// DataSeries with no values will be created.
General Comments 0
You need to be logged in to leave comments. Login now