@@ -1,40 +1,46 | |||||
1 | #ifndef SCIQLOP_VARIABLECACHECONTROLLER_H |
|
1 | #ifndef SCIQLOP_VARIABLECACHECONTROLLER_H | |
2 | #define SCIQLOP_VARIABLECACHECONTROLLER_H |
|
2 | #define SCIQLOP_VARIABLECACHECONTROLLER_H | |
3 |
|
3 | |||
|
4 | #include <QLoggingCategory> | |||
4 | #include <QObject> |
|
5 | #include <QObject> | |
5 |
|
6 | |||
6 | #include <Data/SqpDateTime.h> |
|
7 | #include <Data/SqpDateTime.h> | |
7 |
|
8 | |||
8 | #include <QLoggingCategory> |
|
9 | #include <QLoggingCategory> | |
9 |
|
10 | |||
10 | #include <Common/spimpl.h> |
|
11 | #include <Common/spimpl.h> | |
11 |
|
12 | |||
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) | |||
|
14 | ||||
12 | class Variable; |
|
15 | class Variable; | |
13 |
|
16 | |||
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) |
|
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) | |
15 |
|
18 | |||
16 |
|
19 | |||
17 | /// This class aims to store in the cache all of the dateTime already requested to the variable. |
|
20 | /// This class aims to store in the cache all of the dateTime already requested to the variable. | |
18 | class VariableCacheController : public QObject { |
|
21 | class VariableCacheController : public QObject { | |
19 | Q_OBJECT |
|
22 | Q_OBJECT | |
20 | public: |
|
23 | public: | |
21 | explicit VariableCacheController(QObject *parent = 0); |
|
24 | explicit VariableCacheController(QObject *parent = 0); | |
22 |
|
25 | |||
23 |
|
26 | |||
24 | void addDateTime(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
27 | void addDateTime(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
25 |
|
28 | |||
|
29 | /// Clears cache concerning a variable | |||
|
30 | void clear(std::shared_ptr<Variable> variable) noexcept; | |||
|
31 | ||||
26 | /// Return all of the SqpDataTime part of the dateTime whose are not in the cache |
|
32 | /// Return all of the SqpDataTime part of the dateTime whose are not in the cache | |
27 | QVector<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, |
|
33 | QVector<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, | |
28 | const SqpDateTime &dateTime); |
|
34 | const SqpDateTime &dateTime); | |
29 |
|
35 | |||
30 |
|
36 | |||
31 | QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept; |
|
37 | QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept; | |
32 |
|
38 | |||
33 | void displayCache(std::shared_ptr<Variable> variable) const; |
|
39 | void displayCache(std::shared_ptr<Variable> variable) const; | |
34 |
|
40 | |||
35 | private: |
|
41 | private: | |
36 | class VariableCacheControllerPrivate; |
|
42 | class VariableCacheControllerPrivate; | |
37 | spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl; |
|
43 | spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl; | |
38 | }; |
|
44 | }; | |
39 |
|
45 | |||
40 | #endif // SCIQLOP_VARIABLECACHECONTROLLER_H |
|
46 | #endif // SCIQLOP_VARIABLECACHECONTROLLER_H |
@@ -1,77 +1,78 | |||||
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H |
|
1 | #ifndef SCIQLOP_VARIABLECONTROLLER_H | |
2 | #define SCIQLOP_VARIABLECONTROLLER_H |
|
2 | #define SCIQLOP_VARIABLECONTROLLER_H | |
3 |
|
3 | |||
4 | #include <Data/SqpDateTime.h> |
|
4 | #include <Data/SqpDateTime.h> | |
5 |
|
5 | |||
6 | #include <QLoggingCategory> |
|
6 | #include <QLoggingCategory> | |
7 | #include <QObject> |
|
7 | #include <QObject> | |
8 |
|
8 | |||
9 | #include <Common/spimpl.h> |
|
9 | #include <Common/spimpl.h> | |
10 |
|
10 | |||
11 | class IDataProvider; |
|
11 | class IDataProvider; | |
12 | class QItemSelectionModel; |
|
12 | class QItemSelectionModel; | |
13 | class TimeController; |
|
13 | class TimeController; | |
14 | class Variable; |
|
14 | class Variable; | |
15 | class VariableModel; |
|
15 | class VariableModel; | |
16 |
|
16 | |||
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) |
|
17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | |
18 |
|
18 | |||
19 | /** |
|
19 | /** | |
20 | * @brief The VariableController class aims to handle the variables in SciQlop. |
|
20 | * @brief The VariableController class aims to handle the variables in SciQlop. | |
21 | */ |
|
21 | */ | |
22 | class VariableController : public QObject { |
|
22 | class VariableController : public QObject { | |
23 | Q_OBJECT |
|
23 | Q_OBJECT | |
24 | public: |
|
24 | public: | |
25 | explicit VariableController(QObject *parent = 0); |
|
25 | explicit VariableController(QObject *parent = 0); | |
26 | virtual ~VariableController(); |
|
26 | virtual ~VariableController(); | |
27 |
|
27 | |||
28 | VariableModel *variableModel() noexcept; |
|
28 | VariableModel *variableModel() noexcept; | |
29 | QItemSelectionModel *variableSelectionModel() noexcept; |
|
29 | QItemSelectionModel *variableSelectionModel() noexcept; | |
30 |
|
30 | |||
31 | void setTimeController(TimeController *timeController) noexcept; |
|
31 | void setTimeController(TimeController *timeController) noexcept; | |
32 |
|
32 | |||
33 | /** |
|
33 | /** | |
34 | * Deletes from the controller the variable passed in parameter. |
|
34 | * Deletes from the controller the variable passed in parameter. | |
35 | * |
|
35 | * | |
36 | * Delete a variable includes: |
|
36 | * Delete a variable includes: | |
37 | * - the deletion of the provider associated with the variable |
|
37 | * - the deletion of the provider associated with the variable | |
|
38 | * - removing the cache associated with the variable | |||
38 | * |
|
39 | * | |
39 | * @param variable the variable to delete from the controller. |
|
40 | * @param variable the variable to delete from the controller. | |
40 | */ |
|
41 | */ | |
41 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; |
|
42 | void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | |
42 |
|
43 | |||
43 | /** |
|
44 | /** | |
44 | * Deletes from the controller the variables passed in parameter. |
|
45 | * Deletes from the controller the variables passed in parameter. | |
45 | * @param variables the variables to delete from the controller. |
|
46 | * @param variables the variables to delete from the controller. | |
46 | * @sa deleteVariable() |
|
47 | * @sa deleteVariable() | |
47 | */ |
|
48 | */ | |
48 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; |
|
49 | void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; | |
49 |
|
50 | |||
50 | signals: |
|
51 | signals: | |
51 | /// Signal emitted when a variable has been created |
|
52 | /// Signal emitted when a variable has been created | |
52 | void variableCreated(std::shared_ptr<Variable> variable); |
|
53 | void variableCreated(std::shared_ptr<Variable> variable); | |
53 |
|
54 | |||
54 | public slots: |
|
55 | public slots: | |
55 | /// Request the data loading of the variable whithin dateTime |
|
56 | /// Request the data loading of the variable whithin dateTime | |
56 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); |
|
57 | void onRequestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | |
57 | /** |
|
58 | /** | |
58 | * Creates a new variable and adds it to the model |
|
59 | * Creates a new variable and adds it to the model | |
59 | * @param name the name of the new variable |
|
60 | * @param name the name of the new variable | |
60 | * @param provider the data provider for the new variable |
|
61 | * @param provider the data provider for the new variable | |
61 | */ |
|
62 | */ | |
62 | void createVariable(const QString &name, std::shared_ptr<IDataProvider> provider) noexcept; |
|
63 | void createVariable(const QString &name, std::shared_ptr<IDataProvider> provider) noexcept; | |
63 |
|
64 | |||
64 | /// Update the temporal parameters of every selected variable to dateTime |
|
65 | /// Update the temporal parameters of every selected variable to dateTime | |
65 | void onDateTimeOnSelection(const SqpDateTime &dateTime); |
|
66 | void onDateTimeOnSelection(const SqpDateTime &dateTime); | |
66 |
|
67 | |||
67 | void initialize(); |
|
68 | void initialize(); | |
68 | void finalize(); |
|
69 | void finalize(); | |
69 |
|
70 | |||
70 | private: |
|
71 | private: | |
71 | void waitForFinish(); |
|
72 | void waitForFinish(); | |
72 |
|
73 | |||
73 | class VariableControllerPrivate; |
|
74 | class VariableControllerPrivate; | |
74 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; |
|
75 | spimpl::unique_impl_ptr<VariableControllerPrivate> impl; | |
75 | }; |
|
76 | }; | |
76 |
|
77 | |||
77 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
|
78 | #endif // SCIQLOP_VARIABLECONTROLLER_H |
@@ -1,204 +1,220 | |||||
1 | #include "Variable/VariableCacheController.h" |
|
1 | #include "Variable/VariableCacheController.h" | |
2 |
|
2 | |||
3 | #include "Variable/Variable.h" |
|
3 | #include "Variable/Variable.h" | |
4 | #include <unordered_map> |
|
4 | #include <unordered_map> | |
5 |
|
5 | |||
6 | Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController") |
|
6 | Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController") | |
7 |
|
7 | |||
8 | struct VariableCacheController::VariableCacheControllerPrivate { |
|
8 | struct VariableCacheController::VariableCacheControllerPrivate { | |
9 |
|
9 | |||
10 | std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> > |
|
10 | std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> > | |
11 | m_VariableToSqpDateTimeListMap; |
|
11 | m_VariableToSqpDateTimeListMap; | |
12 |
|
12 | |||
13 | void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
13 | void addInCacheDataByEnd(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
14 | QVector<SqpDateTime> ¬InCache, int cacheIndex, |
|
14 | QVector<SqpDateTime> ¬InCache, int cacheIndex, | |
15 | double currentTStart); |
|
15 | double currentTStart); | |
16 |
|
16 | |||
17 | void addInCacheDataByStart(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
17 | void addInCacheDataByStart(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
18 | QVector<SqpDateTime> ¬InCache, int cacheIndex, |
|
18 | QVector<SqpDateTime> ¬InCache, int cacheIndex, | |
19 | double currentTStart); |
|
19 | double currentTStart); | |
20 |
|
20 | |||
21 |
|
21 | |||
22 | void addDateTimeRecurse(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
22 | void addDateTimeRecurse(const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
23 | int cacheIndex); |
|
23 | int cacheIndex); | |
24 | }; |
|
24 | }; | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | VariableCacheController::VariableCacheController(QObject *parent) |
|
27 | VariableCacheController::VariableCacheController(QObject *parent) | |
28 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableCacheControllerPrivate>()} |
|
28 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableCacheControllerPrivate>()} | |
29 | { |
|
29 | { | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, |
|
32 | void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, | |
33 | const SqpDateTime &dateTime) |
|
33 | const SqpDateTime &dateTime) | |
34 | { |
|
34 | { | |
35 | if (variable) { |
|
35 | if (variable) { | |
36 | auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
36 | auto findVariableIte = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
37 | if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) { |
|
37 | if (findVariableIte == impl->m_VariableToSqpDateTimeListMap.end()) { | |
38 | impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime); |
|
38 | impl->m_VariableToSqpDateTimeListMap[variable].push_back(dateTime); | |
39 | } |
|
39 | } | |
40 | else { |
|
40 | else { | |
41 |
|
41 | |||
42 | // addDateTime modify the list<SqpDateTime> of the variable in a way to ensure |
|
42 | // addDateTime modify the list<SqpDateTime> of the variable in a way to ensure | |
43 | // that the list is ordered : l(0) < l(1). We assume also a < b |
|
43 | // that the list is ordered : l(0) < l(1). We assume also a < b | |
44 | // (with a & b of type SqpDateTime) means ts(b) > te(a) |
|
44 | // (with a & b of type SqpDateTime) means ts(b) > te(a) | |
45 |
|
45 | |||
46 | // The algorithm will try the merge of two interval: |
|
46 | // The algorithm will try the merge of two interval: | |
47 | // - dateTime will be compare with the first interval of the list: |
|
47 | // - dateTime will be compare with the first interval of the list: | |
48 | // A: if it is inferior, it will be inserted and it's finished. |
|
48 | // A: if it is inferior, it will be inserted and it's finished. | |
49 | // B: if it is in intersection, it will be merge then the merged one |
|
49 | // B: if it is in intersection, it will be merge then the merged one | |
50 | // will be compared to the next interval. The old one is remove from the list |
|
50 | // will be compared to the next interval. The old one is remove from the list | |
51 | // C: if it is superior, we do the same with the next interval of the list |
|
51 | // C: if it is superior, we do the same with the next interval of the list | |
52 |
|
52 | |||
53 | try { |
|
53 | try { | |
54 | impl->addDateTimeRecurse(dateTime, |
|
54 | impl->addDateTimeRecurse(dateTime, | |
55 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); |
|
55 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); | |
56 | } |
|
56 | } | |
57 | catch (const std::out_of_range &e) { |
|
57 | catch (const std::out_of_range &e) { | |
58 | qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what(); |
|
58 | qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what(); | |
59 | } |
|
59 | } | |
60 | } |
|
60 | } | |
61 | } |
|
61 | } | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
|
64 | void VariableCacheController::clear(std::shared_ptr<Variable> variable) noexcept | |||
|
65 | { | |||
|
66 | if (!variable) { | |||
|
67 | qCCritical(LOG_VariableCacheController()) << "Can't clear variable cache: variable is null"; | |||
|
68 | return; | |||
|
69 | } | |||
|
70 | ||||
|
71 | auto nbEntries = impl->m_VariableToSqpDateTimeListMap.erase(variable); | |||
|
72 | ||||
|
73 | auto clearCacheMessage | |||
|
74 | = (nbEntries != 0) | |||
|
75 | ? tr("Variable cache cleared for variable %1").arg(variable->name()) | |||
|
76 | : tr("No deletion of variable cache: no cache was associated with the variable"); | |||
|
77 | qCDebug(LOG_VariableCacheController()) << clearCacheMessage; | |||
|
78 | } | |||
|
79 | ||||
64 | QVector<SqpDateTime> |
|
80 | QVector<SqpDateTime> | |
65 | VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, |
|
81 | VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, | |
66 | const SqpDateTime &dateTime) |
|
82 | const SqpDateTime &dateTime) | |
67 | { |
|
83 | { | |
68 | auto notInCache = QVector<SqpDateTime>{}; |
|
84 | auto notInCache = QVector<SqpDateTime>{}; | |
69 |
|
85 | |||
70 | // This algorithm is recursif. The idea is to localise the start time then the end time in the |
|
86 | // This algorithm is recursif. The idea is to localise the start time then the end time in the | |
71 | // list of date time request associated to the variable |
|
87 | // list of date time request associated to the variable | |
72 | // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b |
|
88 | // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b | |
73 | // (with a & b of type SqpDateTime) means ts(b) > te(a) |
|
89 | // (with a & b of type SqpDateTime) means ts(b) > te(a) | |
74 | auto it = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
90 | auto it = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
75 | if (it != impl->m_VariableToSqpDateTimeListMap.end()) { |
|
91 | if (it != impl->m_VariableToSqpDateTimeListMap.end()) { | |
76 | impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart); |
|
92 | impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart); | |
77 | } |
|
93 | } | |
78 | else { |
|
94 | else { | |
79 | notInCache << dateTime; |
|
95 | notInCache << dateTime; | |
80 | } |
|
96 | } | |
81 |
|
97 | |||
82 | return notInCache; |
|
98 | return notInCache; | |
83 | } |
|
99 | } | |
84 |
|
100 | |||
85 | QVector<SqpDateTime> |
|
101 | QVector<SqpDateTime> | |
86 | VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept |
|
102 | VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept | |
87 | { |
|
103 | { | |
88 | try { |
|
104 | try { | |
89 | return impl->m_VariableToSqpDateTimeListMap.at(variable); |
|
105 | return impl->m_VariableToSqpDateTimeListMap.at(variable); | |
90 | } |
|
106 | } | |
91 | catch (const std::out_of_range &e) { |
|
107 | catch (const std::out_of_range &e) { | |
92 | qCWarning(LOG_VariableCacheController()) << e.what(); |
|
108 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
93 | return QVector<SqpDateTime>{}; |
|
109 | return QVector<SqpDateTime>{}; | |
94 | } |
|
110 | } | |
95 | } |
|
111 | } | |
96 |
|
112 | |||
97 | void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse( |
|
113 | void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse( | |
98 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, int cacheIndex) |
|
114 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, int cacheIndex) | |
99 | { |
|
115 | { | |
100 | const auto dateTimeListSize = dateTimeList.count(); |
|
116 | const auto dateTimeListSize = dateTimeList.count(); | |
101 | if (cacheIndex >= dateTimeListSize) { |
|
117 | if (cacheIndex >= dateTimeListSize) { | |
102 | dateTimeList.push_back(dateTime); |
|
118 | dateTimeList.push_back(dateTime); | |
103 | // there is no anymore interval to compore, we can just push_back it |
|
119 | // there is no anymore interval to compore, we can just push_back it | |
104 | return; |
|
120 | return; | |
105 | } |
|
121 | } | |
106 |
|
122 | |||
107 | auto currentDateTime = dateTimeList[cacheIndex]; |
|
123 | auto currentDateTime = dateTimeList[cacheIndex]; | |
108 |
|
124 | |||
109 | if (dateTime.m_TEnd < currentDateTime.m_TStart) { |
|
125 | if (dateTime.m_TEnd < currentDateTime.m_TStart) { | |
110 | // The compared one is < to current one compared, we can insert it |
|
126 | // The compared one is < to current one compared, we can insert it | |
111 | dateTimeList.insert(cacheIndex, dateTime); |
|
127 | dateTimeList.insert(cacheIndex, dateTime); | |
112 | } |
|
128 | } | |
113 | else if (dateTime.m_TStart > currentDateTime.m_TEnd) { |
|
129 | else if (dateTime.m_TStart > currentDateTime.m_TEnd) { | |
114 | // The compared one is > to current one compared we can comparet if to the next one |
|
130 | // The compared one is > to current one compared we can comparet if to the next one | |
115 | addDateTimeRecurse(dateTime, dateTimeList, ++cacheIndex); |
|
131 | addDateTimeRecurse(dateTime, dateTimeList, ++cacheIndex); | |
116 | } |
|
132 | } | |
117 | else { |
|
133 | else { | |
118 | // Merge cases: we need to merge the two interval, remove the old one from the list then |
|
134 | // Merge cases: we need to merge the two interval, remove the old one from the list then | |
119 | // rerun the algo from this index with the merged interval |
|
135 | // rerun the algo from this index with the merged interval | |
120 | auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart); |
|
136 | auto mTStart = std::min(dateTime.m_TStart, currentDateTime.m_TStart); | |
121 | auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd); |
|
137 | auto mTEnd = std::max(dateTime.m_TEnd, currentDateTime.m_TEnd); | |
122 | auto mergeDateTime = SqpDateTime{mTStart, mTEnd}; |
|
138 | auto mergeDateTime = SqpDateTime{mTStart, mTEnd}; | |
123 |
|
139 | |||
124 | dateTimeList.remove(cacheIndex); |
|
140 | dateTimeList.remove(cacheIndex); | |
125 | addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex); |
|
141 | addDateTimeRecurse(mergeDateTime, dateTimeList, cacheIndex); | |
126 | } |
|
142 | } | |
127 | } |
|
143 | } | |
128 |
|
144 | |||
129 |
|
145 | |||
130 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd( |
|
146 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByEnd( | |
131 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
147 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
132 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) |
|
148 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) | |
133 | { |
|
149 | { | |
134 | const auto dateTimeListSize = dateTimeList.count(); |
|
150 | const auto dateTimeListSize = dateTimeList.count(); | |
135 | if (cacheIndex >= dateTimeListSize) { |
|
151 | if (cacheIndex >= dateTimeListSize) { | |
136 | if (currentTStart < dateTime.m_TEnd) { |
|
152 | if (currentTStart < dateTime.m_TEnd) { | |
137 |
|
153 | |||
138 | // te localised after all other interval: The last interval is [currentTsart, te] |
|
154 | // te localised after all other interval: The last interval is [currentTsart, te] | |
139 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); |
|
155 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); | |
140 | } |
|
156 | } | |
141 | return; |
|
157 | return; | |
142 | } |
|
158 | } | |
143 |
|
159 | |||
144 | auto currentDateTimeJ = dateTimeList[cacheIndex]; |
|
160 | auto currentDateTimeJ = dateTimeList[cacheIndex]; | |
145 | if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) { |
|
161 | if (dateTime.m_TEnd <= currentDateTimeJ.m_TStart) { | |
146 | // te localised between to interval: The last interval is [currentTsart, te] |
|
162 | // te localised between to interval: The last interval is [currentTsart, te] | |
147 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); |
|
163 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); | |
148 | } |
|
164 | } | |
149 | else { |
|
165 | else { | |
150 | notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart}); |
|
166 | notInCache.push_back(SqpDateTime{currentTStart, currentDateTimeJ.m_TStart}); | |
151 | if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) { |
|
167 | if (dateTime.m_TEnd > currentDateTimeJ.m_TEnd) { | |
152 | // te not localised before the current interval: we need to look at the next interval |
|
168 | // te not localised before the current interval: we need to look at the next interval | |
153 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex, |
|
169 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, ++cacheIndex, | |
154 | currentDateTimeJ.m_TEnd); |
|
170 | currentDateTimeJ.m_TEnd); | |
155 | } |
|
171 | } | |
156 | } |
|
172 | } | |
157 | } |
|
173 | } | |
158 |
|
174 | |||
159 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart( |
|
175 | void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataByStart( | |
160 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, |
|
176 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, | |
161 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) |
|
177 | QVector<SqpDateTime> ¬InCache, int cacheIndex, double currentTStart) | |
162 | { |
|
178 | { | |
163 | const auto dateTimeListSize = dateTimeList.count(); |
|
179 | const auto dateTimeListSize = dateTimeList.count(); | |
164 | if (cacheIndex >= dateTimeListSize) { |
|
180 | if (cacheIndex >= dateTimeListSize) { | |
165 | // ts localised after all other interval: The last interval is [ts, te] |
|
181 | // ts localised after all other interval: The last interval is [ts, te] | |
166 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); |
|
182 | notInCache.push_back(SqpDateTime{currentTStart, dateTime.m_TEnd}); | |
167 | return; |
|
183 | return; | |
168 | } |
|
184 | } | |
169 |
|
185 | |||
170 | auto currentDateTimeI = dateTimeList[cacheIndex]; |
|
186 | auto currentDateTimeI = dateTimeList[cacheIndex]; | |
171 | if (currentTStart < currentDateTimeI.m_TStart) { |
|
187 | if (currentTStart < currentDateTimeI.m_TStart) { | |
172 |
|
188 | |||
173 | // ts localised between to interval: let's localized te |
|
189 | // ts localised between to interval: let's localized te | |
174 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart); |
|
190 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart); | |
175 | } |
|
191 | } | |
176 | else if (currentTStart < currentDateTimeI.m_TEnd) { |
|
192 | else if (currentTStart < currentDateTimeI.m_TEnd) { | |
177 | if (dateTime.m_TEnd > currentDateTimeI.m_TEnd) { |
|
193 | if (dateTime.m_TEnd > currentDateTimeI.m_TEnd) { | |
178 | // ts not localised before the current interval: we need to look at the next interval |
|
194 | // ts not localised before the current interval: we need to look at the next interval | |
179 | // We can assume now current tstart is the last interval tend, because data between them |
|
195 | // We can assume now current tstart is the last interval tend, because data between them | |
180 | // are |
|
196 | // are | |
181 | // in the cache |
|
197 | // in the cache | |
182 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, |
|
198 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, | |
183 | currentDateTimeI.m_TEnd); |
|
199 | currentDateTimeI.m_TEnd); | |
184 | } |
|
200 | } | |
185 | } |
|
201 | } | |
186 | else { |
|
202 | else { | |
187 | // ts not localised before the current interval: we need to look at the next interval |
|
203 | // ts not localised before the current interval: we need to look at the next interval | |
188 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, currentTStart); |
|
204 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, currentTStart); | |
189 | } |
|
205 | } | |
190 | } |
|
206 | } | |
191 |
|
207 | |||
192 |
|
208 | |||
193 | void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const |
|
209 | void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const | |
194 | { |
|
210 | { | |
195 | auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); |
|
211 | auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
196 | if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { |
|
212 | if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { | |
197 | qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache") |
|
213 | qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache") | |
198 | << variableDateTimeList->second; |
|
214 | << variableDateTimeList->second; | |
199 | } |
|
215 | } | |
200 | else { |
|
216 | else { | |
201 | qCWarning(LOG_VariableCacheController()) |
|
217 | qCWarning(LOG_VariableCacheController()) | |
202 | << tr("Cannot display a variable that is not in the cache"); |
|
218 | << tr("Cannot display a variable that is not in the cache"); | |
203 | } |
|
219 | } | |
204 | } |
|
220 | } |
@@ -1,200 +1,203 | |||||
1 | #include <Variable/Variable.h> |
|
1 | #include <Variable/Variable.h> | |
2 | #include <Variable/VariableCacheController.h> |
|
2 | #include <Variable/VariableCacheController.h> | |
3 | #include <Variable/VariableController.h> |
|
3 | #include <Variable/VariableController.h> | |
4 | #include <Variable/VariableModel.h> |
|
4 | #include <Variable/VariableModel.h> | |
5 |
|
5 | |||
6 | #include <Data/DataProviderParameters.h> |
|
6 | #include <Data/DataProviderParameters.h> | |
7 | #include <Data/IDataProvider.h> |
|
7 | #include <Data/IDataProvider.h> | |
8 | #include <Data/IDataSeries.h> |
|
8 | #include <Data/IDataSeries.h> | |
9 | #include <Time/TimeController.h> |
|
9 | #include <Time/TimeController.h> | |
10 |
|
10 | |||
11 | #include <QDateTime> |
|
11 | #include <QDateTime> | |
12 | #include <QMutex> |
|
12 | #include <QMutex> | |
13 | #include <QThread> |
|
13 | #include <QThread> | |
14 | #include <QtCore/QItemSelectionModel> |
|
14 | #include <QtCore/QItemSelectionModel> | |
15 |
|
15 | |||
16 | #include <unordered_map> |
|
16 | #include <unordered_map> | |
17 |
|
17 | |||
18 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") |
|
18 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") | |
19 |
|
19 | |||
20 | namespace { |
|
20 | namespace { | |
21 |
|
21 | |||
22 | /// @todo Generates default dataseries, according to the provider passed in parameter. This method |
|
22 | /// @todo Generates default dataseries, according to the provider passed in parameter. This method | |
23 | /// will be deleted when the timerange is recovered from SciQlop |
|
23 | /// will be deleted when the timerange is recovered from SciQlop | |
24 | std::shared_ptr<IDataSeries> generateDefaultDataSeries(const IDataProvider &provider, |
|
24 | std::shared_ptr<IDataSeries> generateDefaultDataSeries(const IDataProvider &provider, | |
25 | const SqpDateTime &dateTime) noexcept |
|
25 | const SqpDateTime &dateTime) noexcept | |
26 | { |
|
26 | { | |
27 | auto parameters = DataProviderParameters{dateTime}; |
|
27 | auto parameters = DataProviderParameters{dateTime}; | |
28 |
|
28 | |||
29 | return provider.retrieveData(parameters); |
|
29 | return provider.retrieveData(parameters); | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 | } // namespace |
|
32 | } // namespace | |
33 |
|
33 | |||
34 | struct VariableController::VariableControllerPrivate { |
|
34 | struct VariableController::VariableControllerPrivate { | |
35 | explicit VariableControllerPrivate(VariableController *parent) |
|
35 | explicit VariableControllerPrivate(VariableController *parent) | |
36 | : m_WorkingMutex{}, |
|
36 | : m_WorkingMutex{}, | |
37 | m_VariableModel{new VariableModel{parent}}, |
|
37 | m_VariableModel{new VariableModel{parent}}, | |
38 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, |
|
38 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, | |
39 | m_VariableCacheController{std::make_unique<VariableCacheController>()} |
|
39 | m_VariableCacheController{std::make_unique<VariableCacheController>()} | |
40 | { |
|
40 | { | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | QMutex m_WorkingMutex; |
|
43 | QMutex m_WorkingMutex; | |
44 | /// Variable model. The VariableController has the ownership |
|
44 | /// Variable model. The VariableController has the ownership | |
45 | VariableModel *m_VariableModel; |
|
45 | VariableModel *m_VariableModel; | |
46 | QItemSelectionModel *m_VariableSelectionModel; |
|
46 | QItemSelectionModel *m_VariableSelectionModel; | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | TimeController *m_TimeController{nullptr}; |
|
49 | TimeController *m_TimeController{nullptr}; | |
50 | std::unique_ptr<VariableCacheController> m_VariableCacheController; |
|
50 | std::unique_ptr<VariableCacheController> m_VariableCacheController; | |
51 |
|
51 | |||
52 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > |
|
52 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > | |
53 | m_VariableToProviderMap; |
|
53 | m_VariableToProviderMap; | |
54 | }; |
|
54 | }; | |
55 |
|
55 | |||
56 | VariableController::VariableController(QObject *parent) |
|
56 | VariableController::VariableController(QObject *parent) | |
57 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} |
|
57 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} | |
58 | { |
|
58 | { | |
59 | qCDebug(LOG_VariableController()) << tr("VariableController construction") |
|
59 | qCDebug(LOG_VariableController()) << tr("VariableController construction") | |
60 | << QThread::currentThread(); |
|
60 | << QThread::currentThread(); | |
61 | } |
|
61 | } | |
62 |
|
62 | |||
63 | VariableController::~VariableController() |
|
63 | VariableController::~VariableController() | |
64 | { |
|
64 | { | |
65 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") |
|
65 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") | |
66 | << QThread::currentThread(); |
|
66 | << QThread::currentThread(); | |
67 | this->waitForFinish(); |
|
67 | this->waitForFinish(); | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | VariableModel *VariableController::variableModel() noexcept |
|
70 | VariableModel *VariableController::variableModel() noexcept | |
71 | { |
|
71 | { | |
72 | return impl->m_VariableModel; |
|
72 | return impl->m_VariableModel; | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept |
|
75 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept | |
76 | { |
|
76 | { | |
77 | return impl->m_VariableSelectionModel; |
|
77 | return impl->m_VariableSelectionModel; | |
78 | } |
|
78 | } | |
79 |
|
79 | |||
80 | void VariableController::setTimeController(TimeController *timeController) noexcept |
|
80 | void VariableController::setTimeController(TimeController *timeController) noexcept | |
81 | { |
|
81 | { | |
82 | impl->m_TimeController = timeController; |
|
82 | impl->m_TimeController = timeController; | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept |
|
85 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept | |
86 | { |
|
86 | { | |
87 | if (!variable) { |
|
87 | if (!variable) { | |
88 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; |
|
88 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; | |
89 | return; |
|
89 | return; | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 |
|
92 | |||
93 | // Deletes provider |
|
93 | // Deletes provider | |
94 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); |
|
94 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); | |
95 | qCDebug(LOG_VariableController()) |
|
95 | qCDebug(LOG_VariableController()) | |
96 | << tr("Number of providers deleted for variable %1: %2") |
|
96 | << tr("Number of providers deleted for variable %1: %2") | |
97 | .arg(variable->name(), QString::number(nbProvidersDeleted)); |
|
97 | .arg(variable->name(), QString::number(nbProvidersDeleted)); | |
98 |
|
98 | |||
|
99 | // Clears cache | |||
|
100 | impl->m_VariableCacheController->clear(variable); | |||
|
101 | ||||
99 |
|
102 | |||
100 | void VariableController::deleteVariables( |
|
103 | void VariableController::deleteVariables( | |
101 | const QVector<std::shared_ptr<Variable> > &variables) noexcept |
|
104 | const QVector<std::shared_ptr<Variable> > &variables) noexcept | |
102 | { |
|
105 | { | |
103 | for (auto variable : qAsConst(variables)) { |
|
106 | for (auto variable : qAsConst(variables)) { | |
104 | deleteVariable(variable); |
|
107 | deleteVariable(variable); | |
105 | } |
|
108 | } | |
106 | } |
|
109 | } | |
107 |
|
110 | |||
108 | void VariableController::createVariable(const QString &name, |
|
111 | void VariableController::createVariable(const QString &name, | |
109 | std::shared_ptr<IDataProvider> provider) noexcept |
|
112 | std::shared_ptr<IDataProvider> provider) noexcept | |
110 | { |
|
113 | { | |
111 |
|
114 | |||
112 | if (!impl->m_TimeController) { |
|
115 | if (!impl->m_TimeController) { | |
113 | qCCritical(LOG_VariableController()) |
|
116 | qCCritical(LOG_VariableController()) | |
114 | << tr("Impossible to create variable: The time controller is null"); |
|
117 | << tr("Impossible to create variable: The time controller is null"); | |
115 | return; |
|
118 | return; | |
116 | } |
|
119 | } | |
117 |
|
120 | |||
118 |
|
121 | |||
119 | /// @todo : for the moment : |
|
122 | /// @todo : for the moment : | |
120 | /// - the provider is only used to retrieve data from the variable for its initialization, but |
|
123 | /// - the provider is only used to retrieve data from the variable for its initialization, but | |
121 | /// it will be retained later |
|
124 | /// it will be retained later | |
122 | /// - default data are generated for the variable, without taking into account the timerange set |
|
125 | /// - default data are generated for the variable, without taking into account the timerange set | |
123 | /// in sciqlop |
|
126 | /// in sciqlop | |
124 | auto dateTime = impl->m_TimeController->dateTime(); |
|
127 | auto dateTime = impl->m_TimeController->dateTime(); | |
125 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime)) { |
|
128 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime)) { | |
126 |
|
129 | |||
127 | // store the provider |
|
130 | // store the provider | |
128 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
131 | impl->m_VariableToProviderMap[newVariable] = provider; | |
129 |
|
132 | |||
130 | auto addDateTimeAcquired |
|
133 | auto addDateTimeAcquired | |
131 | = [this, newVariable](auto dataSeriesAcquired, auto dateTimeToPutInCache) { |
|
134 | = [this, newVariable](auto dataSeriesAcquired, auto dateTimeToPutInCache) { | |
132 |
|
135 | |||
133 | impl->m_VariableCacheController->addDateTime(newVariable, dateTimeToPutInCache); |
|
136 | impl->m_VariableCacheController->addDateTime(newVariable, dateTimeToPutInCache); | |
134 | newVariable->setDataSeries(dataSeriesAcquired); |
|
137 | newVariable->setDataSeries(dataSeriesAcquired); | |
135 |
|
138 | |||
136 | }; |
|
139 | }; | |
137 |
|
140 | |||
138 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); |
|
141 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); | |
139 | this->onRequestDataLoading(newVariable, dateTime); |
|
142 | this->onRequestDataLoading(newVariable, dateTime); | |
140 |
|
143 | |||
141 | // notify the creation |
|
144 | // notify the creation | |
142 | emit variableCreated(newVariable); |
|
145 | emit variableCreated(newVariable); | |
143 | } |
|
146 | } | |
144 | } |
|
147 | } | |
145 |
|
148 | |||
146 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) |
|
149 | void VariableController::onDateTimeOnSelection(const SqpDateTime &dateTime) | |
147 | { |
|
150 | { | |
148 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); |
|
151 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); | |
149 |
|
152 | |||
150 | for (const auto &selectedRow : qAsConst(selectedRows)) { |
|
153 | for (const auto &selectedRow : qAsConst(selectedRows)) { | |
151 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { |
|
154 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { | |
152 | selectedVariable->setDateTime(dateTime); |
|
155 | selectedVariable->setDateTime(dateTime); | |
153 | this->onRequestDataLoading(selectedVariable, dateTime); |
|
156 | this->onRequestDataLoading(selectedVariable, dateTime); | |
154 | } |
|
157 | } | |
155 | } |
|
158 | } | |
156 | } |
|
159 | } | |
157 |
|
160 | |||
158 |
|
161 | |||
159 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, |
|
162 | void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable, | |
160 | const SqpDateTime &dateTime) |
|
163 | const SqpDateTime &dateTime) | |
161 | { |
|
164 | { | |
162 | // we want to load data of the variable for the dateTime. |
|
165 | // we want to load data of the variable for the dateTime. | |
163 | // First we check if the cache contains some of them. |
|
166 | // First we check if the cache contains some of them. | |
164 | // For the other, we ask the provider to give them. |
|
167 | // For the other, we ask the provider to give them. | |
165 | if (variable) { |
|
168 | if (variable) { | |
166 |
|
169 | |||
167 | auto dateTimeListNotInCache |
|
170 | auto dateTimeListNotInCache | |
168 | = impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime); |
|
171 | = impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime); | |
169 |
|
172 | |||
170 | if (!dateTimeListNotInCache.empty()) { |
|
173 | if (!dateTimeListNotInCache.empty()) { | |
171 | // Ask the provider for each data on the dateTimeListNotInCache |
|
174 | // Ask the provider for each data on the dateTimeListNotInCache | |
172 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( |
|
175 | impl->m_VariableToProviderMap.at(variable)->requestDataLoading( | |
173 | std::move(dateTimeListNotInCache)); |
|
176 | std::move(dateTimeListNotInCache)); | |
174 | } |
|
177 | } | |
175 | else { |
|
178 | else { | |
176 | emit variable->updated(); |
|
179 | emit variable->updated(); | |
177 | } |
|
180 | } | |
178 | } |
|
181 | } | |
179 | else { |
|
182 | else { | |
180 | qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null"); |
|
183 | qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null"); | |
181 | } |
|
184 | } | |
182 | } |
|
185 | } | |
183 |
|
186 | |||
184 |
|
187 | |||
185 | void VariableController::initialize() |
|
188 | void VariableController::initialize() | |
186 | { |
|
189 | { | |
187 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); |
|
190 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); | |
188 | impl->m_WorkingMutex.lock(); |
|
191 | impl->m_WorkingMutex.lock(); | |
189 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); |
|
192 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); | |
190 | } |
|
193 | } | |
191 |
|
194 | |||
192 | void VariableController::finalize() |
|
195 | void VariableController::finalize() | |
193 | { |
|
196 | { | |
194 | impl->m_WorkingMutex.unlock(); |
|
197 | impl->m_WorkingMutex.unlock(); | |
195 | } |
|
198 | } | |
196 |
|
199 | |||
197 | void VariableController::waitForFinish() |
|
200 | void VariableController::waitForFinish() | |
198 | { |
|
201 | { | |
199 | QMutexLocker locker{&impl->m_WorkingMutex}; |
|
202 | QMutexLocker locker{&impl->m_WorkingMutex}; | |
200 | } |
|
203 | } |
General Comments 0
You need to be logged in to leave comments.
Login now