@@ -22,12 +22,9 class Variable : public QObject { | |||||
22 | Q_OBJECT |
|
22 | Q_OBJECT | |
23 |
|
23 | |||
24 | public: |
|
24 | public: | |
25 |
explicit Variable(const QString &name, const |
|
25 | explicit Variable(const QString &name, const SqpDateTime &dateTime); | |
26 | const SqpDateTime &dateTime); |
|
|||
27 |
|
26 | |||
28 | QString name() const noexcept; |
|
27 | QString name() const noexcept; | |
29 | QString mission() const noexcept; |
|
|||
30 | QString unit() const noexcept; |
|
|||
31 | SqpDateTime dateTime() const noexcept; |
|
28 | SqpDateTime dateTime() const noexcept; | |
32 | void setDateTime(const SqpDateTime &dateTime) noexcept; |
|
29 | void setDateTime(const SqpDateTime &dateTime) noexcept; | |
33 |
|
30 |
@@ -9,27 +9,19 | |||||
9 | Q_LOGGING_CATEGORY(LOG_Variable, "Variable") |
|
9 | Q_LOGGING_CATEGORY(LOG_Variable, "Variable") | |
10 |
|
10 | |||
11 | struct Variable::VariablePrivate { |
|
11 | struct Variable::VariablePrivate { | |
12 |
explicit VariablePrivate(const QString &name, const |
|
12 | explicit VariablePrivate(const QString &name, const SqpDateTime &dateTime) | |
13 | const SqpDateTime &dateTime) |
|
13 | : m_Name{name}, m_DateTime{dateTime}, m_DataSeries{nullptr} | |
14 | : m_Name{name}, |
|
|||
15 | m_Unit{unit}, |
|
|||
16 | m_Mission{mission}, |
|
|||
17 | m_DateTime{dateTime}, |
|
|||
18 | m_DataSeries{nullptr} |
|
|||
19 | { |
|
14 | { | |
20 | } |
|
15 | } | |
21 |
|
16 | |||
22 | QString m_Name; |
|
17 | QString m_Name; | |
23 | QString m_Unit; |
|
|||
24 | QString m_Mission; |
|
|||
25 |
|
18 | |||
26 | SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. |
|
19 | SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache. | |
27 | std::unique_ptr<IDataSeries> m_DataSeries; |
|
20 | std::unique_ptr<IDataSeries> m_DataSeries; | |
28 | }; |
|
21 | }; | |
29 |
|
22 | |||
30 |
Variable::Variable(const QString &name, const |
|
23 | Variable::Variable(const QString &name, const SqpDateTime &dateTime) | |
31 | const SqpDateTime &dateTime) |
|
24 | : impl{spimpl::make_unique_impl<VariablePrivate>(name, dateTime)} | |
32 | : impl{spimpl::make_unique_impl<VariablePrivate>(name, unit, mission, dateTime)} |
|
|||
33 | { |
|
25 | { | |
34 | } |
|
26 | } | |
35 |
|
27 | |||
@@ -38,16 +30,6 QString Variable::name() const noexcept | |||||
38 | return impl->m_Name; |
|
30 | return impl->m_Name; | |
39 | } |
|
31 | } | |
40 |
|
32 | |||
41 | QString Variable::mission() const noexcept |
|
|||
42 | { |
|
|||
43 | return impl->m_Mission; |
|
|||
44 | } |
|
|||
45 |
|
||||
46 | QString Variable::unit() const noexcept |
|
|||
47 | { |
|
|||
48 | return impl->m_Unit; |
|
|||
49 | } |
|
|||
50 |
|
||||
51 | SqpDateTime Variable::dateTime() const noexcept |
|
33 | SqpDateTime Variable::dateTime() const noexcept | |
52 | { |
|
34 | { | |
53 | return impl->m_DateTime; |
|
35 | return impl->m_DateTime; |
@@ -65,9 +65,7 std::shared_ptr<Variable> VariableModel::createVariable(const QString &name, | |||||
65 | auto insertIndex = rowCount(); |
|
65 | auto insertIndex = rowCount(); | |
66 | beginInsertRows({}, insertIndex, insertIndex); |
|
66 | beginInsertRows({}, insertIndex, insertIndex); | |
67 |
|
67 | |||
68 | /// @todo For the moment, the other data of the variable is initialized with default values |
|
68 | auto variable = std::make_shared<Variable>(name, dateTime); | |
69 | auto variable = std::make_shared<Variable>(name, QStringLiteral("unit"), |
|
|||
70 | QStringLiteral("mission"), dateTime); |
|
|||
71 |
|
69 | |||
72 | impl->m_Variables.push_back(variable); |
|
70 | impl->m_Variables.push_back(variable); | |
73 | connect(variable.get(), &Variable::updated, this, &VariableModel::onVariableUpdated); |
|
71 | connect(variable.get(), &Variable::updated, this, &VariableModel::onVariableUpdated); |
@@ -35,7 +35,7 void TestVariableCacheController::testProvideNotInCacheDateTimeList() | |||||
35 | auto sqp2 = SqpDateTime{static_cast<double>(ts2.toMSecsSinceEpoch()), |
|
35 | auto sqp2 = SqpDateTime{static_cast<double>(ts2.toMSecsSinceEpoch()), | |
36 | static_cast<double>(te2.toMSecsSinceEpoch())}; |
|
36 | static_cast<double>(te2.toMSecsSinceEpoch())}; | |
37 |
|
37 | |||
38 |
auto var0 = std::make_shared<Variable>("", |
|
38 | auto var0 = std::make_shared<Variable>("", sqp0); | |
39 |
|
39 | |||
40 | variableCacheController.addDateTime(var0, sqp0); |
|
40 | variableCacheController.addDateTime(var0, sqp0); | |
41 | variableCacheController.addDateTime(var0, sqp1); |
|
41 | variableCacheController.addDateTime(var0, sqp1); | |
@@ -289,7 +289,7 void TestVariableCacheController::testAddDateTime() | |||||
289 | static_cast<double>(te03.toMSecsSinceEpoch())}; |
|
289 | static_cast<double>(te03.toMSecsSinceEpoch())}; | |
290 |
|
290 | |||
291 |
|
291 | |||
292 |
auto var0 = std::make_shared<Variable>("", |
|
292 | auto var0 = std::make_shared<Variable>("", sqp0); | |
293 |
|
293 | |||
294 |
|
294 | |||
295 | // First case: add the first interval to the variable :sqp0 |
|
295 | // First case: add the first interval to the variable :sqp0 |
General Comments 0
You need to be logged in to leave comments.
Login now