##// END OF EJS Templates
Adds data series to a variable
Alexandre Leroux -
r164:dcd9684539fa
parent child
Show More
@@ -1,24 +1,27
1 #ifndef SCIQLOP_VARIABLE_H
1 #ifndef SCIQLOP_VARIABLE_H
2 #define SCIQLOP_VARIABLE_H
2 #define SCIQLOP_VARIABLE_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5
5
6 class IDataSeries;
6 class QString;
7 class QString;
7
8
8 /**
9 /**
9 * @brief The Variable class represents a variable in SciQlop.
10 * @brief The Variable class represents a variable in SciQlop.
10 */
11 */
11 class Variable {
12 class Variable {
12 public:
13 public:
13 explicit Variable(const QString &name, const QString &unit, const QString &mission);
14 explicit Variable(const QString &name, const QString &unit, const QString &mission);
14
15
15 QString name() const noexcept;
16 QString name() const noexcept;
16 QString mission() const noexcept;
17 QString mission() const noexcept;
17 QString unit() const noexcept;
18 QString unit() const noexcept;
18
19
20 void addDataSeries(std::unique_ptr<IDataSeries> dataSeries) noexcept;
21
19 private:
22 private:
20 class VariablePrivate;
23 class VariablePrivate;
21 spimpl::unique_impl_ptr<VariablePrivate> impl;
24 spimpl::unique_impl_ptr<VariablePrivate> impl;
22 };
25 };
23
26
24 #endif // SCIQLOP_VARIABLE_H
27 #endif // SCIQLOP_VARIABLE_H
@@ -1,32 +1,43
1 #include "Variable/Variable.h"
1 #include "Variable/Variable.h"
2
2
3 #include <Data/IDataSeries.h>
4
3 struct Variable::VariablePrivate {
5 struct Variable::VariablePrivate {
4 explicit VariablePrivate(const QString &name, const QString &unit, const QString &mission)
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 QString m_Name;
11 QString m_Name;
10 QString m_Unit;
12 QString m_Unit;
11 QString m_Mission;
13 QString m_Mission;
14 std::unique_ptr<IDataSeries> m_DataSeries;
12 };
15 };
13
16
14 Variable::Variable(const QString &name, const QString &unit, const QString &mission)
17 Variable::Variable(const QString &name, const QString &unit, const QString &mission)
15 : impl{spimpl::make_unique_impl<VariablePrivate>(name, unit, mission)}
18 : impl{spimpl::make_unique_impl<VariablePrivate>(name, unit, mission)}
16 {
19 {
17 }
20 }
18
21
19 QString Variable::name() const noexcept
22 QString Variable::name() const noexcept
20 {
23 {
21 return impl->m_Name;
24 return impl->m_Name;
22 }
25 }
23
26
24 QString Variable::mission() const noexcept
27 QString Variable::mission() const noexcept
25 {
28 {
26 return impl->m_Mission;
29 return impl->m_Mission;
27 }
30 }
28
31
29 QString Variable::unit() const noexcept
32 QString Variable::unit() const noexcept
30 {
33 {
31 return impl->m_Unit;
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