##// END OF EJS Templates
Makes clear() and size() methods compatible with two-dimensional ArrayData
Alexandre Leroux -
r502:49305aa35689
parent child
Show More
@@ -146,7 +146,8 public:
146 }
146 }
147 }
147 }
148
148
149 template <int D = Dim, typename = std::enable_if_t<D == 1> >
149 /// @return the size (i.e. number of values) of a single component
150 /// @remarks in a case of a two-dimensional ArrayData, each component has the same size
150 int size() const
151 int size() const
151 {
152 {
152 QReadLocker locker{&m_Lock};
153 QReadLocker locker{&m_Lock};
@@ -170,13 +171,15 public:
170 return std::make_shared<ArrayData<Dim> >(std::move(sortedData));
171 return std::make_shared<ArrayData<Dim> >(std::move(sortedData));
171 }
172 }
172
173
173 template <int D = Dim, typename = std::enable_if_t<D == 1> >
174 void clear()
174 void clear()
175 {
175 {
176 QWriteLocker locker{&m_Lock};
176 QWriteLocker locker{&m_Lock};
177 m_Data[0].clear();
178 }
179
177
178 auto nbComponents = m_Data.size();
179 for (auto i = 0; i < nbComponents; ++i) {
180 m_Data[i].clear();
181 }
182 }
180
183
181 private:
184 private:
182 QVector<QVector<double> > m_Data;
185 QVector<QVector<double> > m_Data;
General Comments 0
You need to be logged in to leave comments. Login now