##// END OF EJS Templates
Adds data series to a variable
Alexandre Leroux -
r152:dcd9684539fa
parent child
Show More
@@ -1,24 +1,27
1 1 #ifndef SCIQLOP_VARIABLE_H
2 2 #define SCIQLOP_VARIABLE_H
3 3
4 4 #include <Common/spimpl.h>
5 5
6 class IDataSeries;
6 7 class QString;
7 8
8 9 /**
9 10 * @brief The Variable class represents a variable in SciQlop.
10 11 */
11 12 class Variable {
12 13 public:
13 14 explicit Variable(const QString &name, const QString &unit, const QString &mission);
14 15
15 16 QString name() const noexcept;
16 17 QString mission() const noexcept;
17 18 QString unit() const noexcept;
18 19
20 void addDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept;
21
19 22 private:
20 23 class VariablePrivate;
21 24 spimpl::unique_impl_ptr<VariablePrivate> impl;
22 25 };
23 26
24 27 #endif // SCIQLOP_VARIABLE_H
@@ -1,32 +1,43
1 1 #include "Variable/Variable.h"
2 2
3 #include <Data/IDataSeries.h>
4
3 5 struct Variable::VariablePrivate {
4 6 explicit VariablePrivate(const QString &name, const QString &unit, const QString &mission)
5 : m_Name{name}, m_Unit{unit}, m_Mission{mission}
7 : m_Name{name}, m_Unit{unit}, m_Mission{mission}, m_DataSeries{nullptr}
6 8 {
7 9 }
8 10
9 11 QString m_Name;
10 12 QString m_Unit;
11 13 QString m_Mission;
14 std::unique_ptr<IDataSeries> m_DataSeries;
12 15 };
13 16
14 17 Variable::Variable(const QString &name, const QString &unit, const QString &mission)
15 18 : impl{spimpl::make_unique_impl<VariablePrivate>(name, unit, mission)}
16 19 {
17 20 }
18 21
19 22 QString Variable::name() const noexcept
20 23 {
21 24 return impl->m_Name;
22 25 }
23 26
24 27 QString Variable::mission() const noexcept
25 28 {
26 29 return impl->m_Mission;
27 30 }
28 31
29 32 QString Variable::unit() const noexcept
30 33 {
31 34 return impl->m_Unit;
32 35 }
36
37 void Variable::addDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept
38 {
39 if (!impl->m_DataSeries) {
40 impl->m_DataSeries = std::move(dataSeries);
41 }
42 /// @todo : else, merge the two data series (if possible)
43 }
General Comments 0
You need to be logged in to leave comments. Login now