##// END OF EJS Templates
Merge branch 'feature/MinMaxVariable' into develop
Alexandre Leroux -
r602:91bcf3ba1822 merge
parent child
Show More
@@ -0,0 +1,82
1 #ifndef SCIQLOP_DATASERIESITERATOR_H
2 #define SCIQLOP_DATASERIESITERATOR_H
3
4 #include "CoreGlobal.h"
5
6 #include <memory>
7
8 /**
9 * @brief The DataSeriesIteratorValue class represents the current value of a data series iterator.
10 * It offers standard access methods for the data in the series (x-axis, values), but it is up to
11 * each series to define its own implementation of how to retrieve this data, by implementing the
12 * DataSeriesIteratorValue::Impl interface
13 *
14 * @sa DataSeriesIterator
15 */
16 class SCIQLOP_CORE_EXPORT DataSeriesIteratorValue {
17 public:
18 struct Impl {
19 virtual ~Impl() noexcept = default;
20 virtual std::unique_ptr<Impl> clone() const = 0;
21 virtual bool equals(const Impl &other) const = 0;
22 virtual void next() = 0;
23 virtual void prev() = 0;
24 virtual double x() const = 0;
25 virtual double value() const = 0;
26 virtual double value(int componentIndex) const = 0;
27 };
28
29 explicit DataSeriesIteratorValue(std::unique_ptr<Impl> impl);
30 DataSeriesIteratorValue(const DataSeriesIteratorValue &other);
31 DataSeriesIteratorValue(DataSeriesIteratorValue &&other) = default;
32 DataSeriesIteratorValue &operator=(DataSeriesIteratorValue other);
33
34 bool equals(const DataSeriesIteratorValue &other) const;
35
36 /// Advances to the next value
37 void next();
38 /// Moves back to the previous value
39 void prev();
40 /// Gets x-axis data
41 double x() const;
42 /// Gets value data
43 double value() const;
44 /// Gets value data depending on an index
45 double value(int componentIndex) const;
46
47 private:
48 std::unique_ptr<Impl> m_Impl;
49 };
50
51 /**
52 * @brief The DataSeriesIterator class represents an iterator used for data series. It defines all
53 * operators needed for a standard forward iterator
54 * @sa http://www.cplusplus.com/reference/iterator/
55 */
56 class SCIQLOP_CORE_EXPORT DataSeriesIterator {
57 public:
58 using iterator_category = std::forward_iterator_tag;
59 using value_type = const DataSeriesIteratorValue;
60 using difference_type = std::ptrdiff_t;
61 using pointer = value_type *;
62 using reference = value_type &;
63
64 explicit DataSeriesIterator(DataSeriesIteratorValue value);
65 virtual ~DataSeriesIterator() noexcept = default;
66 DataSeriesIterator(const DataSeriesIterator &) = default;
67 DataSeriesIterator(DataSeriesIterator &&) = default;
68 DataSeriesIterator &operator=(const DataSeriesIterator &) = default;
69 DataSeriesIterator &operator=(DataSeriesIterator &&) = default;
70
71 DataSeriesIterator &operator++();
72 DataSeriesIterator &operator--();
73 pointer operator->() const { return &m_CurrentValue; }
74 reference operator*() const { return m_CurrentValue; }
75 bool operator==(const DataSeriesIterator &other) const;
76 bool operator!=(const DataSeriesIterator &other) const;
77
78 private:
79 DataSeriesIteratorValue m_CurrentValue;
80 };
81
82 #endif // SCIQLOP_DATASERIESITERATOR_H
@@ -0,0 +1,75
1 #include "Data/DataSeriesIterator.h"
2
3 DataSeriesIteratorValue::DataSeriesIteratorValue(
4 std::unique_ptr<DataSeriesIteratorValue::Impl> impl)
5 : m_Impl{std::move(impl)}
6 {
7 }
8
9 DataSeriesIteratorValue::DataSeriesIteratorValue(const DataSeriesIteratorValue &other)
10 : m_Impl{other.m_Impl->clone()}
11 {
12 }
13
14 DataSeriesIteratorValue &DataSeriesIteratorValue::operator=(DataSeriesIteratorValue other)
15 {
16 std::swap(m_Impl, other.m_Impl);
17 return *this;
18 }
19
20 bool DataSeriesIteratorValue::equals(const DataSeriesIteratorValue &other) const
21 {
22 return m_Impl->equals(*other.m_Impl);
23 }
24
25 void DataSeriesIteratorValue::next()
26 {
27 m_Impl->next();
28 }
29
30 void DataSeriesIteratorValue::prev()
31 {
32 m_Impl->prev();
33 }
34
35 double DataSeriesIteratorValue::x() const
36 {
37 return m_Impl->x();
38 }
39
40 double DataSeriesIteratorValue::value() const
41 {
42 return m_Impl->value();
43 }
44
45 double DataSeriesIteratorValue::value(int componentIndex) const
46 {
47 return m_Impl->value(componentIndex);
48 }
49
50 DataSeriesIterator::DataSeriesIterator(DataSeriesIteratorValue value)
51 : m_CurrentValue{std::move(value)}
52 {
53 }
54
55 DataSeriesIterator &DataSeriesIterator::operator++()
56 {
57 m_CurrentValue.next();
58 return *this;
59 }
60
61 DataSeriesIterator &DataSeriesIterator::operator--()
62 {
63 m_CurrentValue.prev();
64 return *this;
65 }
66
67 bool DataSeriesIterator::operator==(const DataSeriesIterator &other) const
68 {
69 return m_CurrentValue.equals(other.m_CurrentValue);
70 }
71
72 bool DataSeriesIterator::operator!=(const DataSeriesIterator &other) const
73 {
74 return !(*this == other);
75 }
@@ -1,315 +1,328
1 #ifndef SCIQLOP_ARRAYDATA_H
1 #ifndef SCIQLOP_ARRAYDATA_H
2 #define SCIQLOP_ARRAYDATA_H
2 #define SCIQLOP_ARRAYDATA_H
3
3
4 #include <Common/SortUtils.h>
4 #include <Common/SortUtils.h>
5
5
6 #include <QReadLocker>
6 #include <QReadLocker>
7 #include <QReadWriteLock>
7 #include <QReadWriteLock>
8 #include <QVector>
8 #include <QVector>
9
9
10 #include <memory>
10 #include <memory>
11
11
12 template <int Dim>
12 template <int Dim>
13 class ArrayData;
13 class ArrayData;
14
14
15 using DataContainer = QVector<QVector<double> >;
15 using DataContainer = QVector<QVector<double> >;
16
16
17 namespace arraydata_detail {
17 namespace arraydata_detail {
18
18
19 /// Struct used to sort ArrayData
19 /// Struct used to sort ArrayData
20 template <int Dim>
20 template <int Dim>
21 struct Sort {
21 struct Sort {
22 static std::shared_ptr<ArrayData<Dim> > sort(const DataContainer &data,
22 static std::shared_ptr<ArrayData<Dim> > sort(const DataContainer &data,
23 const std::vector<int> &sortPermutation)
23 const std::vector<int> &sortPermutation)
24 {
24 {
25 auto nbComponents = data.size();
25 auto nbComponents = data.size();
26 auto sortedData = DataContainer(nbComponents);
26 auto sortedData = DataContainer(nbComponents);
27
27
28 for (auto i = 0; i < nbComponents; ++i) {
28 for (auto i = 0; i < nbComponents; ++i) {
29 sortedData[i] = SortUtils::sort(data.at(i), sortPermutation);
29 sortedData[i] = SortUtils::sort(data.at(i), sortPermutation);
30 }
30 }
31
31
32 return std::make_shared<ArrayData<Dim> >(std::move(sortedData));
32 return std::make_shared<ArrayData<Dim> >(std::move(sortedData));
33 }
33 }
34 };
34 };
35
35
36 /// Specialization for uni-dimensional ArrayData
36 /// Specialization for uni-dimensional ArrayData
37 template <>
37 template <>
38 struct Sort<1> {
38 struct Sort<1> {
39 static std::shared_ptr<ArrayData<1> > sort(const DataContainer &data,
39 static std::shared_ptr<ArrayData<1> > sort(const DataContainer &data,
40 const std::vector<int> &sortPermutation)
40 const std::vector<int> &sortPermutation)
41 {
41 {
42 return std::make_shared<ArrayData<1> >(SortUtils::sort(data.at(0), sortPermutation));
42 return std::make_shared<ArrayData<1> >(SortUtils::sort(data.at(0), sortPermutation));
43 }
43 }
44 };
44 };
45
45
46 } // namespace arraydata_detail
46 } // namespace arraydata_detail
47
47
48 /**
48 /**
49 * @brief The ArrayData class represents a dataset for a data series.
49 * @brief The ArrayData class represents a dataset for a data series.
50 *
50 *
51 * A dataset can be unidimensional or two-dimensional. This property is determined by the Dim
51 * A dataset can be unidimensional or two-dimensional. This property is determined by the Dim
52 * template-parameter. In a case of a two-dimensional dataset, each dataset component has the same
52 * template-parameter. In a case of a two-dimensional dataset, each dataset component has the same
53 * number of values
53 * number of values
54 *
54 *
55 * @tparam Dim the dimension of the ArrayData (one or two)
55 * @tparam Dim the dimension of the ArrayData (one or two)
56 * @sa IDataSeries
56 * @sa IDataSeries
57 */
57 */
58 template <int Dim>
58 template <int Dim>
59 class ArrayData {
59 class ArrayData {
60 public:
60 public:
61 class IteratorValue {
61 class IteratorValue {
62 public:
62 public:
63 explicit IteratorValue(const DataContainer &container, bool begin) : m_Its{}
63 explicit IteratorValue(const DataContainer &container, bool begin) : m_Its{}
64 {
64 {
65 for (auto i = 0; i < container.size(); ++i) {
65 for (auto i = 0; i < container.size(); ++i) {
66 m_Its.push_back(begin ? container.at(i).cbegin() : container.at(i).cend());
66 m_Its.push_back(begin ? container.at(i).cbegin() : container.at(i).cend());
67 }
67 }
68 }
68 }
69
69
70 double at(int index) const { return *m_Its.at(index); }
70 double at(int index) const { return *m_Its.at(index); }
71 double first() const { return *m_Its.front(); }
71 double first() const { return *m_Its.front(); }
72
72
73 void next()
73 void next()
74 {
74 {
75 for (auto &it : m_Its) {
75 for (auto &it : m_Its) {
76 ++it;
76 ++it;
77 }
77 }
78 }
78 }
79
79
80 void prev()
81 {
82 for (auto &it : m_Its) {
83 --it;
84 }
85 }
86
80 bool operator==(const IteratorValue &other) const { return m_Its == other.m_Its; }
87 bool operator==(const IteratorValue &other) const { return m_Its == other.m_Its; }
81
88
82 private:
89 private:
83 std::vector<DataContainer::value_type::const_iterator> m_Its;
90 std::vector<DataContainer::value_type::const_iterator> m_Its;
84 };
91 };
85
92
86 class Iterator {
93 class Iterator {
87 public:
94 public:
88 using iterator_category = std::forward_iterator_tag;
95 using iterator_category = std::forward_iterator_tag;
89 using value_type = const IteratorValue;
96 using value_type = const IteratorValue;
90 using difference_type = std::ptrdiff_t;
97 using difference_type = std::ptrdiff_t;
91 using pointer = value_type *;
98 using pointer = value_type *;
92 using reference = value_type &;
99 using reference = value_type &;
93
100
94 Iterator(const DataContainer &container, bool begin) : m_CurrentValue{container, begin} {}
101 Iterator(const DataContainer &container, bool begin) : m_CurrentValue{container, begin} {}
95
102
96 virtual ~Iterator() noexcept = default;
103 virtual ~Iterator() noexcept = default;
97 Iterator(const Iterator &) = default;
104 Iterator(const Iterator &) = default;
98 Iterator(Iterator &&) = default;
105 Iterator(Iterator &&) = default;
99 Iterator &operator=(const Iterator &) = default;
106 Iterator &operator=(const Iterator &) = default;
100 Iterator &operator=(Iterator &&) = default;
107 Iterator &operator=(Iterator &&) = default;
101
108
102 Iterator &operator++()
109 Iterator &operator++()
103 {
110 {
104 m_CurrentValue.next();
111 m_CurrentValue.next();
105 return *this;
112 return *this;
106 }
113 }
107
114
115 Iterator &operator--()
116 {
117 m_CurrentValue.prev();
118 return *this;
119 }
120
108 pointer operator->() const { return &m_CurrentValue; }
121 pointer operator->() const { return &m_CurrentValue; }
109 reference operator*() const { return m_CurrentValue; }
122 reference operator*() const { return m_CurrentValue; }
110
123
111 bool operator==(const Iterator &other) const
124 bool operator==(const Iterator &other) const
112 {
125 {
113 return m_CurrentValue == other.m_CurrentValue;
126 return m_CurrentValue == other.m_CurrentValue;
114 }
127 }
115
128
116 bool operator!=(const Iterator &other) const { return !(*this == other); }
129 bool operator!=(const Iterator &other) const { return !(*this == other); }
117
130
118 private:
131 private:
119 IteratorValue m_CurrentValue;
132 IteratorValue m_CurrentValue;
120 };
133 };
121
134
122 // ///// //
135 // ///// //
123 // Ctors //
136 // Ctors //
124 // ///// //
137 // ///// //
125
138
126 /**
139 /**
127 * Ctor for a unidimensional ArrayData
140 * Ctor for a unidimensional ArrayData
128 * @param data the data the ArrayData will hold
141 * @param data the data the ArrayData will hold
129 */
142 */
130 template <int D = Dim, typename = std::enable_if_t<D == 1> >
143 template <int D = Dim, typename = std::enable_if_t<D == 1> >
131 explicit ArrayData(QVector<double> data) : m_Data{1, QVector<double>{}}
144 explicit ArrayData(QVector<double> data) : m_Data{1, QVector<double>{}}
132 {
145 {
133 m_Data[0] = std::move(data);
146 m_Data[0] = std::move(data);
134 }
147 }
135
148
136 /**
149 /**
137 * Ctor for a two-dimensional ArrayData. The number of components (number of vectors) must be
150 * Ctor for a two-dimensional ArrayData. The number of components (number of vectors) must be
138 * greater than 2 and each component must have the same number of values
151 * greater than 2 and each component must have the same number of values
139 * @param data the data the ArrayData will hold
152 * @param data the data the ArrayData will hold
140 * @throws std::invalid_argument if the number of components is less than 2
153 * @throws std::invalid_argument if the number of components is less than 2
141 * @remarks if the number of values is not the same for each component, no value is set
154 * @remarks if the number of values is not the same for each component, no value is set
142 */
155 */
143 template <int D = Dim, typename = std::enable_if_t<D == 2> >
156 template <int D = Dim, typename = std::enable_if_t<D == 2> >
144 explicit ArrayData(DataContainer data)
157 explicit ArrayData(DataContainer data)
145 {
158 {
146 auto nbComponents = data.size();
159 auto nbComponents = data.size();
147 if (nbComponents < 2) {
160 if (nbComponents < 2) {
148 throw std::invalid_argument{
161 throw std::invalid_argument{
149 QString{"A multidimensional ArrayData must have at least 2 components (found: %1"}
162 QString{"A multidimensional ArrayData must have at least 2 components (found: %1"}
150 .arg(data.size())
163 .arg(data.size())
151 .toStdString()};
164 .toStdString()};
152 }
165 }
153
166
154 auto nbValues = data.front().size();
167 auto nbValues = data.front().size();
155 if (std::all_of(data.cbegin(), data.cend(), [nbValues](const auto &component) {
168 if (std::all_of(data.cbegin(), data.cend(), [nbValues](const auto &component) {
156 return component.size() == nbValues;
169 return component.size() == nbValues;
157 })) {
170 })) {
158 m_Data = std::move(data);
171 m_Data = std::move(data);
159 }
172 }
160 else {
173 else {
161 m_Data = DataContainer{nbComponents, QVector<double>{}};
174 m_Data = DataContainer{nbComponents, QVector<double>{}};
162 }
175 }
163 }
176 }
164
177
165 /// Copy ctor
178 /// Copy ctor
166 explicit ArrayData(const ArrayData &other)
179 explicit ArrayData(const ArrayData &other)
167 {
180 {
168 QReadLocker otherLocker{&other.m_Lock};
181 QReadLocker otherLocker{&other.m_Lock};
169 m_Data = other.m_Data;
182 m_Data = other.m_Data;
170 }
183 }
171
184
172 // /////////////// //
185 // /////////////// //
173 // General methods //
186 // General methods //
174 // /////////////// //
187 // /////////////// //
175
188
176 /**
189 /**
177 * Merges into the array data an other array data. The two array datas must have the same number
190 * Merges into the array data an other array data. The two array datas must have the same number
178 * of components so the merge can be done
191 * of components so the merge can be done
179 * @param other the array data to merge with
192 * @param other the array data to merge with
180 * @param prepend if true, the other array data is inserted at the beginning, otherwise it is
193 * @param prepend if true, the other array data is inserted at the beginning, otherwise it is
181 * inserted at the end
194 * inserted at the end
182 */
195 */
183 void add(const ArrayData<Dim> &other, bool prepend = false)
196 void add(const ArrayData<Dim> &other, bool prepend = false)
184 {
197 {
185 QWriteLocker locker{&m_Lock};
198 QWriteLocker locker{&m_Lock};
186 QReadLocker otherLocker{&other.m_Lock};
199 QReadLocker otherLocker{&other.m_Lock};
187
200
188 auto nbComponents = m_Data.size();
201 auto nbComponents = m_Data.size();
189 if (nbComponents != other.m_Data.size()) {
202 if (nbComponents != other.m_Data.size()) {
190 return;
203 return;
191 }
204 }
192
205
193 for (auto componentIndex = 0; componentIndex < nbComponents; ++componentIndex) {
206 for (auto componentIndex = 0; componentIndex < nbComponents; ++componentIndex) {
194 if (prepend) {
207 if (prepend) {
195 const auto &otherData = other.data(componentIndex);
208 const auto &otherData = other.data(componentIndex);
196 const auto otherDataSize = otherData.size();
209 const auto otherDataSize = otherData.size();
197
210
198 auto &data = m_Data[componentIndex];
211 auto &data = m_Data[componentIndex];
199 data.insert(data.begin(), otherDataSize, 0.);
212 data.insert(data.begin(), otherDataSize, 0.);
200
213
201 for (auto i = 0; i < otherDataSize; ++i) {
214 for (auto i = 0; i < otherDataSize; ++i) {
202 data.replace(i, otherData.at(i));
215 data.replace(i, otherData.at(i));
203 }
216 }
204 }
217 }
205 else {
218 else {
206 m_Data[componentIndex] += other.data(componentIndex);
219 m_Data[componentIndex] += other.data(componentIndex);
207 }
220 }
208 }
221 }
209 }
222 }
210
223
211 void clear()
224 void clear()
212 {
225 {
213 QWriteLocker locker{&m_Lock};
226 QWriteLocker locker{&m_Lock};
214
227
215 auto nbComponents = m_Data.size();
228 auto nbComponents = m_Data.size();
216 for (auto i = 0; i < nbComponents; ++i) {
229 for (auto i = 0; i < nbComponents; ++i) {
217 m_Data[i].clear();
230 m_Data[i].clear();
218 }
231 }
219 }
232 }
220
233
221 int componentCount() const noexcept { return m_Data.size(); }
234 int componentCount() const noexcept { return m_Data.size(); }
222
235
223 /**
236 /**
224 * @return the data of a component
237 * @return the data of a component
225 * @param componentIndex the index of the component to retrieve the data
238 * @param componentIndex the index of the component to retrieve the data
226 * @return the component's data, empty vector if the index is invalid
239 * @return the component's data, empty vector if the index is invalid
227 */
240 */
228 QVector<double> data(int componentIndex) const noexcept
241 QVector<double> data(int componentIndex) const noexcept
229 {
242 {
230 QReadLocker locker{&m_Lock};
243 QReadLocker locker{&m_Lock};
231
244
232 return (componentIndex >= 0 && componentIndex < m_Data.size()) ? m_Data.at(componentIndex)
245 return (componentIndex >= 0 && componentIndex < m_Data.size()) ? m_Data.at(componentIndex)
233 : QVector<double>{};
246 : QVector<double>{};
234 }
247 }
235
248
236 /// @return the size (i.e. number of values) of a single component
249 /// @return the size (i.e. number of values) of a single component
237 /// @remarks in a case of a two-dimensional ArrayData, each component has the same size
250 /// @remarks in a case of a two-dimensional ArrayData, each component has the same size
238 int size() const
251 int size() const
239 {
252 {
240 QReadLocker locker{&m_Lock};
253 QReadLocker locker{&m_Lock};
241 return m_Data[0].size();
254 return m_Data[0].size();
242 }
255 }
243
256
244 std::shared_ptr<ArrayData<Dim> > sort(const std::vector<int> &sortPermutation)
257 std::shared_ptr<ArrayData<Dim> > sort(const std::vector<int> &sortPermutation)
245 {
258 {
246 QReadLocker locker{&m_Lock};
259 QReadLocker locker{&m_Lock};
247 return arraydata_detail::Sort<Dim>::sort(m_Data, sortPermutation);
260 return arraydata_detail::Sort<Dim>::sort(m_Data, sortPermutation);
248 }
261 }
249
262
250 // ///////// //
263 // ///////// //
251 // Iterators //
264 // Iterators //
252 // ///////// //
265 // ///////// //
253
266
254 Iterator cbegin() const { return Iterator{m_Data, true}; }
267 Iterator cbegin() const { return Iterator{m_Data, true}; }
255 Iterator cend() const { return Iterator{m_Data, false}; }
268 Iterator cend() const { return Iterator{m_Data, false}; }
256
269
257 // ///////////// //
270 // ///////////// //
258 // 1-dim methods //
271 // 1-dim methods //
259 // ///////////// //
272 // ///////////// //
260
273
261 /**
274 /**
262 * @return the data at a specified index
275 * @return the data at a specified index
263 * @remarks index must be a valid position
276 * @remarks index must be a valid position
264 * @remarks this method is only available for a unidimensional ArrayData
277 * @remarks this method is only available for a unidimensional ArrayData
265 */
278 */
266 template <int D = Dim, typename = std::enable_if_t<D == 1> >
279 template <int D = Dim, typename = std::enable_if_t<D == 1> >
267 double at(int index) const noexcept
280 double at(int index) const noexcept
268 {
281 {
269 QReadLocker locker{&m_Lock};
282 QReadLocker locker{&m_Lock};
270 return m_Data[0].at(index);
283 return m_Data[0].at(index);
271 }
284 }
272
285
273 /**
286 /**
274 * @return the data as a vector, as a const reference
287 * @return the data as a vector, as a const reference
275 * @remarks this method is only available for a unidimensional ArrayData
288 * @remarks this method is only available for a unidimensional ArrayData
276 */
289 */
277 template <int D = Dim, typename = std::enable_if_t<D == 1> >
290 template <int D = Dim, typename = std::enable_if_t<D == 1> >
278 const QVector<double> &cdata() const noexcept
291 const QVector<double> &cdata() const noexcept
279 {
292 {
280 QReadLocker locker{&m_Lock};
293 QReadLocker locker{&m_Lock};
281 return m_Data.at(0);
294 return m_Data.at(0);
282 }
295 }
283
296
284 /**
297 /**
285 * @return the data as a vector
298 * @return the data as a vector
286 * @remarks this method is only available for a unidimensional ArrayData
299 * @remarks this method is only available for a unidimensional ArrayData
287 */
300 */
288 template <int D = Dim, typename = std::enable_if_t<D == 1> >
301 template <int D = Dim, typename = std::enable_if_t<D == 1> >
289 QVector<double> data() const noexcept
302 QVector<double> data() const noexcept
290 {
303 {
291 QReadLocker locker{&m_Lock};
304 QReadLocker locker{&m_Lock};
292 return m_Data[0];
305 return m_Data[0];
293 }
306 }
294
307
295 // ///////////// //
308 // ///////////// //
296 // 2-dim methods //
309 // 2-dim methods //
297 // ///////////// //
310 // ///////////// //
298
311
299 /**
312 /**
300 * @return the data
313 * @return the data
301 * @remarks this method is only available for a two-dimensional ArrayData
314 * @remarks this method is only available for a two-dimensional ArrayData
302 */
315 */
303 template <int D = Dim, typename = std::enable_if_t<D == 2> >
316 template <int D = Dim, typename = std::enable_if_t<D == 2> >
304 DataContainer data() const noexcept
317 DataContainer data() const noexcept
305 {
318 {
306 QReadLocker locker{&m_Lock};
319 QReadLocker locker{&m_Lock};
307 return m_Data;
320 return m_Data;
308 }
321 }
309
322
310 private:
323 private:
311 DataContainer m_Data;
324 DataContainer m_Data;
312 mutable QReadWriteLock m_Lock;
325 mutable QReadWriteLock m_Lock;
313 };
326 };
314
327
315 #endif // SCIQLOP_ARRAYDATA_H
328 #endif // SCIQLOP_ARRAYDATA_H
@@ -1,293 +1,306
1 #ifndef SCIQLOP_DATASERIES_H
1 #ifndef SCIQLOP_DATASERIES_H
2 #define SCIQLOP_DATASERIES_H
2 #define SCIQLOP_DATASERIES_H
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Common/SortUtils.h>
6 #include <Common/SortUtils.h>
7
7
8 #include <Data/ArrayData.h>
8 #include <Data/ArrayData.h>
9 #include <Data/IDataSeries.h>
9 #include <Data/IDataSeries.h>
10
10
11 #include <QLoggingCategory>
11 #include <QLoggingCategory>
12 #include <QReadLocker>
12 #include <QReadLocker>
13 #include <QReadWriteLock>
13 #include <QReadWriteLock>
14 #include <memory>
14 #include <memory>
15
15
16 // We don't use the Qt macro since the log is used in the header file, which causes multiple log
16 // We don't use the Qt macro since the log is used in the header file, which causes multiple log
17 // definitions with inheritance. Inline method is used instead
17 // definitions with inheritance. Inline method is used instead
18 inline const QLoggingCategory &LOG_DataSeries()
18 inline const QLoggingCategory &LOG_DataSeries()
19 {
19 {
20 static const QLoggingCategory category{"DataSeries"};
20 static const QLoggingCategory category{"DataSeries"};
21 return category;
21 return category;
22 }
22 }
23
23
24 template <int Dim>
25 class DataSeries;
26
27 namespace dataseries_detail {
28
29 template <int Dim>
30 class IteratorValue : public DataSeriesIteratorValue::Impl {
31 public:
32 explicit IteratorValue(const DataSeries<Dim> &dataSeries, bool begin)
33 : m_XIt(begin ? dataSeries.xAxisData()->cbegin() : dataSeries.xAxisData()->cend()),
34 m_ValuesIt(begin ? dataSeries.valuesData()->cbegin()
35 : dataSeries.valuesData()->cend())
36 {
37 }
38 IteratorValue(const IteratorValue &other) = default;
39
40 std::unique_ptr<DataSeriesIteratorValue::Impl> clone() const override
41 {
42 return std::make_unique<IteratorValue<Dim> >(*this);
43 }
44
45 bool equals(const DataSeriesIteratorValue::Impl &other) const override try {
46 const auto &otherImpl = dynamic_cast<const IteratorValue &>(other);
47 return std::tie(m_XIt, m_ValuesIt) == std::tie(otherImpl.m_XIt, otherImpl.m_ValuesIt);
48 }
49 catch (const std::bad_cast &) {
50 return false;
51 }
52
53 void next() override
54 {
55 ++m_XIt;
56 ++m_ValuesIt;
57 }
58
59 void prev() override
60 {
61 --m_XIt;
62 --m_ValuesIt;
63 }
64
65 double x() const override { return m_XIt->at(0); }
66 double value() const override { return m_ValuesIt->at(0); }
67 double value(int componentIndex) const override { return m_ValuesIt->at(componentIndex); }
68
69 private:
70 ArrayData<1>::Iterator m_XIt;
71 typename ArrayData<Dim>::Iterator m_ValuesIt;
72 };
73 } // namespace dataseries_detail
74
24 /**
75 /**
25 * @brief The DataSeries class is the base (abstract) implementation of IDataSeries.
76 * @brief The DataSeries class is the base (abstract) implementation of IDataSeries.
26 *
77 *
27 * It proposes to set a dimension for the values ​​data.
78 * It proposes to set a dimension for the values ​​data.
28 *
79 *
29 * A DataSeries is always sorted on its x-axis data.
80 * A DataSeries is always sorted on its x-axis data.
30 *
81 *
31 * @tparam Dim The dimension of the values data
82 * @tparam Dim The dimension of the values data
32 *
83 *
33 */
84 */
34 template <int Dim>
85 template <int Dim>
35 class SCIQLOP_CORE_EXPORT DataSeries : public IDataSeries {
86 class SCIQLOP_CORE_EXPORT DataSeries : public IDataSeries {
36 public:
87 public:
37 class IteratorValue {
38 public:
39 explicit IteratorValue(const DataSeries &dataSeries, bool begin)
40 : m_XIt(begin ? dataSeries.xAxisData()->cbegin() : dataSeries.xAxisData()->cend()),
41 m_ValuesIt(begin ? dataSeries.valuesData()->cbegin()
42 : dataSeries.valuesData()->cend())
43 {
44 }
45
46 double x() const { return m_XIt->at(0); }
47 double value() const { return m_ValuesIt->at(0); }
48 double value(int componentIndex) const { return m_ValuesIt->at(componentIndex); }
49
50 void next()
51 {
52 ++m_XIt;
53 ++m_ValuesIt;
54 }
55
56 bool operator==(const IteratorValue &other) const
57 {
58 return std::tie(m_XIt, m_ValuesIt) == std::tie(other.m_XIt, other.m_ValuesIt);
59 }
60
61 private:
62 ArrayData<1>::Iterator m_XIt;
63 typename ArrayData<Dim>::Iterator m_ValuesIt;
64 };
65
66 class Iterator {
67 public:
68 using iterator_category = std::forward_iterator_tag;
69 using value_type = const IteratorValue;
70 using difference_type = std::ptrdiff_t;
71 using pointer = value_type *;
72 using reference = value_type &;
73
74 Iterator(const DataSeries &dataSeries, bool begin) : m_CurrentValue{dataSeries, begin} {}
75 virtual ~Iterator() noexcept = default;
76 Iterator(const Iterator &) = default;
77 Iterator(Iterator &&) = default;
78 Iterator &operator=(const Iterator &) = default;
79 Iterator &operator=(Iterator &&) = default;
80
81 Iterator &operator++()
82 {
83 m_CurrentValue.next();
84 return *this;
85 }
86
87 pointer operator->() const { return &m_CurrentValue; }
88
89 reference operator*() const { return m_CurrentValue; }
90
91 bool operator==(const Iterator &other) const
92 {
93 return m_CurrentValue == other.m_CurrentValue;
94 }
95
96 bool operator!=(const Iterator &other) const { return !(*this == other); }
97
98 private:
99 IteratorValue m_CurrentValue;
100 };
101
102 /// @sa IDataSeries::xAxisData()
88 /// @sa IDataSeries::xAxisData()
103 std::shared_ptr<ArrayData<1> > xAxisData() override { return m_XAxisData; }
89 std::shared_ptr<ArrayData<1> > xAxisData() override { return m_XAxisData; }
104 const std::shared_ptr<ArrayData<1> > xAxisData() const { return m_XAxisData; }
90 const std::shared_ptr<ArrayData<1> > xAxisData() const { return m_XAxisData; }
105
91
106 /// @sa IDataSeries::xAxisUnit()
92 /// @sa IDataSeries::xAxisUnit()
107 Unit xAxisUnit() const override { return m_XAxisUnit; }
93 Unit xAxisUnit() const override { return m_XAxisUnit; }
108
94
109 /// @return the values dataset
95 /// @return the values dataset
110 std::shared_ptr<ArrayData<Dim> > valuesData() { return m_ValuesData; }
96 std::shared_ptr<ArrayData<Dim> > valuesData() { return m_ValuesData; }
111 const std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; }
97 const std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; }
112
98
113 /// @sa IDataSeries::valuesUnit()
99 /// @sa IDataSeries::valuesUnit()
114 Unit valuesUnit() const override { return m_ValuesUnit; }
100 Unit valuesUnit() const override { return m_ValuesUnit; }
115
101
116
102
117 SqpRange range() const override
103 SqpRange range() const override
118 {
104 {
119 if (!m_XAxisData->cdata().isEmpty()) {
105 if (!m_XAxisData->cdata().isEmpty()) {
120 return SqpRange{m_XAxisData->cdata().first(), m_XAxisData->cdata().last()};
106 return SqpRange{m_XAxisData->cdata().first(), m_XAxisData->cdata().last()};
121 }
107 }
122
108
123 return SqpRange{};
109 return SqpRange{};
124 }
110 }
125
111
126 void clear()
112 void clear()
127 {
113 {
128 m_XAxisData->clear();
114 m_XAxisData->clear();
129 m_ValuesData->clear();
115 m_ValuesData->clear();
130 }
116 }
131
117
132 /// Merges into the data series an other data series
118 /// Merges into the data series an other data series
133 /// @remarks the data series to merge with is cleared after the operation
119 /// @remarks the data series to merge with is cleared after the operation
134 void merge(IDataSeries *dataSeries) override
120 void merge(IDataSeries *dataSeries) override
135 {
121 {
136 dataSeries->lockWrite();
122 dataSeries->lockWrite();
137 lockWrite();
123 lockWrite();
138
124
139 if (auto other = dynamic_cast<DataSeries<Dim> *>(dataSeries)) {
125 if (auto other = dynamic_cast<DataSeries<Dim> *>(dataSeries)) {
140 const auto &otherXAxisData = other->xAxisData()->cdata();
126 const auto &otherXAxisData = other->xAxisData()->cdata();
141 const auto &xAxisData = m_XAxisData->cdata();
127 const auto &xAxisData = m_XAxisData->cdata();
142
128
143 // As data series are sorted, we can improve performances of merge, by call the sort
129 // As data series are sorted, we can improve performances of merge, by call the sort
144 // method only if the two data series overlap.
130 // method only if the two data series overlap.
145 if (!otherXAxisData.empty()) {
131 if (!otherXAxisData.empty()) {
146 auto firstValue = otherXAxisData.front();
132 auto firstValue = otherXAxisData.front();
147 auto lastValue = otherXAxisData.back();
133 auto lastValue = otherXAxisData.back();
148
134
149 auto xAxisDataBegin = xAxisData.cbegin();
135 auto xAxisDataBegin = xAxisData.cbegin();
150 auto xAxisDataEnd = xAxisData.cend();
136 auto xAxisDataEnd = xAxisData.cend();
151
137
152 bool prepend;
138 bool prepend;
153 bool sortNeeded;
139 bool sortNeeded;
154
140
155 if (std::lower_bound(xAxisDataBegin, xAxisDataEnd, firstValue) == xAxisDataEnd) {
141 if (std::lower_bound(xAxisDataBegin, xAxisDataEnd, firstValue) == xAxisDataEnd) {
156 // Other data series if after data series
142 // Other data series if after data series
157 prepend = false;
143 prepend = false;
158 sortNeeded = false;
144 sortNeeded = false;
159 }
145 }
160 else if (std::upper_bound(xAxisDataBegin, xAxisDataEnd, lastValue)
146 else if (std::upper_bound(xAxisDataBegin, xAxisDataEnd, lastValue)
161 == xAxisDataBegin) {
147 == xAxisDataBegin) {
162 // Other data series if before data series
148 // Other data series if before data series
163 prepend = true;
149 prepend = true;
164 sortNeeded = false;
150 sortNeeded = false;
165 }
151 }
166 else {
152 else {
167 // The two data series overlap
153 // The two data series overlap
168 prepend = false;
154 prepend = false;
169 sortNeeded = true;
155 sortNeeded = true;
170 }
156 }
171
157
172 // Makes the merge
158 // Makes the merge
173 m_XAxisData->add(*other->xAxisData(), prepend);
159 m_XAxisData->add(*other->xAxisData(), prepend);
174 m_ValuesData->add(*other->valuesData(), prepend);
160 m_ValuesData->add(*other->valuesData(), prepend);
175
161
176 if (sortNeeded) {
162 if (sortNeeded) {
177 sort();
163 sort();
178 }
164 }
179 }
165 }
180
166
181 // Clears the other data series
167 // Clears the other data series
182 other->clear();
168 other->clear();
183 }
169 }
184 else {
170 else {
185 qCWarning(LOG_DataSeries())
171 qCWarning(LOG_DataSeries())
186 << QObject::tr("Detection of a type of IDataSeries we cannot merge with !");
172 << QObject::tr("Detection of a type of IDataSeries we cannot merge with !");
187 }
173 }
188 unlock();
174 unlock();
189 dataSeries->unlock();
175 dataSeries->unlock();
190 }
176 }
191
177
192 // ///////// //
178 // ///////// //
193 // Iterators //
179 // Iterators //
194 // ///////// //
180 // ///////// //
195
181
196 Iterator cbegin() const { return Iterator{*this, true}; }
182 DataSeriesIterator cbegin() const override
183 {
184 return DataSeriesIterator{DataSeriesIteratorValue{
185 std::make_unique<dataseries_detail::IteratorValue<Dim> >(*this, true)}};
186 }
187
188 DataSeriesIterator cend() const override
189 {
190 return DataSeriesIterator{DataSeriesIteratorValue{
191 std::make_unique<dataseries_detail::IteratorValue<Dim> >(*this, false)}};
192 }
193
194 /// @sa IDataSeries::minData()
195 DataSeriesIterator minData(double minXAxisData) const override
196 {
197 return std::lower_bound(
198 cbegin(), cend(), minXAxisData,
199 [](const auto &itValue, const auto &value) { return itValue.x() < value; });
200 }
201
202 /// @sa IDataSeries::maxData()
203 DataSeriesIterator maxData(double maxXAxisData) const override
204 {
205 // Gets the first element that greater than max value
206 auto it = std::upper_bound(
207 cbegin(), cend(), maxXAxisData,
208 [](const auto &value, const auto &itValue) { return value < itValue.x(); });
197
209
198 Iterator cend() const { return Iterator{*this, false}; }
210 return it == cbegin() ? cend() : --it;
211 }
199
212
200 std::pair<Iterator, Iterator> subData(double min, double max) const
213 std::pair<DataSeriesIterator, DataSeriesIterator> subData(double min, double max) const override
201 {
214 {
202 if (min > max) {
215 if (min > max) {
203 std::swap(min, max);
216 std::swap(min, max);
204 }
217 }
205
218
206 auto begin = cbegin();
219 auto begin = cbegin();
207 auto end = cend();
220 auto end = cend();
208
221
209 auto lowerIt
222 auto lowerIt
210 = std::lower_bound(begin, end, min, [](const auto &itValue, const auto &value) {
223 = std::lower_bound(begin, end, min, [](const auto &itValue, const auto &value) {
211 return itValue.x() < value;
224 return itValue.x() < value;
212 });
225 });
213 auto upperIt
226 auto upperIt
214 = std::upper_bound(begin, end, max, [](const auto &value, const auto &itValue) {
227 = std::upper_bound(begin, end, max, [](const auto &value, const auto &itValue) {
215 return value < itValue.x();
228 return value < itValue.x();
216 });
229 });
217
230
218 return std::make_pair(lowerIt, upperIt);
231 return std::make_pair(lowerIt, upperIt);
219 }
232 }
220
233
221 // /////// //
234 // /////// //
222 // Mutexes //
235 // Mutexes //
223 // /////// //
236 // /////// //
224
237
225 virtual void lockRead() { m_Lock.lockForRead(); }
238 virtual void lockRead() { m_Lock.lockForRead(); }
226 virtual void lockWrite() { m_Lock.lockForWrite(); }
239 virtual void lockWrite() { m_Lock.lockForWrite(); }
227 virtual void unlock() { m_Lock.unlock(); }
240 virtual void unlock() { m_Lock.unlock(); }
228
241
229 protected:
242 protected:
230 /// Protected ctor (DataSeries is abstract). The vectors must have the same size, otherwise a
243 /// Protected ctor (DataSeries is abstract). The vectors must have the same size, otherwise a
231 /// DataSeries with no values will be created.
244 /// DataSeries with no values will be created.
232 /// @remarks data series is automatically sorted on its x-axis data
245 /// @remarks data series is automatically sorted on its x-axis data
233 explicit DataSeries(std::shared_ptr<ArrayData<1> > xAxisData, const Unit &xAxisUnit,
246 explicit DataSeries(std::shared_ptr<ArrayData<1> > xAxisData, const Unit &xAxisUnit,
234 std::shared_ptr<ArrayData<Dim> > valuesData, const Unit &valuesUnit)
247 std::shared_ptr<ArrayData<Dim> > valuesData, const Unit &valuesUnit)
235 : m_XAxisData{xAxisData},
248 : m_XAxisData{xAxisData},
236 m_XAxisUnit{xAxisUnit},
249 m_XAxisUnit{xAxisUnit},
237 m_ValuesData{valuesData},
250 m_ValuesData{valuesData},
238 m_ValuesUnit{valuesUnit}
251 m_ValuesUnit{valuesUnit}
239 {
252 {
240 if (m_XAxisData->size() != m_ValuesData->size()) {
253 if (m_XAxisData->size() != m_ValuesData->size()) {
241 clear();
254 clear();
242 }
255 }
243
256
244 // Sorts data if it's not the case
257 // Sorts data if it's not the case
245 const auto &xAxisCData = m_XAxisData->cdata();
258 const auto &xAxisCData = m_XAxisData->cdata();
246 if (!std::is_sorted(xAxisCData.cbegin(), xAxisCData.cend())) {
259 if (!std::is_sorted(xAxisCData.cbegin(), xAxisCData.cend())) {
247 sort();
260 sort();
248 }
261 }
249 }
262 }
250
263
251 /// Copy ctor
264 /// Copy ctor
252 explicit DataSeries(const DataSeries<Dim> &other)
265 explicit DataSeries(const DataSeries<Dim> &other)
253 : m_XAxisData{std::make_shared<ArrayData<1> >(*other.m_XAxisData)},
266 : m_XAxisData{std::make_shared<ArrayData<1> >(*other.m_XAxisData)},
254 m_XAxisUnit{other.m_XAxisUnit},
267 m_XAxisUnit{other.m_XAxisUnit},
255 m_ValuesData{std::make_shared<ArrayData<Dim> >(*other.m_ValuesData)},
268 m_ValuesData{std::make_shared<ArrayData<Dim> >(*other.m_ValuesData)},
256 m_ValuesUnit{other.m_ValuesUnit}
269 m_ValuesUnit{other.m_ValuesUnit}
257 {
270 {
258 // Since a series is ordered from its construction and is always ordered, it is not
271 // Since a series is ordered from its construction and is always ordered, it is not
259 // necessary to call the sort method here ('other' is sorted)
272 // necessary to call the sort method here ('other' is sorted)
260 }
273 }
261
274
262 /// Assignment operator
275 /// Assignment operator
263 template <int D>
276 template <int D>
264 DataSeries &operator=(DataSeries<D> other)
277 DataSeries &operator=(DataSeries<D> other)
265 {
278 {
266 std::swap(m_XAxisData, other.m_XAxisData);
279 std::swap(m_XAxisData, other.m_XAxisData);
267 std::swap(m_XAxisUnit, other.m_XAxisUnit);
280 std::swap(m_XAxisUnit, other.m_XAxisUnit);
268 std::swap(m_ValuesData, other.m_ValuesData);
281 std::swap(m_ValuesData, other.m_ValuesData);
269 std::swap(m_ValuesUnit, other.m_ValuesUnit);
282 std::swap(m_ValuesUnit, other.m_ValuesUnit);
270
283
271 return *this;
284 return *this;
272 }
285 }
273
286
274 private:
287 private:
275 /**
288 /**
276 * Sorts data series on its x-axis data
289 * Sorts data series on its x-axis data
277 */
290 */
278 void sort() noexcept
291 void sort() noexcept
279 {
292 {
280 auto permutation = SortUtils::sortPermutation(*m_XAxisData, std::less<double>());
293 auto permutation = SortUtils::sortPermutation(*m_XAxisData, std::less<double>());
281 m_XAxisData = m_XAxisData->sort(permutation);
294 m_XAxisData = m_XAxisData->sort(permutation);
282 m_ValuesData = m_ValuesData->sort(permutation);
295 m_ValuesData = m_ValuesData->sort(permutation);
283 }
296 }
284
297
285 std::shared_ptr<ArrayData<1> > m_XAxisData;
298 std::shared_ptr<ArrayData<1> > m_XAxisData;
286 Unit m_XAxisUnit;
299 Unit m_XAxisUnit;
287 std::shared_ptr<ArrayData<Dim> > m_ValuesData;
300 std::shared_ptr<ArrayData<Dim> > m_ValuesData;
288 Unit m_ValuesUnit;
301 Unit m_ValuesUnit;
289
302
290 QReadWriteLock m_Lock;
303 QReadWriteLock m_Lock;
291 };
304 };
292
305
293 #endif // SCIQLOP_DATASERIES_H
306 #endif // SCIQLOP_DATASERIES_H
@@ -1,73 +1,96
1 #ifndef SCIQLOP_IDATASERIES_H
1 #ifndef SCIQLOP_IDATASERIES_H
2 #define SCIQLOP_IDATASERIES_H
2 #define SCIQLOP_IDATASERIES_H
3
3
4 #include <Common/MetaTypes.h>
4 #include <Common/MetaTypes.h>
5 #include <Data/DataSeriesIterator.h>
5 #include <Data/SqpRange.h>
6 #include <Data/SqpRange.h>
6
7
7 #include <memory>
8 #include <memory>
8
9
9 #include <QString>
10 #include <QString>
10
11
11 template <int Dim>
12 template <int Dim>
12 class ArrayData;
13 class ArrayData;
13
14
14 struct Unit {
15 struct Unit {
15 explicit Unit(const QString &name = {}, bool timeUnit = false)
16 explicit Unit(const QString &name = {}, bool timeUnit = false)
16 : m_Name{name}, m_TimeUnit{timeUnit}
17 : m_Name{name}, m_TimeUnit{timeUnit}
17 {
18 {
18 }
19 }
19
20
20 inline bool operator==(const Unit &other) const
21 inline bool operator==(const Unit &other) const
21 {
22 {
22 return std::tie(m_Name, m_TimeUnit) == std::tie(other.m_Name, other.m_TimeUnit);
23 return std::tie(m_Name, m_TimeUnit) == std::tie(other.m_Name, other.m_TimeUnit);
23 }
24 }
24 inline bool operator!=(const Unit &other) const { return !(*this == other); }
25 inline bool operator!=(const Unit &other) const { return !(*this == other); }
25
26
26 QString m_Name; ///< Unit name
27 QString m_Name; ///< Unit name
27 bool m_TimeUnit; ///< The unit is a unit of time (UTC)
28 bool m_TimeUnit; ///< The unit is a unit of time (UTC)
28 };
29 };
29
30
30 /**
31 /**
31 * @brief The IDataSeries aims to declare a data series.
32 * @brief The IDataSeries aims to declare a data series.
32 *
33 *
33 * A data series is an entity that contains at least :
34 * A data series is an entity that contains at least :
34 * - one dataset representing the x-axis
35 * - one dataset representing the x-axis
35 * - one dataset representing the values
36 * - one dataset representing the values
36 *
37 *
37 * Each dataset is represented by an ArrayData, and is associated with a unit.
38 * Each dataset is represented by an ArrayData, and is associated with a unit.
38 *
39 *
39 * An ArrayData can be unidimensional or two-dimensional, depending on the implementation of the
40 * An ArrayData can be unidimensional or two-dimensional, depending on the implementation of the
40 * IDataSeries. The x-axis dataset is always unidimensional.
41 * IDataSeries. The x-axis dataset is always unidimensional.
41 *
42 *
42 * @sa ArrayData
43 * @sa ArrayData
43 */
44 */
44 class IDataSeries {
45 class IDataSeries {
45 public:
46 public:
46 virtual ~IDataSeries() noexcept = default;
47 virtual ~IDataSeries() noexcept = default;
47
48
48 /// Returns the x-axis dataset
49 /// Returns the x-axis dataset
49 virtual std::shared_ptr<ArrayData<1> > xAxisData() = 0;
50 virtual std::shared_ptr<ArrayData<1> > xAxisData() = 0;
50
51
51 /// Returns the x-axis dataset (as const)
52 /// Returns the x-axis dataset (as const)
52 virtual const std::shared_ptr<ArrayData<1> > xAxisData() const = 0;
53 virtual const std::shared_ptr<ArrayData<1> > xAxisData() const = 0;
53
54
54 virtual Unit xAxisUnit() const = 0;
55 virtual Unit xAxisUnit() const = 0;
55
56
56 virtual Unit valuesUnit() const = 0;
57 virtual Unit valuesUnit() const = 0;
57
58
58 virtual void merge(IDataSeries *dataSeries) = 0;
59 virtual void merge(IDataSeries *dataSeries) = 0;
59 /// @todo Review the name and signature of this method
60 /// @todo Review the name and signature of this method
60 virtual std::shared_ptr<IDataSeries> subDataSeries(const SqpRange &range) = 0;
61 virtual std::shared_ptr<IDataSeries> subDataSeries(const SqpRange &range) = 0;
61
62
62 virtual std::unique_ptr<IDataSeries> clone() const = 0;
63 virtual std::unique_ptr<IDataSeries> clone() const = 0;
63 virtual SqpRange range() const = 0;
64 virtual SqpRange range() const = 0;
64
65
66 // ///////// //
67 // Iterators //
68 // ///////// //
69
70 virtual DataSeriesIterator cbegin() const = 0;
71 virtual DataSeriesIterator cend() const = 0;
72
73 /// @return the iterator to the first entry of the data series whose x-axis data is greater than
74 /// or equal to the value passed in parameter, or the end iterator if there is no matching value
75 virtual DataSeriesIterator minData(double minXAxisData) const = 0;
76
77 /// @return the iterator to the last entry of the data series whose x-axis data is less than or
78 /// equal to the value passed in parameter, or the end iterator if there is no matching value
79 virtual DataSeriesIterator maxData(double maxXAxisData) const = 0;
80
81 virtual std::pair<DataSeriesIterator, DataSeriesIterator> subData(double min,
82 double max) const = 0;
83
84 // /////// //
85 // Mutexes //
86 // /////// //
87
65 virtual void lockRead() = 0;
88 virtual void lockRead() = 0;
66 virtual void lockWrite() = 0;
89 virtual void lockWrite() = 0;
67 virtual void unlock() = 0;
90 virtual void unlock() = 0;
68 };
91 };
69
92
70 // Required for using shared_ptr in signals/slots
93 // Required for using shared_ptr in signals/slots
71 SCIQLOP_REGISTER_META_TYPE(IDATASERIES_PTR_REGISTRY, std::shared_ptr<IDataSeries>)
94 SCIQLOP_REGISTER_META_TYPE(IDATASERIES_PTR_REGISTRY, std::shared_ptr<IDataSeries>)
72
95
73 #endif // SCIQLOP_IDATASERIES_H
96 #endif // SCIQLOP_IDATASERIES_H
@@ -1,258 +1,271
1 #include <Variable/Variable.h>
1 #include <Variable/Variable.h>
2 #include <Variable/VariableModel.h>
2 #include <Variable/VariableModel.h>
3
3
4 #include <Common/DateUtils.h>
4 #include <Common/DateUtils.h>
5
5
6 #include <Data/IDataSeries.h>
6 #include <Data/IDataSeries.h>
7
7
8 #include <QSize>
8 #include <QSize>
9 #include <unordered_map>
9 #include <unordered_map>
10
10
11 Q_LOGGING_CATEGORY(LOG_VariableModel, "VariableModel")
11 Q_LOGGING_CATEGORY(LOG_VariableModel, "VariableModel")
12
12
13 namespace {
13 namespace {
14
14
15 // Column indexes
15 // Column indexes
16 const auto NAME_COLUMN = 0;
16 const auto NAME_COLUMN = 0;
17 const auto TSTART_COLUMN = 1;
17 const auto TSTART_COLUMN = 1;
18 const auto TEND_COLUMN = 2;
18 const auto TEND_COLUMN = 2;
19 const auto UNIT_COLUMN = 3;
19 const auto UNIT_COLUMN = 3;
20 const auto MISSION_COLUMN = 4;
20 const auto MISSION_COLUMN = 4;
21 const auto PLUGIN_COLUMN = 5;
21 const auto PLUGIN_COLUMN = 5;
22 const auto NB_COLUMNS = 6;
22 const auto NB_COLUMNS = 6;
23
23
24 // Column properties
24 // Column properties
25 const auto DEFAULT_HEIGHT = 25;
25 const auto DEFAULT_HEIGHT = 25;
26 const auto DEFAULT_WIDTH = 100;
26 const auto DEFAULT_WIDTH = 100;
27
27
28 struct ColumnProperties {
28 struct ColumnProperties {
29 ColumnProperties(const QString &name = {}, int width = DEFAULT_WIDTH,
29 ColumnProperties(const QString &name = {}, int width = DEFAULT_WIDTH,
30 int height = DEFAULT_HEIGHT)
30 int height = DEFAULT_HEIGHT)
31 : m_Name{name}, m_Width{width}, m_Height{height}
31 : m_Name{name}, m_Width{width}, m_Height{height}
32 {
32 {
33 }
33 }
34
34
35 QString m_Name;
35 QString m_Name;
36 int m_Width;
36 int m_Width;
37 int m_Height;
37 int m_Height;
38 };
38 };
39
39
40 const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{
40 const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{
41 {NAME_COLUMN, {QObject::tr("Name")}}, {TSTART_COLUMN, {QObject::tr("tStart"), 180}},
41 {NAME_COLUMN, {QObject::tr("Name")}}, {TSTART_COLUMN, {QObject::tr("tStart"), 180}},
42 {TEND_COLUMN, {QObject::tr("tEnd"), 180}}, {UNIT_COLUMN, {QObject::tr("Unit")}},
42 {TEND_COLUMN, {QObject::tr("tEnd"), 180}}, {UNIT_COLUMN, {QObject::tr("Unit")}},
43 {MISSION_COLUMN, {QObject::tr("Mission")}}, {PLUGIN_COLUMN, {QObject::tr("Plugin")}}};
43 {MISSION_COLUMN, {QObject::tr("Mission")}}, {PLUGIN_COLUMN, {QObject::tr("Plugin")}}};
44
44
45 /// Format for datetimes
45 /// Format for datetimes
46 const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz");
46 const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz");
47
47
48
48
49 } // namespace
49 } // namespace
50
50
51 struct VariableModel::VariableModelPrivate {
51 struct VariableModel::VariableModelPrivate {
52 /// Variables created in SciQlop
52 /// Variables created in SciQlop
53 std::vector<std::shared_ptr<Variable> > m_Variables;
53 std::vector<std::shared_ptr<Variable> > m_Variables;
54 std::unordered_map<std::shared_ptr<Variable>, double> m_VariableToProgress;
54 std::unordered_map<std::shared_ptr<Variable>, double> m_VariableToProgress;
55
55
56 /// Return the row index of the variable. -1 if it's not found
56 /// Return the row index of the variable. -1 if it's not found
57 int indexOfVariable(Variable *variable) const noexcept;
57 int indexOfVariable(Variable *variable) const noexcept;
58 };
58 };
59
59
60 VariableModel::VariableModel(QObject *parent)
60 VariableModel::VariableModel(QObject *parent)
61 : QAbstractTableModel{parent}, impl{spimpl::make_unique_impl<VariableModelPrivate>()}
61 : QAbstractTableModel{parent}, impl{spimpl::make_unique_impl<VariableModelPrivate>()}
62 {
62 {
63 }
63 }
64
64
65 std::shared_ptr<Variable> VariableModel::createVariable(const QString &name,
65 std::shared_ptr<Variable> VariableModel::createVariable(const QString &name,
66 const SqpRange &dateTime,
66 const SqpRange &dateTime,
67 const QVariantHash &metadata) noexcept
67 const QVariantHash &metadata) noexcept
68 {
68 {
69 auto insertIndex = rowCount();
69 auto insertIndex = rowCount();
70 beginInsertRows({}, insertIndex, insertIndex);
70 beginInsertRows({}, insertIndex, insertIndex);
71
71
72 auto variable = std::make_shared<Variable>(name, dateTime, metadata);
72 auto variable = std::make_shared<Variable>(name, dateTime, metadata);
73
73
74 impl->m_Variables.push_back(variable);
74 impl->m_Variables.push_back(variable);
75 connect(variable.get(), &Variable::updated, this, &VariableModel::onVariableUpdated);
75 connect(variable.get(), &Variable::updated, this, &VariableModel::onVariableUpdated);
76
76
77 endInsertRows();
77 endInsertRows();
78
78
79 return variable;
79 return variable;
80 }
80 }
81
81
82 void VariableModel::deleteVariable(std::shared_ptr<Variable> variable) noexcept
82 void VariableModel::deleteVariable(std::shared_ptr<Variable> variable) noexcept
83 {
83 {
84 if (!variable) {
84 if (!variable) {
85 qCCritical(LOG_Variable()) << "Can't delete a null variable from the model";
85 qCCritical(LOG_Variable()) << "Can't delete a null variable from the model";
86 return;
86 return;
87 }
87 }
88
88
89 // Finds variable in the model
89 // Finds variable in the model
90 auto begin = impl->m_Variables.cbegin();
90 auto begin = impl->m_Variables.cbegin();
91 auto end = impl->m_Variables.cend();
91 auto end = impl->m_Variables.cend();
92 auto it = std::find(begin, end, variable);
92 auto it = std::find(begin, end, variable);
93 if (it != end) {
93 if (it != end) {
94 auto removeIndex = std::distance(begin, it);
94 auto removeIndex = std::distance(begin, it);
95
95
96 // Deletes variable
96 // Deletes variable
97 beginRemoveRows({}, removeIndex, removeIndex);
97 beginRemoveRows({}, removeIndex, removeIndex);
98 impl->m_Variables.erase(it);
98 impl->m_Variables.erase(it);
99 endRemoveRows();
99 endRemoveRows();
100 }
100 }
101 else {
101 else {
102 qCritical(LOG_VariableModel())
102 qCritical(LOG_VariableModel())
103 << tr("Can't delete variable %1 from the model: the variable is not in the model")
103 << tr("Can't delete variable %1 from the model: the variable is not in the model")
104 .arg(variable->name());
104 .arg(variable->name());
105 }
105 }
106
106
107 // Removes variable from progress map
107 // Removes variable from progress map
108 impl->m_VariableToProgress.erase(variable);
108 impl->m_VariableToProgress.erase(variable);
109 }
109 }
110
110
111
111
112 std::shared_ptr<Variable> VariableModel::variable(int index) const
112 std::shared_ptr<Variable> VariableModel::variable(int index) const
113 {
113 {
114 return (index >= 0 && index < impl->m_Variables.size()) ? impl->m_Variables[index] : nullptr;
114 return (index >= 0 && index < impl->m_Variables.size()) ? impl->m_Variables[index] : nullptr;
115 }
115 }
116
116
117 void VariableModel::setDataProgress(std::shared_ptr<Variable> variable, double progress)
117 void VariableModel::setDataProgress(std::shared_ptr<Variable> variable, double progress)
118 {
118 {
119 if (progress > 0.0) {
119 if (progress > 0.0) {
120 impl->m_VariableToProgress[variable] = progress;
120 impl->m_VariableToProgress[variable] = progress;
121 }
121 }
122 else {
122 else {
123 impl->m_VariableToProgress.erase(variable);
123 impl->m_VariableToProgress.erase(variable);
124 }
124 }
125 auto modelIndex = createIndex(impl->indexOfVariable(variable.get()), NAME_COLUMN);
125 auto modelIndex = createIndex(impl->indexOfVariable(variable.get()), NAME_COLUMN);
126
126
127 emit dataChanged(modelIndex, modelIndex);
127 emit dataChanged(modelIndex, modelIndex);
128 }
128 }
129
129
130 int VariableModel::columnCount(const QModelIndex &parent) const
130 int VariableModel::columnCount(const QModelIndex &parent) const
131 {
131 {
132 Q_UNUSED(parent);
132 Q_UNUSED(parent);
133
133
134 return NB_COLUMNS;
134 return NB_COLUMNS;
135 }
135 }
136
136
137 int VariableModel::rowCount(const QModelIndex &parent) const
137 int VariableModel::rowCount(const QModelIndex &parent) const
138 {
138 {
139 Q_UNUSED(parent);
139 Q_UNUSED(parent);
140
140
141 return impl->m_Variables.size();
141 return impl->m_Variables.size();
142 }
142 }
143
143
144 QVariant VariableModel::data(const QModelIndex &index, int role) const
144 QVariant VariableModel::data(const QModelIndex &index, int role) const
145 {
145 {
146 if (!index.isValid()) {
146 if (!index.isValid()) {
147 return QVariant{};
147 return QVariant{};
148 }
148 }
149
149
150 if (index.row() < 0 || index.row() >= rowCount()) {
150 if (index.row() < 0 || index.row() >= rowCount()) {
151 return QVariant{};
151 return QVariant{};
152 }
152 }
153
153
154 if (role == Qt::DisplayRole) {
154 if (role == Qt::DisplayRole) {
155 if (auto variable = impl->m_Variables.at(index.row()).get()) {
155 if (auto variable = impl->m_Variables.at(index.row()).get()) {
156 /// Lambda function that builds the variant to return for a time value
156 /// Lambda function that builds the variant to return for a time value
157 auto dateTimeVariant = [](double secs) {
157 /// @param getValueFun function used to get for a data series the iterator on the entry
158 auto dateTime = DateUtils::dateTime(secs);
158 /// that contains the time value to display
159 return dateTime.toString(DATETIME_FORMAT);
159 auto dateTimeVariant = [variable](const auto &getValueFun) {
160 if (auto dataSeries = variable->dataSeries()) {
161 auto it = getValueFun(*dataSeries);
162 return (it != dataSeries->cend())
163 ? DateUtils::dateTime(it->x()).toString(DATETIME_FORMAT)
164 : QVariant{};
165 }
166 else {
167 return QVariant{};
168 }
160 };
169 };
161
170
162 switch (index.column()) {
171 switch (index.column()) {
163 case NAME_COLUMN:
172 case NAME_COLUMN:
164 return variable->name();
173 return variable->name();
165 case TSTART_COLUMN:
174 case TSTART_COLUMN:
166 return dateTimeVariant(variable->range().m_TStart);
175 // Shows the min value of the data series above the range tstart
176 return dateTimeVariant([min = variable->range().m_TStart](
177 const auto &dataSeries) { return dataSeries.minData(min); });
167 case TEND_COLUMN:
178 case TEND_COLUMN:
168 return dateTimeVariant(variable->range().m_TEnd);
179 // Shows the max value of the data series under the range tend
180 return dateTimeVariant([max = variable->range().m_TEnd](
181 const auto &dataSeries) { return dataSeries.maxData(max); });
169 case UNIT_COLUMN:
182 case UNIT_COLUMN:
170 return variable->metadata().value(QStringLiteral("units"));
183 return variable->metadata().value(QStringLiteral("units"));
171 case MISSION_COLUMN:
184 case MISSION_COLUMN:
172 return variable->metadata().value(QStringLiteral("mission"));
185 return variable->metadata().value(QStringLiteral("mission"));
173 case PLUGIN_COLUMN:
186 case PLUGIN_COLUMN:
174 return variable->metadata().value(QStringLiteral("plugin"));
187 return variable->metadata().value(QStringLiteral("plugin"));
175 default:
188 default:
176 // No action
189 // No action
177 break;
190 break;
178 }
191 }
179
192
180 qWarning(LOG_VariableModel())
193 qWarning(LOG_VariableModel())
181 << tr("Can't get data (unknown column %1)").arg(index.column());
194 << tr("Can't get data (unknown column %1)").arg(index.column());
182 }
195 }
183 else {
196 else {
184 qWarning(LOG_VariableModel()) << tr("Can't get data (no variable)");
197 qWarning(LOG_VariableModel()) << tr("Can't get data (no variable)");
185 }
198 }
186 }
199 }
187 else if (role == VariableRoles::ProgressRole) {
200 else if (role == VariableRoles::ProgressRole) {
188 if (auto variable = impl->m_Variables.at(index.row())) {
201 if (auto variable = impl->m_Variables.at(index.row())) {
189
202
190 auto it = impl->m_VariableToProgress.find(variable);
203 auto it = impl->m_VariableToProgress.find(variable);
191 if (it != impl->m_VariableToProgress.cend()) {
204 if (it != impl->m_VariableToProgress.cend()) {
192 return it->second;
205 return it->second;
193 }
206 }
194 }
207 }
195 }
208 }
196
209
197 return QVariant{};
210 return QVariant{};
198 }
211 }
199
212
200 QVariant VariableModel::headerData(int section, Qt::Orientation orientation, int role) const
213 QVariant VariableModel::headerData(int section, Qt::Orientation orientation, int role) const
201 {
214 {
202 if (role != Qt::DisplayRole && role != Qt::SizeHintRole) {
215 if (role != Qt::DisplayRole && role != Qt::SizeHintRole) {
203 return QVariant{};
216 return QVariant{};
204 }
217 }
205
218
206 if (orientation == Qt::Horizontal) {
219 if (orientation == Qt::Horizontal) {
207 auto propertiesIt = COLUMN_PROPERTIES.find(section);
220 auto propertiesIt = COLUMN_PROPERTIES.find(section);
208 if (propertiesIt != COLUMN_PROPERTIES.cend()) {
221 if (propertiesIt != COLUMN_PROPERTIES.cend()) {
209 // Role is either DisplayRole or SizeHintRole
222 // Role is either DisplayRole or SizeHintRole
210 return (role == Qt::DisplayRole)
223 return (role == Qt::DisplayRole)
211 ? QVariant{propertiesIt->m_Name}
224 ? QVariant{propertiesIt->m_Name}
212 : QVariant{QSize{propertiesIt->m_Width, propertiesIt->m_Height}};
225 : QVariant{QSize{propertiesIt->m_Width, propertiesIt->m_Height}};
213 }
226 }
214 else {
227 else {
215 qWarning(LOG_VariableModel())
228 qWarning(LOG_VariableModel())
216 << tr("Can't get header data (unknown column %1)").arg(section);
229 << tr("Can't get header data (unknown column %1)").arg(section);
217 }
230 }
218 }
231 }
219
232
220 return QVariant{};
233 return QVariant{};
221 }
234 }
222
235
223 void VariableModel::abortProgress(const QModelIndex &index)
236 void VariableModel::abortProgress(const QModelIndex &index)
224 {
237 {
225 if (auto variable = impl->m_Variables.at(index.row())) {
238 if (auto variable = impl->m_Variables.at(index.row())) {
226 emit abortProgessRequested(variable);
239 emit abortProgessRequested(variable);
227 }
240 }
228 }
241 }
229
242
230 void VariableModel::onVariableUpdated() noexcept
243 void VariableModel::onVariableUpdated() noexcept
231 {
244 {
232 // Finds variable that has been updated in the model
245 // Finds variable that has been updated in the model
233 if (auto updatedVariable = dynamic_cast<Variable *>(sender())) {
246 if (auto updatedVariable = dynamic_cast<Variable *>(sender())) {
234 auto updatedVariableIndex = impl->indexOfVariable(updatedVariable);
247 auto updatedVariableIndex = impl->indexOfVariable(updatedVariable);
235
248
236 if (updatedVariableIndex > -1) {
249 if (updatedVariableIndex > -1) {
237 emit dataChanged(createIndex(updatedVariableIndex, 0),
250 emit dataChanged(createIndex(updatedVariableIndex, 0),
238 createIndex(updatedVariableIndex, columnCount() - 1));
251 createIndex(updatedVariableIndex, columnCount() - 1));
239 }
252 }
240 }
253 }
241 }
254 }
242
255
243 int VariableModel::VariableModelPrivate::indexOfVariable(Variable *variable) const noexcept
256 int VariableModel::VariableModelPrivate::indexOfVariable(Variable *variable) const noexcept
244 {
257 {
245 auto begin = std::cbegin(m_Variables);
258 auto begin = std::cbegin(m_Variables);
246 auto end = std::cend(m_Variables);
259 auto end = std::cend(m_Variables);
247 auto it
260 auto it
248 = std::find_if(begin, end, [variable](const auto &var) { return var.get() == variable; });
261 = std::find_if(begin, end, [variable](const auto &var) { return var.get() == variable; });
249
262
250 if (it != end) {
263 if (it != end) {
251 // Gets the index of the variable in the model: we assume here that views have the same
264 // Gets the index of the variable in the model: we assume here that views have the same
252 // order as the model
265 // order as the model
253 return std::distance(begin, it);
266 return std::distance(begin, it);
254 }
267 }
255 else {
268 else {
256 return -1;
269 return -1;
257 }
270 }
258 }
271 }
@@ -1,232 +1,354
1 #include "Data/DataSeries.h"
1 #include "Data/DataSeries.h"
2 #include "Data/ScalarSeries.h"
2 #include "Data/ScalarSeries.h"
3
3
4 #include <QObject>
4 #include <QObject>
5 #include <QtTest>
5 #include <QtTest>
6
6
7 Q_DECLARE_METATYPE(std::shared_ptr<ScalarSeries>)
7 Q_DECLARE_METATYPE(std::shared_ptr<ScalarSeries>)
8
8
9 class TestDataSeries : public QObject {
9 class TestDataSeries : public QObject {
10 Q_OBJECT
10 Q_OBJECT
11 private slots:
11 private slots:
12 /// Input test data
12 /// Input test data
13 /// @sa testCtor()
13 /// @sa testCtor()
14 void testCtor_data();
14 void testCtor_data();
15
15
16 /// Tests construction of a data series
16 /// Tests construction of a data series
17 void testCtor();
17 void testCtor();
18
18
19 /// Input test data
19 /// Input test data
20 /// @sa testMerge()
20 /// @sa testMerge()
21 void testMerge_data();
21 void testMerge_data();
22
22
23 /// Tests merge of two data series
23 /// Tests merge of two data series
24 void testMerge();
24 void testMerge();
25
25
26 /// Input test data
26 /// Input test data
27 /// @sa testMinData()
28 void testMinData_data();
29
30 /// Tests get min data of a data series
31 void testMinData();
32
33 /// Input test data
34 /// @sa testMaxData()
35 void testMaxData_data();
36
37 /// Tests get max data of a data series
38 void testMaxData();
39
40 /// Input test data
27 /// @sa testSubdata()
41 /// @sa testSubdata()
28 void testSubdata_data();
42 void testSubdata_data();
29
43
30 /// Tests get subdata of two data series
44 /// Tests get subdata of two data series
31 void testSubdata();
45 void testSubdata();
32 };
46 };
33
47
34 void TestDataSeries::testCtor_data()
48 void TestDataSeries::testCtor_data()
35 {
49 {
36 // ////////////// //
50 // ////////////// //
37 // Test structure //
51 // Test structure //
38 // ////////////// //
52 // ////////////// //
39
53
40 // x-axis data
54 // x-axis data
41 QTest::addColumn<QVector<double> >("xAxisData");
55 QTest::addColumn<QVector<double> >("xAxisData");
42 // values data
56 // values data
43 QTest::addColumn<QVector<double> >("valuesData");
57 QTest::addColumn<QVector<double> >("valuesData");
44
58
45 // expected x-axis data
59 // expected x-axis data
46 QTest::addColumn<QVector<double> >("expectedXAxisData");
60 QTest::addColumn<QVector<double> >("expectedXAxisData");
47 // expected values data
61 // expected values data
48 QTest::addColumn<QVector<double> >("expectedValuesData");
62 QTest::addColumn<QVector<double> >("expectedValuesData");
49
63
50 // ////////// //
64 // ////////// //
51 // Test cases //
65 // Test cases //
52 // ////////// //
66 // ////////// //
53
67
54 QTest::newRow("invalidData (different sizes of vectors)")
68 QTest::newRow("invalidData (different sizes of vectors)")
55 << QVector<double>{1., 2., 3., 4., 5.} << QVector<double>{100., 200., 300.}
69 << QVector<double>{1., 2., 3., 4., 5.} << QVector<double>{100., 200., 300.}
56 << QVector<double>{} << QVector<double>{};
70 << QVector<double>{} << QVector<double>{};
57
71
58 QTest::newRow("sortedData") << QVector<double>{1., 2., 3., 4., 5.}
72 QTest::newRow("sortedData") << QVector<double>{1., 2., 3., 4., 5.}
59 << QVector<double>{100., 200., 300., 400., 500.}
73 << QVector<double>{100., 200., 300., 400., 500.}
60 << QVector<double>{1., 2., 3., 4., 5.}
74 << QVector<double>{1., 2., 3., 4., 5.}
61 << QVector<double>{100., 200., 300., 400., 500.};
75 << QVector<double>{100., 200., 300., 400., 500.};
62
76
63 QTest::newRow("unsortedData") << QVector<double>{5., 4., 3., 2., 1.}
77 QTest::newRow("unsortedData") << QVector<double>{5., 4., 3., 2., 1.}
64 << QVector<double>{100., 200., 300., 400., 500.}
78 << QVector<double>{100., 200., 300., 400., 500.}
65 << QVector<double>{1., 2., 3., 4., 5.}
79 << QVector<double>{1., 2., 3., 4., 5.}
66 << QVector<double>{500., 400., 300., 200., 100.};
80 << QVector<double>{500., 400., 300., 200., 100.};
67
81
68 QTest::newRow("unsortedData2")
82 QTest::newRow("unsortedData2")
69 << QVector<double>{1., 4., 3., 5., 2.} << QVector<double>{100., 200., 300., 400., 500.}
83 << QVector<double>{1., 4., 3., 5., 2.} << QVector<double>{100., 200., 300., 400., 500.}
70 << QVector<double>{1., 2., 3., 4., 5.} << QVector<double>{100., 500., 300., 200., 400.};
84 << QVector<double>{1., 2., 3., 4., 5.} << QVector<double>{100., 500., 300., 200., 400.};
71 }
85 }
72
86
73 void TestDataSeries::testCtor()
87 void TestDataSeries::testCtor()
74 {
88 {
75 // Creates series
89 // Creates series
76 QFETCH(QVector<double>, xAxisData);
90 QFETCH(QVector<double>, xAxisData);
77 QFETCH(QVector<double>, valuesData);
91 QFETCH(QVector<double>, valuesData);
78
92
79 auto series = std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData),
93 auto series = std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData),
80 Unit{}, Unit{});
94 Unit{}, Unit{});
81
95
82 // Validates results : we check that the data series is sorted on its x-axis data
96 // Validates results : we check that the data series is sorted on its x-axis data
83 QFETCH(QVector<double>, expectedXAxisData);
97 QFETCH(QVector<double>, expectedXAxisData);
84 QFETCH(QVector<double>, expectedValuesData);
98 QFETCH(QVector<double>, expectedValuesData);
85
99
86 auto seriesXAxisData = series->xAxisData()->data();
100 auto seriesXAxisData = series->xAxisData()->data();
87 auto seriesValuesData = series->valuesData()->data();
101 auto seriesValuesData = series->valuesData()->data();
88
102
89 QVERIFY(
103 QVERIFY(
90 std::equal(expectedXAxisData.cbegin(), expectedXAxisData.cend(), seriesXAxisData.cbegin()));
104 std::equal(expectedXAxisData.cbegin(), expectedXAxisData.cend(), seriesXAxisData.cbegin()));
91 QVERIFY(std::equal(expectedValuesData.cbegin(), expectedValuesData.cend(),
105 QVERIFY(std::equal(expectedValuesData.cbegin(), expectedValuesData.cend(),
92 seriesValuesData.cbegin()));
106 seriesValuesData.cbegin()));
93 }
107 }
94
108
95 namespace {
109 namespace {
96
110
97 std::shared_ptr<ScalarSeries> createSeries(QVector<double> xAxisData, QVector<double> valuesData)
111 std::shared_ptr<ScalarSeries> createSeries(QVector<double> xAxisData, QVector<double> valuesData)
98 {
112 {
99 return std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData), Unit{},
113 return std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData), Unit{},
100 Unit{});
114 Unit{});
101 }
115 }
102
116
103 } // namespace
117 } // namespace
104
118
105 void TestDataSeries::testMerge_data()
119 void TestDataSeries::testMerge_data()
106 {
120 {
107 // ////////////// //
121 // ////////////// //
108 // Test structure //
122 // Test structure //
109 // ////////////// //
123 // ////////////// //
110
124
111 // Data series to merge
125 // Data series to merge
112 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries");
126 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries");
113 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries2");
127 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries2");
114
128
115 // Expected values in the first data series after merge
129 // Expected values in the first data series after merge
116 QTest::addColumn<QVector<double> >("expectedXAxisData");
130 QTest::addColumn<QVector<double> >("expectedXAxisData");
117 QTest::addColumn<QVector<double> >("expectedValuesData");
131 QTest::addColumn<QVector<double> >("expectedValuesData");
118
132
119 // ////////// //
133 // ////////// //
120 // Test cases //
134 // Test cases //
121 // ////////// //
135 // ////////// //
122
136
123 QTest::newRow("sortedMerge")
137 QTest::newRow("sortedMerge")
124 << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
138 << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
125 << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.})
139 << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.})
126 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
140 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
127 << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.};
141 << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.};
128
142
129 QTest::newRow("unsortedMerge")
143 QTest::newRow("unsortedMerge")
130 << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.})
144 << createSeries({6., 7., 8., 9., 10.}, {600., 700., 800., 900., 1000.})
131 << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
145 << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
132 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
146 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
133 << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.};
147 << QVector<double>{100., 200., 300., 400., 500., 600., 700., 800., 900., 1000.};
134
148
135 QTest::newRow("unsortedMerge2")
149 QTest::newRow("unsortedMerge2")
136 << createSeries({1., 2., 8., 9., 10}, {100., 200., 300., 400., 500.})
150 << createSeries({1., 2., 8., 9., 10}, {100., 200., 300., 400., 500.})
137 << createSeries({3., 4., 5., 6., 7.}, {600., 700., 800., 900., 1000.})
151 << createSeries({3., 4., 5., 6., 7.}, {600., 700., 800., 900., 1000.})
138 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
152 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
139 << QVector<double>{100., 200., 600., 700., 800., 900., 1000., 300., 400., 500.};
153 << QVector<double>{100., 200., 600., 700., 800., 900., 1000., 300., 400., 500.};
140
154
141 QTest::newRow("unsortedMerge3")
155 QTest::newRow("unsortedMerge3")
142 << createSeries({3., 5., 8., 7., 2}, {100., 200., 300., 400., 500.})
156 << createSeries({3., 5., 8., 7., 2}, {100., 200., 300., 400., 500.})
143 << createSeries({6., 4., 9., 10., 1.}, {600., 700., 800., 900., 1000.})
157 << createSeries({6., 4., 9., 10., 1.}, {600., 700., 800., 900., 1000.})
144 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
158 << QVector<double>{1., 2., 3., 4., 5., 6., 7., 8., 9., 10.}
145 << QVector<double>{1000., 500., 100., 700., 200., 600., 400., 300., 800., 900.};
159 << QVector<double>{1000., 500., 100., 700., 200., 600., 400., 300., 800., 900.};
146 }
160 }
147
161
148 void TestDataSeries::testMerge()
162 void TestDataSeries::testMerge()
149 {
163 {
150 // Merges series
164 // Merges series
151 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
165 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
152 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries2);
166 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries2);
153
167
154 dataSeries->merge(dataSeries2.get());
168 dataSeries->merge(dataSeries2.get());
155
169
156 // Validates results : we check that the merge is valid and the data series is sorted on its
170 // Validates results : we check that the merge is valid and the data series is sorted on its
157 // x-axis data
171 // x-axis data
158 QFETCH(QVector<double>, expectedXAxisData);
172 QFETCH(QVector<double>, expectedXAxisData);
159 QFETCH(QVector<double>, expectedValuesData);
173 QFETCH(QVector<double>, expectedValuesData);
160
174
161 auto seriesXAxisData = dataSeries->xAxisData()->data();
175 auto seriesXAxisData = dataSeries->xAxisData()->data();
162 auto seriesValuesData = dataSeries->valuesData()->data();
176 auto seriesValuesData = dataSeries->valuesData()->data();
163
177
164 QVERIFY(
178 QVERIFY(
165 std::equal(expectedXAxisData.cbegin(), expectedXAxisData.cend(), seriesXAxisData.cbegin()));
179 std::equal(expectedXAxisData.cbegin(), expectedXAxisData.cend(), seriesXAxisData.cbegin()));
166 QVERIFY(std::equal(expectedValuesData.cbegin(), expectedValuesData.cend(),
180 QVERIFY(std::equal(expectedValuesData.cbegin(), expectedValuesData.cend(),
167 seriesValuesData.cbegin()));
181 seriesValuesData.cbegin()));
168 }
182 }
169
183
184 void TestDataSeries::testMinData_data()
185 {
186 // ////////////// //
187 // Test structure //
188 // ////////////// //
189
190 // Data series to get min data
191 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries");
192
193 // Min data
194 QTest::addColumn<double>("min");
195
196 // Expected results
197 QTest::addColumn<bool>(
198 "expectedOK"); // if true, expects to have a result (i.e. the iterator != end iterator)
199 QTest::addColumn<double>(
200 "expectedMin"); // Expected value when method doesn't return end iterator
201
202 // ////////// //
203 // Test cases //
204 // ////////// //
205
206 QTest::newRow("minData1") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
207 << 0. << true << 1.;
208 QTest::newRow("minData2") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
209 << 1. << true << 1.;
210 QTest::newRow("minData3") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
211 << 1.1 << true << 2.;
212 QTest::newRow("minData4") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
213 << 5. << true << 5.;
214 QTest::newRow("minData5") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
215 << 5.1 << false << std::numeric_limits<double>::quiet_NaN();
216 QTest::newRow("minData6") << createSeries({}, {}) << 1.1 << false
217 << std::numeric_limits<double>::quiet_NaN();
218 }
219
220 void TestDataSeries::testMinData()
221 {
222 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
223 QFETCH(double, min);
224
225 QFETCH(bool, expectedOK);
226 QFETCH(double, expectedMin);
227
228 auto it = dataSeries->minData(min);
229
230 QCOMPARE(expectedOK, it != dataSeries->cend());
231
232 // If the method doesn't return a end iterator, checks with expected value
233 if (expectedOK) {
234 QCOMPARE(expectedMin, it->x());
235 }
236 }
237
238 void TestDataSeries::testMaxData_data()
239 {
240 // ////////////// //
241 // Test structure //
242 // ////////////// //
243
244 // Data series to get max data
245 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries");
246
247 // Max data
248 QTest::addColumn<double>("max");
249
250 // Expected results
251 QTest::addColumn<bool>(
252 "expectedOK"); // if true, expects to have a result (i.e. the iterator != end iterator)
253 QTest::addColumn<double>(
254 "expectedMax"); // Expected value when method doesn't return end iterator
255
256 // ////////// //
257 // Test cases //
258 // ////////// //
259
260 QTest::newRow("maxData1") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
261 << 6. << true << 5.;
262 QTest::newRow("maxData2") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
263 << 5. << true << 5.;
264 QTest::newRow("maxData3") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
265 << 4.9 << true << 4.;
266 QTest::newRow("maxData4") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
267 << 1.1 << true << 1.;
268 QTest::newRow("maxData5") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
269 << 1. << true << 1.;
270 QTest::newRow("maxData6") << createSeries({}, {}) << 1.1 << false
271 << std::numeric_limits<double>::quiet_NaN();
272 }
273
274 void TestDataSeries::testMaxData()
275 {
276 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
277 QFETCH(double, max);
278
279 QFETCH(bool, expectedOK);
280 QFETCH(double, expectedMax);
281
282 auto it = dataSeries->maxData(max);
283
284 QCOMPARE(expectedOK, it != dataSeries->cend());
285
286 // If the method doesn't return a end iterator, checks with expected value
287 if (expectedOK) {
288 QCOMPARE(expectedMax, it->x());
289 }
290 }
291
170 void TestDataSeries::testSubdata_data()
292 void TestDataSeries::testSubdata_data()
171 {
293 {
172 // ////////////// //
294 // ////////////// //
173 // Test structure //
295 // Test structure //
174 // ////////////// //
296 // ////////////// //
175
297
176 // Data series to get subdata
298 // Data series to get subdata
177 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries");
299 QTest::addColumn<std::shared_ptr<ScalarSeries> >("dataSeries");
178
300
179 // Min/max values
301 // Min/max values
180 QTest::addColumn<double>("min");
302 QTest::addColumn<double>("min");
181 QTest::addColumn<double>("max");
303 QTest::addColumn<double>("max");
182
304
183 // Expected values after subdata
305 // Expected values after subdata
184 QTest::addColumn<QVector<double> >("expectedXAxisData");
306 QTest::addColumn<QVector<double> >("expectedXAxisData");
185 QTest::addColumn<QVector<double> >("expectedValuesData");
307 QTest::addColumn<QVector<double> >("expectedValuesData");
186
308
187 // ////////// //
309 // ////////// //
188 // Test cases //
310 // Test cases //
189 // ////////// //
311 // ////////// //
190
312
191 QTest::newRow("subData1") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
313 QTest::newRow("subData1") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
192 << -1. << 3.2 << QVector<double>{1., 2., 3.}
314 << -1. << 3.2 << QVector<double>{1., 2., 3.}
193 << QVector<double>{100., 200., 300.};
315 << QVector<double>{100., 200., 300.};
194 QTest::newRow("subData2") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
316 QTest::newRow("subData2") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
195 << 1. << 4. << QVector<double>{1., 2., 3., 4.}
317 << 1. << 4. << QVector<double>{1., 2., 3., 4.}
196 << QVector<double>{100., 200., 300., 400.};
318 << QVector<double>{100., 200., 300., 400.};
197 QTest::newRow("subData3") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
319 QTest::newRow("subData3") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
198 << 1. << 3.9 << QVector<double>{1., 2., 3.}
320 << 1. << 3.9 << QVector<double>{1., 2., 3.}
199 << QVector<double>{100., 200., 300.};
321 << QVector<double>{100., 200., 300.};
200 QTest::newRow("subData4") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
322 QTest::newRow("subData4") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
201 << 0. << 0.9 << QVector<double>{} << QVector<double>{};
323 << 0. << 0.9 << QVector<double>{} << QVector<double>{};
202 QTest::newRow("subData5") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
324 QTest::newRow("subData5") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
203 << 0. << 1. << QVector<double>{1.} << QVector<double>{100.};
325 << 0. << 1. << QVector<double>{1.} << QVector<double>{100.};
204 QTest::newRow("subData6") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
326 QTest::newRow("subData6") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
205 << 2.1 << 6. << QVector<double>{3., 4., 5.}
327 << 2.1 << 6. << QVector<double>{3., 4., 5.}
206 << QVector<double>{300., 400., 500.};
328 << QVector<double>{300., 400., 500.};
207 QTest::newRow("subData7") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
329 QTest::newRow("subData7") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
208 << 6. << 9. << QVector<double>{} << QVector<double>{};
330 << 6. << 9. << QVector<double>{} << QVector<double>{};
209 QTest::newRow("subData8") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
331 QTest::newRow("subData8") << createSeries({1., 2., 3., 4., 5.}, {100., 200., 300., 400., 500.})
210 << 5. << 9. << QVector<double>{5.} << QVector<double>{500.};
332 << 5. << 9. << QVector<double>{5.} << QVector<double>{500.};
211 }
333 }
212
334
213 void TestDataSeries::testSubdata()
335 void TestDataSeries::testSubdata()
214 {
336 {
215 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
337 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
216 QFETCH(double, min);
338 QFETCH(double, min);
217 QFETCH(double, max);
339 QFETCH(double, max);
218
340
219 QFETCH(QVector<double>, expectedXAxisData);
341 QFETCH(QVector<double>, expectedXAxisData);
220 QFETCH(QVector<double>, expectedValuesData);
342 QFETCH(QVector<double>, expectedValuesData);
221
343
222 auto bounds = dataSeries->subData(min, max);
344 auto bounds = dataSeries->subData(min, max);
223 QVERIFY(std::equal(bounds.first, bounds.second, expectedXAxisData.cbegin(),
345 QVERIFY(std::equal(bounds.first, bounds.second, expectedXAxisData.cbegin(),
224 expectedXAxisData.cend(),
346 expectedXAxisData.cend(),
225 [](const auto &it, const auto &expectedX) { return it.x() == expectedX; }));
347 [](const auto &it, const auto &expectedX) { return it.x() == expectedX; }));
226 QVERIFY(std::equal(
348 QVERIFY(std::equal(
227 bounds.first, bounds.second, expectedValuesData.cbegin(), expectedValuesData.cend(),
349 bounds.first, bounds.second, expectedValuesData.cbegin(), expectedValuesData.cend(),
228 [](const auto &it, const auto &expectedVal) { return it.value() == expectedVal; }));
350 [](const auto &it, const auto &expectedVal) { return it.value() == expectedVal; }));
229 }
351 }
230
352
231 QTEST_MAIN(TestDataSeries)
353 QTEST_MAIN(TestDataSeries)
232 #include "TestDataSeries.moc"
354 #include "TestDataSeries.moc"
@@ -1,45 +1,52
1 # On ignore toutes les règles vera++ pour le fichier spimpl
1 # On ignore toutes les règles vera++ pour le fichier spimpl
2 Common/spimpl\.h:\d+:.*
2 Common/spimpl\.h:\d+:.*
3
3
4 # Ignore false positive relative to two class definitions in a same file
4 # Ignore false positive relative to two class definitions in a same file
5 DataSourceItem\.h:\d+:.*IPSIS_S01.*
5 DataSourceItem\.h:\d+:.*IPSIS_S01.*
6 DataSeries\.h:\d+:.*IPSIS_S01.*
7 DataSeriesIterator\.h:\d+:.*IPSIS_S01.*
6
8
7 # Ignore false positive relative to a template class
9 # Ignore false positive relative to a template class
8 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (D)
10 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (D)
9 ArrayData\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (arraydata_detail)
11 ArrayData\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (arraydata_detail)
10 ArrayData\.h:\d+:.*IPSIS_S06.*found: (D)
12 ArrayData\.h:\d+:.*IPSIS_S06.*found: (D)
11 ArrayData\.h:\d+:.*IPSIS_S06.*found: (Dim)
13 ArrayData\.h:\d+:.*IPSIS_S06.*found: (Dim)
12 DataSeries\.h:\d+:.*IPSIS_S04_METHOD.*found: LOG_DataSeries
14 DataSeries\.h:\d+:.*IPSIS_S04_METHOD.*found: LOG_DataSeries
13 DataSeries\.h:\d+:.*IPSIS_S04_VARIABLE.*
15 DataSeries\.h:\d+:.*IPSIS_S04_VARIABLE.*
16 DataSeries\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (dataseries_detail)
14
17
15 # Ignore false positive relative to iterators
18 # Ignore false positive relative to iterators
16 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (forward_iterator_tag)
19 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (forward_iterator_tag)
17 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (IteratorValue)
20 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (IteratorValue)
18 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (ptrdiff_t)
21 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (ptrdiff_t)
19 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (value_type)
22 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (value_type)
20 ArrayData\.h:\d+:.*IPSIS_S05.*
23 ArrayData\.h:\d+:.*IPSIS_S05.*
21 ArrayData\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
24 ArrayData\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
22 ArrayData\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
25 ArrayData\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
23 ArrayData\.h:\d+:.*IPSIS_S06.*found: (value_type)
26 ArrayData\.h:\d+:.*IPSIS_S06.*found: (value_type)
24 ArrayData\.h:\d+:.*IPSIS_S06.*found: (IteratorValue)
27 ArrayData\.h:\d+:.*IPSIS_S06.*found: (IteratorValue)
25 ArrayData\.h:\d+:.*IPSIS_S06.*found: (difference_type)
28 ArrayData\.h:\d+:.*IPSIS_S06.*found: (difference_type)
26 ArrayData\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
29 ArrayData\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
27 ArrayData\.h:\d+:.*IPSIS_S06.*found: (pointer)
30 ArrayData\.h:\d+:.*IPSIS_S06.*found: (pointer)
28 ArrayData\.h:\d+:.*IPSIS_S06.*found: (reference)
31 ArrayData\.h:\d+:.*IPSIS_S06.*found: (reference)
29 ArrayData\.h:\d+:.*IPSIS_S06.*found: (value_type)
32 ArrayData\.h:\d+:.*IPSIS_S06.*found: (value_type)
30 DataSeries\.h:\d+:.*IPSIS_S05.*
33 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (forward_iterator_tag)
31 DataSeries\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
34 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (DataSeriesIteratorValue)
32 DataSeries\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
35 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (ptrdiff_t)
33 DataSeries\.h:\d+:.*IPSIS_S06.*found: (value_type)
36 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (value_type)
34 DataSeries\.h:\d+:.*IPSIS_S06.*found: (IteratorValue)
37 DataSeriesIterator\.h:\d+:.*IPSIS_S05.*
35 DataSeries\.h:\d+:.*IPSIS_S06.*found: (difference_type)
38 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
36 DataSeries\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
39 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
37 DataSeries\.h:\d+:.*IPSIS_S06.*found: (pointer)
40 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (value_type)
38 DataSeries\.h:\d+:.*IPSIS_S06.*found: (reference)
41 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (DataSeriesIteratorValue)
39 DataSeries\.h:\d+:.*IPSIS_S06.*found: (value_type)
42 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (difference_type)
43 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
44 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (pointer)
45 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (reference)
46 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (value_type)
40
47
41 # Ignore false positive relative to an alias
48 # Ignore false positive relative to an alias
42 DataSourceItemAction\.h:\d+:.*IPSIS_S06.*found: (ExecuteFunction)
49 DataSourceItemAction\.h:\d+:.*IPSIS_S06.*found: (ExecuteFunction)
43
50
44 # Ignore false positive relative to unnamed namespace
51 # Ignore false positive relative to unnamed namespace
45 VariableController\.cpp:\d+:.*IPSIS_F13.*
52 VariableController\.cpp:\d+:.*IPSIS_F13.*
General Comments 0
You need to be logged in to leave comments. Login now