|
@@
-1,1103
+1,1103
|
|
1
|
#include <Variable/Variable.h>
|
|
1
|
#include <Variable/Variable.h>
|
|
2
|
#include <Variable/VariableAcquisitionWorker.h>
|
|
2
|
#include <Variable/VariableAcquisitionWorker.h>
|
|
3
|
#include <Variable/VariableCacheStrategy.h>
|
|
3
|
#include <Variable/VariableCacheStrategy.h>
|
|
4
|
#include <Variable/VariableCacheStrategyFactory.h>
|
|
4
|
#include <Variable/VariableCacheStrategyFactory.h>
|
|
5
|
#include <Variable/VariableController.h>
|
|
5
|
#include <Variable/VariableController.h>
|
|
6
|
#include <Variable/VariableModel.h>
|
|
6
|
#include <Variable/VariableModel.h>
|
|
7
|
#include <Variable/VariableSynchronizationGroup.h>
|
|
7
|
#include <Variable/VariableSynchronizationGroup.h>
|
|
8
|
|
|
8
|
|
|
9
|
#include <Data/DataProviderParameters.h>
|
|
9
|
#include <Data/DataProviderParameters.h>
|
|
10
|
#include <Data/IDataProvider.h>
|
|
10
|
#include <Data/IDataProvider.h>
|
|
11
|
#include <Data/IDataSeries.h>
|
|
11
|
#include <Data/IDataSeries.h>
|
|
12
|
#include <Data/VariableRequest.h>
|
|
12
|
#include <Data/VariableRequest.h>
|
|
13
|
#include <Time/TimeController.h>
|
|
13
|
#include <Time/TimeController.h>
|
|
14
|
|
|
14
|
|
|
15
|
#include <Common/Numeric.h>
|
|
15
|
#include <Common/Numeric.h>
|
|
16
|
|
|
16
|
|
|
17
|
#include <QDataStream>
|
|
17
|
#include <QDataStream>
|
|
18
|
#include <QMutex>
|
|
18
|
#include <QMutex>
|
|
19
|
#include <QThread>
|
|
19
|
#include <QThread>
|
|
20
|
#include <QUuid>
|
|
20
|
#include <QUuid>
|
|
21
|
#include <QtCore/QItemSelectionModel>
|
|
21
|
#include <QtCore/QItemSelectionModel>
|
|
22
|
|
|
22
|
|
|
23
|
#include <deque>
|
|
23
|
#include <deque>
|
|
24
|
#include <set>
|
|
24
|
#include <set>
|
|
25
|
#include <unordered_map>
|
|
25
|
#include <unordered_map>
|
|
26
|
|
|
26
|
|
|
27
|
Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
|
|
27
|
Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
|
|
28
|
|
|
28
|
|
|
29
|
namespace {
|
|
29
|
namespace {
|
|
30
|
|
|
30
|
|
|
31
|
DateTimeRange computeSynchroRangeRequested(const DateTimeRange &varRange, const DateTimeRange &graphRange,
|
|
31
|
DateTimeRange computeSynchroRangeRequested(const DateTimeRange &varRange, const DateTimeRange &graphRange,
|
|
32
|
const DateTimeRange &oldGraphRange)
|
|
32
|
const DateTimeRange &oldGraphRange)
|
|
33
|
{
|
|
33
|
{
|
|
34
|
auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
|
|
34
|
auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
|
|
35
|
|
|
35
|
|
|
36
|
auto varRangeRequested = varRange;
|
|
36
|
auto varRangeRequested = varRange;
|
|
37
|
switch (zoomType) {
|
|
37
|
switch (zoomType) {
|
|
38
|
case AcquisitionZoomType::ZoomIn: {
|
|
38
|
case AcquisitionZoomType::ZoomIn: {
|
|
39
|
auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
|
|
39
|
auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
|
|
40
|
auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
|
|
40
|
auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
|
|
41
|
varRangeRequested.m_TStart += deltaLeft;
|
|
41
|
varRangeRequested.m_TStart += deltaLeft;
|
|
42
|
varRangeRequested.m_TEnd -= deltaRight;
|
|
42
|
varRangeRequested.m_TEnd -= deltaRight;
|
|
43
|
break;
|
|
43
|
break;
|
|
44
|
}
|
|
44
|
}
|
|
45
|
|
|
45
|
|
|
46
|
case AcquisitionZoomType::ZoomOut: {
|
|
46
|
case AcquisitionZoomType::ZoomOut: {
|
|
47
|
auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
|
|
47
|
auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
|
|
48
|
auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
|
|
48
|
auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
|
|
49
|
varRangeRequested.m_TStart -= deltaLeft;
|
|
49
|
varRangeRequested.m_TStart -= deltaLeft;
|
|
50
|
varRangeRequested.m_TEnd += deltaRight;
|
|
50
|
varRangeRequested.m_TEnd += deltaRight;
|
|
51
|
break;
|
|
51
|
break;
|
|
52
|
}
|
|
52
|
}
|
|
53
|
case AcquisitionZoomType::PanRight: {
|
|
53
|
case AcquisitionZoomType::PanRight: {
|
|
54
|
auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
|
|
54
|
auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
|
|
55
|
auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
|
|
55
|
auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
|
|
56
|
varRangeRequested.m_TStart += deltaLeft;
|
|
56
|
varRangeRequested.m_TStart += deltaLeft;
|
|
57
|
varRangeRequested.m_TEnd += deltaRight;
|
|
57
|
varRangeRequested.m_TEnd += deltaRight;
|
|
58
|
break;
|
|
58
|
break;
|
|
59
|
}
|
|
59
|
}
|
|
60
|
case AcquisitionZoomType::PanLeft: {
|
|
60
|
case AcquisitionZoomType::PanLeft: {
|
|
61
|
auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
|
|
61
|
auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
|
|
62
|
auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
|
|
62
|
auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
|
|
63
|
varRangeRequested.m_TStart -= deltaLeft;
|
|
63
|
varRangeRequested.m_TStart -= deltaLeft;
|
|
64
|
varRangeRequested.m_TEnd -= deltaRight;
|
|
64
|
varRangeRequested.m_TEnd -= deltaRight;
|
|
65
|
break;
|
|
65
|
break;
|
|
66
|
}
|
|
66
|
}
|
|
67
|
case AcquisitionZoomType::Unknown: {
|
|
67
|
case AcquisitionZoomType::Unknown: {
|
|
68
|
qCCritical(LOG_VariableController())
|
|
68
|
qCCritical(LOG_VariableController())
|
|
69
|
<< VariableController::tr("Impossible to synchronize: zoom type unknown");
|
|
69
|
<< VariableController::tr("Impossible to synchronize: zoom type unknown");
|
|
70
|
break;
|
|
70
|
break;
|
|
71
|
}
|
|
71
|
}
|
|
72
|
default:
|
|
72
|
default:
|
|
73
|
qCCritical(LOG_VariableController()) << VariableController::tr(
|
|
73
|
qCCritical(LOG_VariableController()) << VariableController::tr(
|
|
74
|
"Impossible to synchronize: zoom type not take into account");
|
|
74
|
"Impossible to synchronize: zoom type not take into account");
|
|
75
|
// No action
|
|
75
|
// No action
|
|
76
|
break;
|
|
76
|
break;
|
|
77
|
}
|
|
77
|
}
|
|
78
|
|
|
78
|
|
|
79
|
return varRangeRequested;
|
|
79
|
return varRangeRequested;
|
|
80
|
}
|
|
80
|
}
|
|
81
|
}
|
|
81
|
}
|
|
82
|
|
|
82
|
|
|
83
|
enum class VariableRequestHandlerState { OFF, RUNNING, PENDING };
|
|
83
|
enum class VariableRequestHandlerState { OFF, RUNNING, PENDING };
|
|
84
|
|
|
84
|
|
|
85
|
struct VariableRequestHandler {
|
|
85
|
struct VariableRequestHandler {
|
|
86
|
|
|
86
|
|
|
87
|
VariableRequestHandler()
|
|
87
|
VariableRequestHandler()
|
|
88
|
{
|
|
88
|
{
|
|
89
|
m_CanUpdate = false;
|
|
89
|
m_CanUpdate = false;
|
|
90
|
m_State = VariableRequestHandlerState::OFF;
|
|
90
|
m_State = VariableRequestHandlerState::OFF;
|
|
91
|
}
|
|
91
|
}
|
|
92
|
|
|
92
|
|
|
93
|
QUuid m_VarId;
|
|
93
|
QUuid m_VarId;
|
|
94
|
VariableRequest m_RunningVarRequest;
|
|
94
|
VariableRequest m_RunningVarRequest;
|
|
95
|
VariableRequest m_PendingVarRequest;
|
|
95
|
VariableRequest m_PendingVarRequest;
|
|
96
|
VariableRequestHandlerState m_State;
|
|
96
|
VariableRequestHandlerState m_State;
|
|
97
|
bool m_CanUpdate;
|
|
97
|
bool m_CanUpdate;
|
|
98
|
};
|
|
98
|
};
|
|
99
|
|
|
99
|
|
|
100
|
struct VariableController::VariableControllerPrivate {
|
|
100
|
struct VariableController::VariableControllerPrivate {
|
|
101
|
explicit VariableControllerPrivate(VariableController *parent)
|
|
101
|
explicit VariableControllerPrivate(VariableController *parent)
|
|
102
|
: m_WorkingMutex{},
|
|
102
|
: m_WorkingMutex{},
|
|
103
|
m_VariableModel{new VariableModel{parent}},
|
|
103
|
m_VariableModel{new VariableModel{parent}},
|
|
104
|
m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}},
|
|
104
|
m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}},
|
|
105
|
// m_VariableCacheStrategy{std::make_unique<VariableCacheStrategy>()},
|
|
105
|
// m_VariableCacheStrategy{std::make_unique<VariableCacheStrategy>()},
|
|
106
|
m_VariableCacheStrategy{VariableCacheStrategyFactory::createCacheStrategy(
|
|
106
|
m_VariableCacheStrategy{VariableCacheStrategyFactory::createCacheStrategy(
|
|
107
|
CacheStrategy::SingleThreshold)},
|
|
107
|
CacheStrategy::SingleThreshold)},
|
|
108
|
m_VariableAcquisitionWorker{std::make_unique<VariableAcquisitionWorker>()},
|
|
108
|
m_VariableAcquisitionWorker{std::make_unique<VariableAcquisitionWorker>()},
|
|
109
|
q{parent}
|
|
109
|
q{parent}
|
|
110
|
{
|
|
110
|
{
|
|
111
|
|
|
111
|
|
|
112
|
m_VariableAcquisitionWorker->moveToThread(&m_VariableAcquisitionWorkerThread);
|
|
112
|
m_VariableAcquisitionWorker->moveToThread(&m_VariableAcquisitionWorkerThread);
|
|
113
|
m_VariableAcquisitionWorkerThread.setObjectName("VariableAcquisitionWorkerThread");
|
|
113
|
m_VariableAcquisitionWorkerThread.setObjectName("VariableAcquisitionWorkerThread");
|
|
114
|
}
|
|
114
|
}
|
|
115
|
|
|
115
|
|
|
116
|
|
|
116
|
|
|
117
|
virtual ~VariableControllerPrivate()
|
|
117
|
virtual ~VariableControllerPrivate()
|
|
118
|
{
|
|
118
|
{
|
|
119
|
qCDebug(LOG_VariableController()) << tr("VariableControllerPrivate destruction");
|
|
119
|
qCDebug(LOG_VariableController()) << tr("VariableControllerPrivate destruction");
|
|
120
|
m_VariableAcquisitionWorkerThread.quit();
|
|
120
|
m_VariableAcquisitionWorkerThread.quit();
|
|
121
|
m_VariableAcquisitionWorkerThread.wait();
|
|
121
|
m_VariableAcquisitionWorkerThread.wait();
|
|
122
|
}
|
|
122
|
}
|
|
123
|
|
|
123
|
|
|
124
|
|
|
124
|
|
|
125
|
void processRequest(std::shared_ptr<Variable> var, const DateTimeRange &rangeRequested,
|
|
125
|
void processRequest(std::shared_ptr<Variable> var, const DateTimeRange &rangeRequested,
|
|
126
|
QUuid varRequestId);
|
|
126
|
QUuid varRequestId);
|
|
127
|
|
|
127
|
|
|
128
|
std::shared_ptr<Variable> findVariable(QUuid vIdentifier);
|
|
128
|
std::shared_ptr<Variable> findVariable(QUuid vIdentifier);
|
|
129
|
std::shared_ptr<IDataSeries>
|
|
129
|
std::shared_ptr<IDataSeries>
|
|
130
|
retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector);
|
|
130
|
retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector);
|
|
131
|
|
|
131
|
|
|
132
|
void registerProvider(std::shared_ptr<IDataProvider> provider);
|
|
132
|
void registerProvider(std::shared_ptr<IDataProvider> provider);
|
|
133
|
|
|
133
|
|
|
134
|
void storeVariableRequest(QUuid varId, QUuid varRequestId, const VariableRequest &varRequest);
|
|
134
|
void storeVariableRequest(QUuid varId, QUuid varRequestId, const VariableRequest &varRequest);
|
|
135
|
QUuid acceptVariableRequest(QUuid varId, std::shared_ptr<IDataSeries> dataSeries);
|
|
135
|
QUuid acceptVariableRequest(QUuid varId, std::shared_ptr<IDataSeries> dataSeries);
|
|
136
|
void updateVariables(QUuid varRequestId);
|
|
136
|
void updateVariables(QUuid varRequestId);
|
|
137
|
void updateVariableRequest(QUuid varRequestId);
|
|
137
|
void updateVariableRequest(QUuid varRequestId);
|
|
138
|
void cancelVariableRequest(QUuid varRequestId);
|
|
138
|
void cancelVariableRequest(QUuid varRequestId);
|
|
139
|
void executeVarRequest(std::shared_ptr<Variable> var, VariableRequest &varRequest);
|
|
139
|
void executeVarRequest(std::shared_ptr<Variable> var, VariableRequest &varRequest);
|
|
140
|
bool hasPendingDownloads();
|
|
140
|
bool hasPendingDownloads();
|
|
141
|
template <typename VariableIterator>
|
|
141
|
template <typename VariableIterator>
|
|
142
|
void desynchronize(VariableIterator variableIt, const QUuid &syncGroupId);
|
|
142
|
void desynchronize(VariableIterator variableIt, const QUuid &syncGroupId);
|
|
143
|
|
|
143
|
|
|
144
|
QMutex m_WorkingMutex;
|
|
144
|
QMutex m_WorkingMutex;
|
|
145
|
/// Variable model. The VariableController has the ownership
|
|
145
|
/// Variable model. The VariableController has the ownership
|
|
146
|
VariableModel *m_VariableModel;
|
|
146
|
VariableModel *m_VariableModel;
|
|
147
|
QItemSelectionModel *m_VariableSelectionModel;
|
|
147
|
QItemSelectionModel *m_VariableSelectionModel;
|
|
148
|
|
|
148
|
|
|
149
|
|
|
149
|
|
|
150
|
std::unique_ptr<VariableCacheStrategy> m_VariableCacheStrategy;
|
|
150
|
std::unique_ptr<VariableCacheStrategy> m_VariableCacheStrategy;
|
|
151
|
std::unique_ptr<VariableAcquisitionWorker> m_VariableAcquisitionWorker;
|
|
151
|
std::unique_ptr<VariableAcquisitionWorker> m_VariableAcquisitionWorker;
|
|
152
|
QThread m_VariableAcquisitionWorkerThread;
|
|
152
|
QThread m_VariableAcquisitionWorkerThread;
|
|
153
|
|
|
153
|
|
|
154
|
std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> >
|
|
154
|
std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> >
|
|
155
|
m_VariableToProviderMap;
|
|
155
|
m_VariableToProviderMap;
|
|
156
|
std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap;
|
|
156
|
std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap;
|
|
157
|
std::map<QUuid, std::shared_ptr<VariableSynchronizationGroup> >
|
|
157
|
std::map<QUuid, std::shared_ptr<VariableSynchronizationGroup> >
|
|
158
|
m_GroupIdToVariableSynchronizationGroupMap;
|
|
158
|
m_GroupIdToVariableSynchronizationGroupMap;
|
|
159
|
std::map<QUuid, QUuid> m_VariableIdGroupIdMap;
|
|
159
|
std::map<QUuid, QUuid> m_VariableIdGroupIdMap;
|
|
160
|
std::set<std::shared_ptr<IDataProvider> > m_ProviderSet;
|
|
160
|
std::set<std::shared_ptr<IDataProvider> > m_ProviderSet;
|
|
161
|
|
|
161
|
|
|
162
|
std::map<QUuid, std::list<QUuid> > m_VarGroupIdToVarIds;
|
|
162
|
std::map<QUuid, std::list<QUuid> > m_VarGroupIdToVarIds;
|
|
163
|
std::map<QUuid, std::unique_ptr<VariableRequestHandler> > m_VarIdToVarRequestHandler;
|
|
163
|
std::map<QUuid, std::unique_ptr<VariableRequestHandler> > m_VarIdToVarRequestHandler;
|
|
164
|
|
|
164
|
|
|
165
|
VariableController *q;
|
|
165
|
VariableController *q;
|
|
166
|
};
|
|
166
|
};
|
|
167
|
|
|
167
|
|
|
168
|
|
|
168
|
|
|
169
|
VariableController::VariableController(QObject *parent)
|
|
169
|
VariableController::VariableController(QObject *parent)
|
|
170
|
: QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)}
|
|
170
|
: QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)}
|
|
171
|
{
|
|
171
|
{
|
|
172
|
qCDebug(LOG_VariableController()) << tr("VariableController construction")
|
|
172
|
qCDebug(LOG_VariableController()) << tr("VariableController construction")
|
|
173
|
<< QThread::currentThread();
|
|
173
|
<< QThread::currentThread();
|
|
174
|
|
|
174
|
|
|
175
|
connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this,
|
|
175
|
connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this,
|
|
176
|
&VariableController::onAbortProgressRequested);
|
|
176
|
&VariableController::onAbortProgressRequested);
|
|
177
|
|
|
177
|
|
|
178
|
connect(impl->m_VariableAcquisitionWorker.get(),
|
|
178
|
connect(impl->m_VariableAcquisitionWorker.get(),
|
|
179
|
&VariableAcquisitionWorker::variableCanceledRequested, this,
|
|
179
|
&VariableAcquisitionWorker::variableCanceledRequested, this,
|
|
180
|
&VariableController::onAbortAcquisitionRequested);
|
|
180
|
&VariableController::onAbortAcquisitionRequested);
|
|
181
|
|
|
181
|
|
|
182
|
connect(impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::dataProvided, this,
|
|
182
|
connect(impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::dataProvided, this,
|
|
183
|
&VariableController::onDataProvided);
|
|
183
|
&VariableController::onDataProvided);
|
|
184
|
connect(impl->m_VariableAcquisitionWorker.get(),
|
|
184
|
connect(impl->m_VariableAcquisitionWorker.get(),
|
|
185
|
&VariableAcquisitionWorker::variableRequestInProgress, this,
|
|
185
|
&VariableAcquisitionWorker::variableRequestInProgress, this,
|
|
186
|
&VariableController::onVariableRetrieveDataInProgress);
|
|
186
|
&VariableController::onVariableRetrieveDataInProgress);
|
|
187
|
|
|
187
|
|
|
188
|
|
|
188
|
|
|
189
|
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::started,
|
|
189
|
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::started,
|
|
190
|
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::initialize);
|
|
190
|
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::initialize);
|
|
191
|
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::finished,
|
|
191
|
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::finished,
|
|
192
|
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::finalize);
|
|
192
|
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::finalize);
|
|
193
|
|
|
193
|
|
|
194
|
connect(impl->m_VariableModel, &VariableModel::requestVariableRangeUpdate, this,
|
|
194
|
connect(impl->m_VariableModel, &VariableModel::requestVariableRangeUpdate, this,
|
|
195
|
&VariableController::onUpdateDateTime);
|
|
195
|
&VariableController::onUpdateDateTime);
|
|
196
|
|
|
196
|
|
|
197
|
impl->m_VariableAcquisitionWorkerThread.start();
|
|
197
|
impl->m_VariableAcquisitionWorkerThread.start();
|
|
198
|
}
|
|
198
|
}
|
|
199
|
|
|
199
|
|
|
200
|
VariableController::~VariableController()
|
|
200
|
VariableController::~VariableController()
|
|
201
|
{
|
|
201
|
{
|
|
202
|
qCDebug(LOG_VariableController()) << tr("VariableController destruction")
|
|
202
|
qCDebug(LOG_VariableController()) << tr("VariableController destruction")
|
|
203
|
<< QThread::currentThread();
|
|
203
|
<< QThread::currentThread();
|
|
204
|
this->waitForFinish();
|
|
204
|
this->waitForFinish();
|
|
205
|
}
|
|
205
|
}
|
|
206
|
|
|
206
|
|
|
207
|
VariableModel *VariableController::variableModel() noexcept
|
|
207
|
VariableModel *VariableController::variableModel() noexcept
|
|
208
|
{
|
|
208
|
{
|
|
209
|
return impl->m_VariableModel;
|
|
209
|
return impl->m_VariableModel;
|
|
210
|
}
|
|
210
|
}
|
|
211
|
|
|
211
|
|
|
212
|
QItemSelectionModel *VariableController::variableSelectionModel() noexcept
|
|
212
|
QItemSelectionModel *VariableController::variableSelectionModel() noexcept
|
|
213
|
{
|
|
213
|
{
|
|
214
|
return impl->m_VariableSelectionModel;
|
|
214
|
return impl->m_VariableSelectionModel;
|
|
215
|
}
|
|
215
|
}
|
|
216
|
|
|
216
|
|
|
217
|
std::shared_ptr<Variable>
|
|
217
|
std::shared_ptr<Variable>
|
|
218
|
VariableController::cloneVariable(std::shared_ptr<Variable> variable) noexcept
|
|
218
|
VariableController::cloneVariable(std::shared_ptr<Variable> variable) noexcept
|
|
219
|
{
|
|
219
|
{
|
|
220
|
if (impl->m_VariableModel->containsVariable(variable)) {
|
|
220
|
if (impl->m_VariableModel->containsVariable(variable)) {
|
|
221
|
// Clones variable
|
|
221
|
// Clones variable
|
|
222
|
auto duplicate = variable->clone();
|
|
222
|
auto duplicate = variable->clone();
|
|
223
|
|
|
223
|
|
|
224
|
// Adds clone to model
|
|
224
|
// Adds clone to model
|
|
225
|
impl->m_VariableModel->addVariable(duplicate);
|
|
225
|
impl->m_VariableModel->addVariable(duplicate);
|
|
226
|
|
|
226
|
|
|
227
|
// Generates clone identifier
|
|
227
|
// Generates clone identifier
|
|
228
|
impl->m_VariableToIdentifierMap[duplicate] = QUuid::createUuid();
|
|
228
|
impl->m_VariableToIdentifierMap[duplicate] = QUuid::createUuid();
|
|
229
|
|
|
229
|
|
|
230
|
// Registers provider
|
|
230
|
// Registers provider
|
|
231
|
auto variableProvider = impl->m_VariableToProviderMap.at(variable);
|
|
231
|
auto variableProvider = impl->m_VariableToProviderMap.at(variable);
|
|
232
|
auto duplicateProvider = variableProvider != nullptr ? variableProvider->clone() : nullptr;
|
|
232
|
auto duplicateProvider = variableProvider != nullptr ? variableProvider->clone() : nullptr;
|
|
233
|
|
|
233
|
|
|
234
|
impl->m_VariableToProviderMap[duplicate] = duplicateProvider;
|
|
234
|
impl->m_VariableToProviderMap[duplicate] = duplicateProvider;
|
|
235
|
if (duplicateProvider) {
|
|
235
|
if (duplicateProvider) {
|
|
236
|
impl->registerProvider(duplicateProvider);
|
|
236
|
impl->registerProvider(duplicateProvider);
|
|
237
|
}
|
|
237
|
}
|
|
238
|
|
|
238
|
|
|
239
|
return duplicate;
|
|
239
|
return duplicate;
|
|
240
|
}
|
|
240
|
}
|
|
241
|
else {
|
|
241
|
else {
|
|
242
|
qCCritical(LOG_VariableController())
|
|
242
|
qCCritical(LOG_VariableController())
|
|
243
|
<< tr("Can't create duplicate of variable %1: variable not registered in the model")
|
|
243
|
<< tr("Can't create duplicate of variable %1: variable not registered in the model")
|
|
244
|
.arg(variable->name());
|
|
244
|
.arg(variable->name());
|
|
245
|
return nullptr;
|
|
245
|
return nullptr;
|
|
246
|
}
|
|
246
|
}
|
|
247
|
}
|
|
247
|
}
|
|
248
|
|
|
248
|
|
|
249
|
void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept
|
|
249
|
void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept
|
|
250
|
{
|
|
250
|
{
|
|
251
|
if (!variable) {
|
|
251
|
if (!variable) {
|
|
252
|
qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null";
|
|
252
|
qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null";
|
|
253
|
return;
|
|
253
|
return;
|
|
254
|
}
|
|
254
|
}
|
|
255
|
|
|
255
|
|
|
256
|
// Spreads in SciQlop that the variable will be deleted, so that potential receivers can
|
|
256
|
// Spreads in SciQlop that the variable will be deleted, so that potential receivers can
|
|
257
|
// make some treatments before the deletion
|
|
257
|
// make some treatments before the deletion
|
|
258
|
emit variableAboutToBeDeleted(variable);
|
|
258
|
emit variableAboutToBeDeleted(variable);
|
|
259
|
|
|
259
|
|
|
260
|
auto variableIt = impl->m_VariableToIdentifierMap.find(variable);
|
|
260
|
auto variableIt = impl->m_VariableToIdentifierMap.find(variable);
|
|
261
|
Q_ASSERT(variableIt != impl->m_VariableToIdentifierMap.cend());
|
|
261
|
Q_ASSERT(variableIt != impl->m_VariableToIdentifierMap.cend());
|
|
262
|
|
|
262
|
|
|
263
|
auto variableId = variableIt->second;
|
|
263
|
auto variableId = variableIt->second;
|
|
264
|
|
|
264
|
|
|
265
|
// Removes variable's handler
|
|
265
|
// Removes variable's handler
|
|
266
|
impl->m_VarIdToVarRequestHandler.erase(variableId);
|
|
266
|
impl->m_VarIdToVarRequestHandler.erase(variableId);
|
|
267
|
|
|
267
|
|
|
268
|
// Desynchronizes variable (if the variable is in a sync group)
|
|
268
|
// Desynchronizes variable (if the variable is in a sync group)
|
|
269
|
auto syncGroupIt = impl->m_VariableIdGroupIdMap.find(variableId);
|
|
269
|
auto syncGroupIt = impl->m_VariableIdGroupIdMap.find(variableId);
|
|
270
|
if (syncGroupIt != impl->m_VariableIdGroupIdMap.cend()) {
|
|
270
|
if (syncGroupIt != impl->m_VariableIdGroupIdMap.cend()) {
|
|
271
|
impl->desynchronize(variableIt, syncGroupIt->second);
|
|
271
|
impl->desynchronize(variableIt, syncGroupIt->second);
|
|
272
|
}
|
|
272
|
}
|
|
273
|
|
|
273
|
|
|
274
|
// Deletes identifier
|
|
274
|
// Deletes identifier
|
|
275
|
impl->m_VariableToIdentifierMap.erase(variableIt);
|
|
275
|
impl->m_VariableToIdentifierMap.erase(variableIt);
|
|
276
|
|
|
276
|
|
|
277
|
// Deletes provider
|
|
277
|
// Deletes provider
|
|
278
|
auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable);
|
|
278
|
auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable);
|
|
279
|
qCDebug(LOG_VariableController())
|
|
279
|
qCDebug(LOG_VariableController())
|
|
280
|
<< tr("Number of providers deleted for variable %1: %2")
|
|
280
|
<< tr("Number of providers deleted for variable %1: %2")
|
|
281
|
.arg(variable->name(), QString::number(nbProvidersDeleted));
|
|
281
|
.arg(variable->name(), QString::number(nbProvidersDeleted));
|
|
282
|
|
|
282
|
|
|
283
|
|
|
283
|
|
|
284
|
// Deletes from model
|
|
284
|
// Deletes from model
|
|
285
|
impl->m_VariableModel->deleteVariable(variable);
|
|
285
|
impl->m_VariableModel->deleteVariable(variable);
|
|
286
|
}
|
|
286
|
}
|
|
287
|
|
|
287
|
|
|
288
|
void VariableController::deleteVariables(
|
|
288
|
void VariableController::deleteVariables(
|
|
289
|
const QVector<std::shared_ptr<Variable> > &variables) noexcept
|
|
289
|
const QVector<std::shared_ptr<Variable> > &variables) noexcept
|
|
290
|
{
|
|
290
|
{
|
|
291
|
for (auto variable : qAsConst(variables)) {
|
|
291
|
for (auto variable : qAsConst(variables)) {
|
|
292
|
deleteVariable(variable);
|
|
292
|
deleteVariable(variable);
|
|
293
|
}
|
|
293
|
}
|
|
294
|
}
|
|
294
|
}
|
|
295
|
|
|
295
|
|
|
296
|
QByteArray
|
|
296
|
QByteArray
|
|
297
|
VariableController::mimeDataForVariables(const QList<std::shared_ptr<Variable> > &variables) const
|
|
297
|
VariableController::mimeDataForVariables(const QList<std::shared_ptr<Variable> > &variables) const
|
|
298
|
{
|
|
298
|
{
|
|
299
|
auto encodedData = QByteArray{};
|
|
299
|
auto encodedData = QByteArray{};
|
|
300
|
|
|
300
|
|
|
301
|
QVariantList ids;
|
|
301
|
QVariantList ids;
|
|
302
|
for (auto &var : variables) {
|
|
302
|
for (auto &var : variables) {
|
|
303
|
auto itVar = impl->m_VariableToIdentifierMap.find(var);
|
|
303
|
auto itVar = impl->m_VariableToIdentifierMap.find(var);
|
|
304
|
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
|
|
304
|
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
|
|
305
|
qCCritical(LOG_VariableController())
|
|
305
|
qCCritical(LOG_VariableController())
|
|
306
|
<< tr("Impossible to find the data for an unknown variable.");
|
|
306
|
<< tr("Impossible to find the data for an unknown variable.");
|
|
307
|
}
|
|
307
|
}
|
|
308
|
|
|
308
|
|
|
309
|
ids << itVar->second.toByteArray();
|
|
309
|
ids << itVar->second.toByteArray();
|
|
310
|
}
|
|
310
|
}
|
|
311
|
|
|
311
|
|
|
312
|
QDataStream stream{&encodedData, QIODevice::WriteOnly};
|
|
312
|
QDataStream stream{&encodedData, QIODevice::WriteOnly};
|
|
313
|
stream << ids;
|
|
313
|
stream << ids;
|
|
314
|
|
|
314
|
|
|
315
|
return encodedData;
|
|
315
|
return encodedData;
|
|
316
|
}
|
|
316
|
}
|
|
317
|
|
|
317
|
|
|
318
|
QList<std::shared_ptr<Variable> >
|
|
318
|
QList<std::shared_ptr<Variable> >
|
|
319
|
VariableController::variablesForMimeData(const QByteArray &mimeData) const
|
|
319
|
VariableController::variablesForMimeData(const QByteArray &mimeData) const
|
|
320
|
{
|
|
320
|
{
|
|
321
|
auto variables = QList<std::shared_ptr<Variable> >{};
|
|
321
|
auto variables = QList<std::shared_ptr<Variable> >{};
|
|
322
|
QDataStream stream{mimeData};
|
|
322
|
QDataStream stream{mimeData};
|
|
323
|
|
|
323
|
|
|
324
|
QVariantList ids;
|
|
324
|
QVariantList ids;
|
|
325
|
stream >> ids;
|
|
325
|
stream >> ids;
|
|
326
|
|
|
326
|
|
|
327
|
for (auto id : ids) {
|
|
327
|
for (auto id : ids) {
|
|
328
|
auto uuid = QUuid{id.toByteArray()};
|
|
328
|
auto uuid = QUuid{id.toByteArray()};
|
|
329
|
auto var = impl->findVariable(uuid);
|
|
329
|
auto var = impl->findVariable(uuid);
|
|
330
|
variables << var;
|
|
330
|
variables << var;
|
|
331
|
}
|
|
331
|
}
|
|
332
|
|
|
332
|
|
|
333
|
return variables;
|
|
333
|
return variables;
|
|
334
|
}
|
|
334
|
}
|
|
335
|
|
|
335
|
|
|
336
|
std::shared_ptr<Variable>
|
|
336
|
std::shared_ptr<Variable>
|
|
337
|
VariableController::createVariable(const QString &name, const QVariantHash &metadata,
|
|
337
|
VariableController::createVariable(const QString &name, const QVariantHash &metadata,
|
|
338
|
std::shared_ptr<IDataProvider> provider, const DateTimeRange& range) noexcept
|
|
338
|
std::shared_ptr<IDataProvider> provider, const DateTimeRange& range) noexcept
|
|
339
|
{
|
|
339
|
{
|
|
340
|
// if (!impl->m_TimeController) {
|
|
340
|
// if (!impl->m_TimeController) {
|
|
341
|
// qCCritical(LOG_VariableController())
|
|
341
|
// qCCritical(LOG_VariableController())
|
|
342
|
// << tr("Impossible to create variable: The time controller is null");
|
|
342
|
// << tr("Impossible to create variable: The time controller is null");
|
|
343
|
// return nullptr;
|
|
343
|
// return nullptr;
|
|
344
|
// }
|
|
344
|
// }
|
|
345
|
|
|
345
|
|
|
346
|
// auto range = impl->m_TimeController->dateTime();
|
|
346
|
// auto range = impl->m_TimeController->dateTime();
|
|
347
|
|
|
347
|
|
|
348
|
if (auto newVariable = impl->m_VariableModel->createVariable(name, metadata)) {
|
|
348
|
if (auto newVariable = impl->m_VariableModel->createVariable(name, metadata)) {
|
|
349
|
auto varId = QUuid::createUuid();
|
|
349
|
auto varId = QUuid::createUuid();
|
|
350
|
|
|
350
|
|
|
351
|
// Create the handler
|
|
351
|
// Create the handler
|
|
352
|
auto varRequestHandler = std::make_unique<VariableRequestHandler>();
|
|
352
|
auto varRequestHandler = std::make_unique<VariableRequestHandler>();
|
|
353
|
varRequestHandler->m_VarId = varId;
|
|
353
|
varRequestHandler->m_VarId = varId;
|
|
354
|
|
|
354
|
|
|
355
|
impl->m_VarIdToVarRequestHandler.insert(
|
|
355
|
impl->m_VarIdToVarRequestHandler.insert(
|
|
356
|
std::make_pair(varId, std::move(varRequestHandler)));
|
|
356
|
std::make_pair(varId, std::move(varRequestHandler)));
|
|
357
|
|
|
357
|
|
|
358
|
// store the provider
|
|
358
|
// store the provider
|
|
359
|
impl->registerProvider(provider);
|
|
359
|
impl->registerProvider(provider);
|
|
360
|
|
|
360
|
|
|
361
|
// Associate the provider
|
|
361
|
// Associate the provider
|
|
362
|
impl->m_VariableToProviderMap[newVariable] = provider;
|
|
362
|
impl->m_VariableToProviderMap[newVariable] = provider;
|
|
363
|
impl->m_VariableToIdentifierMap[newVariable] = varId;
|
|
363
|
impl->m_VariableToIdentifierMap[newVariable] = varId;
|
|
364
|
|
|
364
|
|
|
365
|
this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{newVariable}, range, false);
|
|
365
|
this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{newVariable}, range, false);
|
|
366
|
|
|
366
|
|
|
367
|
// auto varRequestId = QUuid::createUuid();
|
|
367
|
// auto varRequestId = QUuid::createUuid();
|
|
368
|
// qCInfo(LOG_VariableController()) << "createVariable: " << varId << varRequestId;
|
|
368
|
// qCInfo(LOG_VariableController()) << "createVariable: " << varId << varRequestId;
|
|
369
|
// impl->processRequest(newVariable, range, varRequestId);
|
|
369
|
// impl->processRequest(newVariable, range, varRequestId);
|
|
370
|
// impl->updateVariableRequest(varRequestId);
|
|
370
|
// impl->updateVariableRequest(varRequestId);
|
|
371
|
|
|
371
|
|
|
372
|
emit variableAdded(newVariable);
|
|
372
|
emit variableAdded(newVariable);
|
|
373
|
|
|
373
|
|
|
374
|
return newVariable;
|
|
374
|
return newVariable;
|
|
375
|
}
|
|
375
|
}
|
|
376
|
|
|
376
|
|
|
377
|
qCCritical(LOG_VariableController()) << tr("Impossible to create variable");
|
|
377
|
qCCritical(LOG_VariableController()) << tr("Impossible to create variable");
|
|
378
|
return nullptr;
|
|
378
|
return nullptr;
|
|
379
|
}
|
|
379
|
}
|
|
380
|
|
|
380
|
|
|
381
|
void VariableController::onDateTimeOnSelection(const DateTimeRange &dateTime)
|
|
381
|
void VariableController::onDateTimeOnSelection(const DateTimeRange &dateTime)
|
|
382
|
{
|
|
382
|
{
|
|
383
|
// NOTE: Even if acquisition request is aborting, the graphe range will be changed
|
|
383
|
// NOTE: Even if acquisition request is aborting, the graphe range will be changed
|
|
384
|
qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
|
|
384
|
qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
|
|
385
|
<< QThread::currentThread()->objectName();
|
|
385
|
<< QThread::currentThread()->objectName();
|
|
386
|
auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
|
|
386
|
auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
|
|
387
|
|
|
387
|
|
|
388
|
// NOTE we only permit the time modification for one variable
|
|
388
|
// NOTE we only permit the time modification for one variable
|
|
389
|
// DEPRECATED
|
|
389
|
// DEPRECATED
|
|
390
|
// auto variables = QVector<std::shared_ptr<Variable> >{};
|
|
390
|
// auto variables = QVector<std::shared_ptr<Variable> >{};
|
|
391
|
// for (const auto &selectedRow : qAsConst(selectedRows)) {
|
|
391
|
// for (const auto &selectedRow : qAsConst(selectedRows)) {
|
|
392
|
// if (auto selectedVariable =
|
|
392
|
// if (auto selectedVariable =
|
|
393
|
// impl->m_VariableModel->variable(selectedRow.row())) {
|
|
393
|
// impl->m_VariableModel->variable(selectedRow.row())) {
|
|
394
|
// variables << selectedVariable;
|
|
394
|
// variables << selectedVariable;
|
|
395
|
|
|
395
|
|
|
396
|
// // notify that rescale operation has to be done
|
|
396
|
// // notify that rescale operation has to be done
|
|
397
|
// emit rangeChanged(selectedVariable, dateTime);
|
|
397
|
// emit rangeChanged(selectedVariable, dateTime);
|
|
398
|
// }
|
|
398
|
// }
|
|
399
|
// }
|
|
399
|
// }
|
|
400
|
// if (!variables.isEmpty()) {
|
|
400
|
// if (!variables.isEmpty()) {
|
|
401
|
// this->onRequestDataLoading(variables, dateTime, synchro);
|
|
401
|
// this->onRequestDataLoading(variables, dateTime, synchro);
|
|
402
|
// }
|
|
402
|
// }
|
|
403
|
if (selectedRows.size() == 1) {
|
|
403
|
if (selectedRows.size() == 1) {
|
|
404
|
|
|
404
|
|
|
405
|
if (auto selectedVariable
|
|
405
|
if (auto selectedVariable
|
|
406
|
= impl->m_VariableModel->variable(qAsConst(selectedRows).first().row())) {
|
|
406
|
= impl->m_VariableModel->variable(qAsConst(selectedRows).first().row())) {
|
|
407
|
|
|
407
|
|
|
408
|
onUpdateDateTime(selectedVariable, dateTime);
|
|
408
|
onUpdateDateTime(selectedVariable, dateTime);
|
|
409
|
}
|
|
409
|
}
|
|
410
|
}
|
|
410
|
}
|
|
411
|
else if (selectedRows.size() > 1) {
|
|
411
|
else if (selectedRows.size() > 1) {
|
|
412
|
qCCritical(LOG_VariableController())
|
|
412
|
qCCritical(LOG_VariableController())
|
|
413
|
<< tr("Impossible to set time for more than 1 variable in the same time");
|
|
413
|
<< tr("Impossible to set time for more than 1 variable in the same time");
|
|
414
|
}
|
|
414
|
}
|
|
415
|
else {
|
|
415
|
else {
|
|
416
|
qCWarning(LOG_VariableController())
|
|
416
|
qCWarning(LOG_VariableController())
|
|
417
|
<< tr("There is no variable selected to set the time one");
|
|
417
|
<< tr("There is no variable selected to set the time one");
|
|
418
|
}
|
|
418
|
}
|
|
419
|
}
|
|
419
|
}
|
|
420
|
|
|
420
|
|
|
421
|
void VariableController::onUpdateDateTime(std::shared_ptr<Variable> variable,
|
|
421
|
void VariableController::onUpdateDateTime(std::shared_ptr<Variable> variable,
|
|
422
|
const DateTimeRange &dateTime)
|
|
422
|
const DateTimeRange &dateTime)
|
|
423
|
{
|
|
423
|
{
|
|
424
|
auto itVar = impl->m_VariableToIdentifierMap.find(variable);
|
|
424
|
auto itVar = impl->m_VariableToIdentifierMap.find(variable);
|
|
425
|
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
|
|
425
|
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
|
|
426
|
qCCritical(LOG_VariableController())
|
|
426
|
qCCritical(LOG_VariableController())
|
|
427
|
<< tr("Impossible to onDateTimeOnSelection request for unknown variable");
|
|
427
|
<< tr("Impossible to onDateTimeOnSelection request for unknown variable");
|
|
428
|
return;
|
|
428
|
return;
|
|
429
|
}
|
|
429
|
}
|
|
430
|
|
|
430
|
|
|
431
|
// notify that rescale operation has to be done
|
|
431
|
// notify that rescale operation has to be done
|
|
432
|
emit rangeChanged(variable, dateTime);
|
|
432
|
emit rangeChanged(variable, dateTime);
|
|
433
|
|
|
433
|
|
|
434
|
auto synchro
|
|
434
|
auto synchro
|
|
435
|
= impl->m_VariableIdGroupIdMap.find(itVar->second) != impl->m_VariableIdGroupIdMap.cend();
|
|
435
|
= impl->m_VariableIdGroupIdMap.find(itVar->second) != impl->m_VariableIdGroupIdMap.cend();
|
|
436
|
|
|
436
|
|
|
437
|
this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{variable}, dateTime, synchro);
|
|
437
|
this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{variable}, dateTime, synchro);
|
|
438
|
}
|
|
438
|
}
|
|
439
|
|
|
439
|
|
|
440
|
void VariableController::onDataProvided(QUuid vIdentifier, const DateTimeRange &rangeRequested,
|
|
440
|
void VariableController::onDataProvided(QUuid vIdentifier, const DateTimeRange &rangeRequested,
|
|
441
|
const DateTimeRange &cacheRangeRequested,
|
|
441
|
const DateTimeRange &cacheRangeRequested,
|
|
442
|
QVector<AcquisitionDataPacket> dataAcquired)
|
|
442
|
QVector<AcquisitionDataPacket> dataAcquired)
|
|
443
|
{
|
|
443
|
{
|
|
444
|
qCDebug(LOG_VariableController()) << tr("onDataProvided") << QThread::currentThread();
|
|
444
|
qCDebug(LOG_VariableController()) << tr("onDataProvided") << QThread::currentThread();
|
|
445
|
auto retrievedDataSeries = impl->retrieveDataSeries(dataAcquired);
|
|
445
|
auto retrievedDataSeries = impl->retrieveDataSeries(dataAcquired);
|
|
446
|
auto varRequestId = impl->acceptVariableRequest(vIdentifier, retrievedDataSeries);
|
|
446
|
auto varRequestId = impl->acceptVariableRequest(vIdentifier, retrievedDataSeries);
|
|
447
|
if (!varRequestId.isNull()) {
|
|
447
|
if (!varRequestId.isNull()) {
|
|
448
|
impl->updateVariables(varRequestId);
|
|
448
|
impl->updateVariables(varRequestId);
|
|
449
|
}
|
|
449
|
}
|
|
450
|
}
|
|
450
|
}
|
|
451
|
|
|
451
|
|
|
452
|
void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
|
|
452
|
void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
|
|
453
|
{
|
|
453
|
{
|
|
454
|
qCDebug(LOG_VariableController())
|
|
454
|
qCDebug(LOG_VariableController())
|
|
455
|
<< "TORM: variableController::onVariableRetrieveDataInProgress"
|
|
455
|
<< "TORM: variableController::onVariableRetrieveDataInProgress"
|
|
456
|
<< QThread::currentThread()->objectName() << progress;
|
|
456
|
<< QThread::currentThread()->objectName() << progress;
|
|
457
|
if (auto var = impl->findVariable(identifier)) {
|
|
457
|
if (auto var = impl->findVariable(identifier)) {
|
|
458
|
impl->m_VariableModel->setDataProgress(var, progress);
|
|
458
|
impl->m_VariableModel->setDataProgress(var, progress);
|
|
459
|
}
|
|
459
|
}
|
|
460
|
else {
|
|
460
|
else {
|
|
461
|
qCCritical(LOG_VariableController())
|
|
461
|
qCCritical(LOG_VariableController())
|
|
462
|
<< tr("Impossible to notify progression of a null variable");
|
|
462
|
<< tr("Impossible to notify progression of a null variable");
|
|
463
|
}
|
|
463
|
}
|
|
464
|
}
|
|
464
|
}
|
|
465
|
|
|
465
|
|
|
466
|
void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable)
|
|
466
|
void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable)
|
|
467
|
{
|
|
467
|
{
|
|
468
|
qCDebug(LOG_VariableController()) << "TORM: variableController::onAbortProgressRequested"
|
|
468
|
qCDebug(LOG_VariableController()) << "TORM: variableController::onAbortProgressRequested"
|
|
469
|
<< QThread::currentThread()->objectName() << variable->name();
|
|
469
|
<< QThread::currentThread()->objectName() << variable->name();
|
|
470
|
|
|
470
|
|
|
471
|
auto itVar = impl->m_VariableToIdentifierMap.find(variable);
|
|
471
|
auto itVar = impl->m_VariableToIdentifierMap.find(variable);
|
|
472
|
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
|
|
472
|
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
|
|
473
|
qCCritical(LOG_VariableController())
|
|
473
|
qCCritical(LOG_VariableController())
|
|
474
|
<< tr("Impossible to onAbortProgressRequested request for unknown variable");
|
|
474
|
<< tr("Impossible to onAbortProgressRequested request for unknown variable");
|
|
475
|
return;
|
|
475
|
return;
|
|
476
|
}
|
|
476
|
}
|
|
477
|
|
|
477
|
|
|
478
|
auto varId = itVar->second;
|
|
478
|
auto varId = itVar->second;
|
|
479
|
|
|
479
|
|
|
480
|
auto itVarHandler = impl->m_VarIdToVarRequestHandler.find(varId);
|
|
480
|
auto itVarHandler = impl->m_VarIdToVarRequestHandler.find(varId);
|
|
481
|
if (itVarHandler == impl->m_VarIdToVarRequestHandler.cend()) {
|
|
481
|
if (itVarHandler == impl->m_VarIdToVarRequestHandler.cend()) {
|
|
482
|
qCCritical(LOG_VariableController())
|
|
482
|
qCCritical(LOG_VariableController())
|
|
483
|
<< tr("Impossible to onAbortProgressRequested for variable with unknown handler");
|
|
483
|
<< tr("Impossible to onAbortProgressRequested for variable with unknown handler");
|
|
484
|
return;
|
|
484
|
return;
|
|
485
|
}
|
|
485
|
}
|
|
486
|
|
|
486
|
|
|
487
|
auto varHandler = itVarHandler->second.get();
|
|
487
|
auto varHandler = itVarHandler->second.get();
|
|
488
|
|
|
488
|
|
|
489
|
// case where a variable has a running request
|
|
489
|
// case where a variable has a running request
|
|
490
|
if (varHandler->m_State != VariableRequestHandlerState::OFF) {
|
|
490
|
if (varHandler->m_State != VariableRequestHandlerState::OFF) {
|
|
491
|
impl->cancelVariableRequest(varHandler->m_RunningVarRequest.m_VariableGroupId);
|
|
491
|
impl->cancelVariableRequest(varHandler->m_RunningVarRequest.m_VariableGroupId);
|
|
492
|
}
|
|
492
|
}
|
|
493
|
}
|
|
493
|
}
|
|
494
|
|
|
494
|
|
|
495
|
void VariableController::onAbortAcquisitionRequested(QUuid vIdentifier)
|
|
495
|
void VariableController::onAbortAcquisitionRequested(QUuid vIdentifier)
|
|
496
|
{
|
|
496
|
{
|
|
497
|
qCDebug(LOG_VariableController()) << "TORM: variableController::onAbortAcquisitionRequested"
|
|
497
|
qCDebug(LOG_VariableController()) << "TORM: variableController::onAbortAcquisitionRequested"
|
|
498
|
<< QThread::currentThread()->objectName() << vIdentifier;
|
|
498
|
<< QThread::currentThread()->objectName() << vIdentifier;
|
|
499
|
|
|
499
|
|
|
500
|
if (auto var = impl->findVariable(vIdentifier)) {
|
|
500
|
if (auto var = impl->findVariable(vIdentifier)) {
|
|
501
|
this->onAbortProgressRequested(var);
|
|
501
|
this->onAbortProgressRequested(var);
|
|
502
|
}
|
|
502
|
}
|
|
503
|
else {
|
|
503
|
else {
|
|
504
|
qCCritical(LOG_VariableController())
|
|
504
|
qCCritical(LOG_VariableController())
|
|
505
|
<< tr("Impossible to abort Acquisition Requestof a null variable");
|
|
505
|
<< tr("Impossible to abort Acquisition Requestof a null variable");
|
|
506
|
}
|
|
506
|
}
|
|
507
|
}
|
|
507
|
}
|
|
508
|
|
|
508
|
|
|
509
|
void VariableController::onAddSynchronizationGroupId(QUuid synchronizationGroupId)
|
|
509
|
void VariableController::onAddSynchronizationGroupId(QUuid synchronizationGroupId)
|
|
510
|
{
|
|
510
|
{
|
|
511
|
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronizationGroupId"
|
|
511
|
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronizationGroupId"
|
|
512
|
<< QThread::currentThread()->objectName()
|
|
512
|
<< QThread::currentThread()->objectName()
|
|
513
|
<< synchronizationGroupId;
|
|
513
|
<< synchronizationGroupId;
|
|
514
|
auto vSynchroGroup = std::make_shared<VariableSynchronizationGroup>();
|
|
514
|
auto vSynchroGroup = std::make_shared<VariableSynchronizationGroup>();
|
|
515
|
impl->m_GroupIdToVariableSynchronizationGroupMap.insert(
|
|
515
|
impl->m_GroupIdToVariableSynchronizationGroupMap.insert(
|
|
516
|
std::make_pair(synchronizationGroupId, vSynchroGroup));
|
|
516
|
std::make_pair(synchronizationGroupId, vSynchroGroup));
|
|
517
|
}
|
|
517
|
}
|
|
518
|
|
|
518
|
|
|
519
|
void VariableController::onRemoveSynchronizationGroupId(QUuid synchronizationGroupId)
|
|
519
|
void VariableController::onRemoveSynchronizationGroupId(QUuid synchronizationGroupId)
|
|
520
|
{
|
|
520
|
{
|
|
521
|
impl->m_GroupIdToVariableSynchronizationGroupMap.erase(synchronizationGroupId);
|
|
521
|
impl->m_GroupIdToVariableSynchronizationGroupMap.erase(synchronizationGroupId);
|
|
522
|
}
|
|
522
|
}
|
|
523
|
|
|
523
|
|
|
524
|
void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable,
|
|
524
|
void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable,
|
|
525
|
QUuid synchronizationGroupId)
|
|
525
|
QUuid synchronizationGroupId)
|
|
526
|
|
|
526
|
|
|
527
|
{
|
|
527
|
{
|
|
528
|
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
|
|
528
|
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
|
|
529
|
<< synchronizationGroupId;
|
|
529
|
<< synchronizationGroupId;
|
|
530
|
auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable);
|
|
530
|
auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable);
|
|
531
|
if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
|
|
531
|
if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
|
|
532
|
auto groupIdToVSGIt
|
|
532
|
auto groupIdToVSGIt
|
|
533
|
= impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
|
|
533
|
= impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
|
|
534
|
if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
|
|
534
|
if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
|
|
535
|
impl->m_VariableIdGroupIdMap.insert(
|
|
535
|
impl->m_VariableIdGroupIdMap.insert(
|
|
536
|
std::make_pair(varToVarIdIt->second, synchronizationGroupId));
|
|
536
|
std::make_pair(varToVarIdIt->second, synchronizationGroupId));
|
|
537
|
groupIdToVSGIt->second->addVariable(varToVarIdIt->second);
|
|
537
|
groupIdToVSGIt->second->addVariable(varToVarIdIt->second);
|
|
538
|
}
|
|
538
|
}
|
|
539
|
else {
|
|
539
|
else {
|
|
540
|
qCCritical(LOG_VariableController())
|
|
540
|
qCCritical(LOG_VariableController())
|
|
541
|
<< tr("Impossible to synchronize a variable with an unknown sycnhronization group")
|
|
541
|
<< tr("Impossible to synchronize a variable with an unknown sycnhronization group")
|
|
542
|
<< variable->name();
|
|
542
|
<< variable->name();
|
|
543
|
}
|
|
543
|
}
|
|
544
|
}
|
|
544
|
}
|
|
545
|
else {
|
|
545
|
else {
|
|
546
|
qCCritical(LOG_VariableController())
|
|
546
|
qCCritical(LOG_VariableController())
|
|
547
|
<< tr("Impossible to synchronize a variable with no identifier") << variable->name();
|
|
547
|
<< tr("Impossible to synchronize a variable with no identifier") << variable->name();
|
|
548
|
}
|
|
548
|
}
|
|
549
|
}
|
|
549
|
}
|
|
550
|
|
|
550
|
|
|
551
|
void VariableController::desynchronize(std::shared_ptr<Variable> variable,
|
|
551
|
void VariableController::desynchronize(std::shared_ptr<Variable> variable,
|
|
552
|
QUuid synchronizationGroupId)
|
|
552
|
QUuid synchronizationGroupId)
|
|
553
|
{
|
|
553
|
{
|
|
554
|
// Gets variable id
|
|
554
|
// Gets variable id
|
|
555
|
auto variableIt = impl->m_VariableToIdentifierMap.find(variable);
|
|
555
|
auto variableIt = impl->m_VariableToIdentifierMap.find(variable);
|
|
556
|
if (variableIt == impl->m_VariableToIdentifierMap.cend()) {
|
|
556
|
if (variableIt == impl->m_VariableToIdentifierMap.cend()) {
|
|
557
|
qCCritical(LOG_VariableController())
|
|
557
|
qCCritical(LOG_VariableController())
|
|
558
|
<< tr("Can't desynchronize variable %1: variable identifier not found")
|
|
558
|
<< tr("Can't desynchronize variable %1: variable identifier not found")
|
|
559
|
.arg(variable->name());
|
|
559
|
.arg(variable->name());
|
|
560
|
return;
|
|
560
|
return;
|
|
561
|
}
|
|
561
|
}
|
|
562
|
|
|
562
|
|
|
563
|
impl->desynchronize(variableIt, synchronizationGroupId);
|
|
563
|
impl->desynchronize(variableIt, synchronizationGroupId);
|
|
564
|
}
|
|
564
|
}
|
|
565
|
|
|
565
|
|
|
566
|
void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables,
|
|
566
|
void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables,
|
|
567
|
const DateTimeRange &range, bool synchronise)
|
|
567
|
const DateTimeRange &range, bool synchronise)
|
|
568
|
{
|
|
568
|
{
|
|
569
|
// variables is assumed synchronized
|
|
569
|
// variables is assumed synchronized
|
|
570
|
// TODO: Asser variables synchronization
|
|
570
|
// TODO: Asser variables synchronization
|
|
571
|
// we want to load data of the variable for the dateTime.
|
|
571
|
// we want to load data of the variable for the dateTime.
|
|
572
|
if (variables.isEmpty()) {
|
|
572
|
if (variables.isEmpty()) {
|
|
573
|
return;
|
|
573
|
return;
|
|
574
|
}
|
|
574
|
}
|
|
575
|
|
|
575
|
|
|
576
|
auto varRequestId = QUuid::createUuid();
|
|
576
|
auto varRequestId = QUuid::createUuid();
|
|
577
|
qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
|
|
577
|
qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
|
|
578
|
<< QThread::currentThread()->objectName() << varRequestId
|
|
578
|
<< QThread::currentThread()->objectName() << varRequestId
|
|
579
|
<< range << synchronise;
|
|
579
|
<< range << synchronise;
|
|
580
|
|
|
580
|
|
|
581
|
if (!synchronise) {
|
|
581
|
if (!synchronise) {
|
|
582
|
auto varIds = std::list<QUuid>{};
|
|
582
|
auto varIds = std::list<QUuid>{};
|
|
583
|
for (const auto &var : variables) {
|
|
583
|
for (const auto &var : variables) {
|
|
584
|
auto vId = impl->m_VariableToIdentifierMap.at(var);
|
|
584
|
auto vId = impl->m_VariableToIdentifierMap.at(var);
|
|
585
|
varIds.push_back(vId);
|
|
585
|
varIds.push_back(vId);
|
|
586
|
}
|
|
586
|
}
|
|
587
|
impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds));
|
|
587
|
impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds));
|
|
588
|
for (const auto &var : variables) {
|
|
588
|
for (const auto &var : variables) {
|
|
589
|
qCDebug(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId
|
|
589
|
qCDebug(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId
|
|
590
|
<< varIds.size();
|
|
590
|
<< varIds.size();
|
|
591
|
impl->processRequest(var, range, varRequestId);
|
|
591
|
impl->processRequest(var, range, varRequestId);
|
|
592
|
}
|
|
592
|
}
|
|
593
|
}
|
|
593
|
}
|
|
594
|
else {
|
|
594
|
else {
|
|
595
|
auto vId = impl->m_VariableToIdentifierMap.at(variables.first());
|
|
595
|
auto vId = impl->m_VariableToIdentifierMap.at(variables.first());
|
|
596
|
auto varIdToGroupIdIt = impl->m_VariableIdGroupIdMap.find(vId);
|
|
596
|
auto varIdToGroupIdIt = impl->m_VariableIdGroupIdMap.find(vId);
|
|
597
|
if (varIdToGroupIdIt != impl->m_VariableIdGroupIdMap.cend()) {
|
|
597
|
if (varIdToGroupIdIt != impl->m_VariableIdGroupIdMap.cend()) {
|
|
598
|
auto groupId = varIdToGroupIdIt->second;
|
|
598
|
auto groupId = varIdToGroupIdIt->second;
|
|
599
|
|
|
599
|
|
|
600
|
auto vSynchronizationGroup
|
|
600
|
auto vSynchronizationGroup
|
|
601
|
= impl->m_GroupIdToVariableSynchronizationGroupMap.at(groupId);
|
|
601
|
= impl->m_GroupIdToVariableSynchronizationGroupMap.at(groupId);
|
|
602
|
auto vSyncIds = vSynchronizationGroup->getIds();
|
|
602
|
auto vSyncIds = vSynchronizationGroup->getIds();
|
|
603
|
|
|
603
|
|
|
604
|
auto varIds = std::list<QUuid>{};
|
|
604
|
auto varIds = std::list<QUuid>{};
|
|
605
|
for (auto vId : vSyncIds) {
|
|
605
|
for (auto vId : vSyncIds) {
|
|
606
|
varIds.push_back(vId);
|
|
606
|
varIds.push_back(vId);
|
|
607
|
}
|
|
607
|
}
|
|
608
|
impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds));
|
|
608
|
impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds));
|
|
609
|
|
|
609
|
|
|
610
|
for (auto vId : vSyncIds) {
|
|
610
|
for (auto vId : vSyncIds) {
|
|
611
|
auto var = impl->findVariable(vId);
|
|
611
|
auto var = impl->findVariable(vId);
|
|
612
|
|
|
612
|
|
|
613
|
// Don't process already processed var
|
|
613
|
// Don't process already processed var
|
|
614
|
if (var != nullptr) {
|
|
614
|
if (var != nullptr) {
|
|
615
|
qCDebug(LOG_VariableController()) << "processRequest synchro for" << var->name()
|
|
615
|
qCDebug(LOG_VariableController()) << "processRequest synchro for" << var->name()
|
|
616
|
<< varRequestId;
|
|
616
|
<< varRequestId;
|
|
617
|
auto vSyncRangeRequested
|
|
617
|
auto vSyncRangeRequested
|
|
618
|
= variables.contains(var)
|
|
618
|
= variables.contains(var)
|
|
619
|
? range
|
|
619
|
? range
|
|
620
|
: computeSynchroRangeRequested(var->range(), range,
|
|
620
|
: computeSynchroRangeRequested(var->range(), range,
|
|
621
|
variables.first()->range());
|
|
621
|
variables.first()->range());
|
|
622
|
qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested;
|
|
622
|
qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested;
|
|
623
|
impl->processRequest(var, vSyncRangeRequested, varRequestId);
|
|
623
|
impl->processRequest(var, vSyncRangeRequested, varRequestId);
|
|
624
|
}
|
|
624
|
}
|
|
625
|
else {
|
|
625
|
else {
|
|
626
|
qCCritical(LOG_VariableController())
|
|
626
|
qCCritical(LOG_VariableController())
|
|
627
|
|
|
627
|
|
|
628
|
<< tr("Impossible to synchronize a null variable");
|
|
628
|
<< tr("Impossible to synchronize a null variable");
|
|
629
|
}
|
|
629
|
}
|
|
630
|
}
|
|
630
|
}
|
|
631
|
}
|
|
631
|
}
|
|
632
|
}
|
|
632
|
}
|
|
633
|
|
|
633
|
|
|
634
|
impl->updateVariables(varRequestId);
|
|
634
|
impl->updateVariables(varRequestId);
|
|
635
|
}
|
|
635
|
}
|
|
636
|
|
|
636
|
|
|
637
|
|
|
637
|
|
|
638
|
void VariableController::initialize()
|
|
638
|
void VariableController::initialize()
|
|
639
|
{
|
|
639
|
{
|
|
640
|
qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();
|
|
640
|
qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();
|
|
641
|
impl->m_WorkingMutex.lock();
|
|
641
|
impl->m_WorkingMutex.lock();
|
|
642
|
qCDebug(LOG_VariableController()) << tr("VariableController init END");
|
|
642
|
qCDebug(LOG_VariableController()) << tr("VariableController init END");
|
|
643
|
}
|
|
643
|
}
|
|
644
|
|
|
644
|
|
|
645
|
void VariableController::finalize()
|
|
645
|
void VariableController::finalize()
|
|
646
|
{
|
|
646
|
{
|
|
647
|
impl->m_WorkingMutex.unlock();
|
|
647
|
impl->m_WorkingMutex.unlock();
|
|
648
|
}
|
|
648
|
}
|
|
649
|
|
|
649
|
|
|
650
|
void VariableController::waitForFinish()
|
|
650
|
void VariableController::waitForFinish()
|
|
651
|
{
|
|
651
|
{
|
|
652
|
QMutexLocker locker{&impl->m_WorkingMutex};
|
|
652
|
QMutexLocker locker{&impl->m_WorkingMutex};
|
|
653
|
}
|
|
653
|
}
|
|
654
|
|
|
654
|
|
|
655
|
bool VariableController::hasPendingDownloads()
|
|
655
|
bool VariableController::hasPendingDownloads()
|
|
656
|
{
|
|
656
|
{
|
|
657
|
return impl->hasPendingDownloads();
|
|
657
|
return impl->hasPendingDownloads();
|
|
658
|
}
|
|
658
|
}
|
|
659
|
|
|
659
|
|
|
660
|
AcquisitionZoomType VariableController::getZoomType(const DateTimeRange &range, const DateTimeRange &oldRange)
|
|
660
|
AcquisitionZoomType VariableController::getZoomType(const DateTimeRange &range, const DateTimeRange &oldRange)
|
|
661
|
{
|
|
661
|
{
|
|
662
|
if (almost_equal(static_cast<double>(range.delta()), static_cast<double>(oldRange.delta()), 1)) // same delta -> must be a pan or nothing
|
|
662
|
if (SciQLop::numeric::almost_equal<double>(range.delta(), oldRange.delta(), 1)) // same delta -> must be a pan or nothing
|
|
663
|
{
|
|
663
|
{
|
|
664
|
if(range.m_TStart > oldRange.m_TStart)
|
|
664
|
if(range.m_TStart > oldRange.m_TStart)
|
|
665
|
return AcquisitionZoomType::PanRight;
|
|
665
|
return AcquisitionZoomType::PanRight;
|
|
666
|
if(range.m_TStart < oldRange.m_TStart)
|
|
666
|
if(range.m_TStart < oldRange.m_TStart)
|
|
667
|
return AcquisitionZoomType::PanLeft;
|
|
667
|
return AcquisitionZoomType::PanLeft;
|
|
668
|
}
|
|
668
|
}
|
|
669
|
else // different delta -> must be a zoom
|
|
669
|
else // different delta -> must be a zoom
|
|
670
|
{
|
|
670
|
{
|
|
671
|
if(range.m_TStart > oldRange.m_TStart)
|
|
671
|
if(range.m_TStart > oldRange.m_TStart)
|
|
672
|
return AcquisitionZoomType::ZoomIn;
|
|
672
|
return AcquisitionZoomType::ZoomIn;
|
|
673
|
if(range.m_TStart < oldRange.m_TStart)
|
|
673
|
if(range.m_TStart < oldRange.m_TStart)
|
|
674
|
return AcquisitionZoomType::ZoomOut;
|
|
674
|
return AcquisitionZoomType::ZoomOut;
|
|
675
|
}
|
|
675
|
}
|
|
676
|
return AcquisitionZoomType::Unknown;
|
|
676
|
return AcquisitionZoomType::Unknown;
|
|
677
|
}
|
|
677
|
}
|
|
678
|
|
|
678
|
|
|
679
|
void VariableController::VariableControllerPrivate::processRequest(std::shared_ptr<Variable> var,
|
|
679
|
void VariableController::VariableControllerPrivate::processRequest(std::shared_ptr<Variable> var,
|
|
680
|
const DateTimeRange &rangeRequested,
|
|
680
|
const DateTimeRange &rangeRequested,
|
|
681
|
QUuid varRequestId)
|
|
681
|
QUuid varRequestId)
|
|
682
|
{
|
|
682
|
{
|
|
683
|
auto itVar = m_VariableToIdentifierMap.find(var);
|
|
683
|
auto itVar = m_VariableToIdentifierMap.find(var);
|
|
684
|
if (itVar == m_VariableToIdentifierMap.cend()) {
|
|
684
|
if (itVar == m_VariableToIdentifierMap.cend()) {
|
|
685
|
qCCritical(LOG_VariableController())
|
|
685
|
qCCritical(LOG_VariableController())
|
|
686
|
<< tr("Impossible to process request for unknown variable");
|
|
686
|
<< tr("Impossible to process request for unknown variable");
|
|
687
|
return;
|
|
687
|
return;
|
|
688
|
}
|
|
688
|
}
|
|
689
|
|
|
689
|
|
|
690
|
auto varId = itVar->second;
|
|
690
|
auto varId = itVar->second;
|
|
691
|
|
|
691
|
|
|
692
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(varId);
|
|
692
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(varId);
|
|
693
|
if (itVarHandler == m_VarIdToVarRequestHandler.cend()) {
|
|
693
|
if (itVarHandler == m_VarIdToVarRequestHandler.cend()) {
|
|
694
|
qCCritical(LOG_VariableController())
|
|
694
|
qCCritical(LOG_VariableController())
|
|
695
|
<< tr("Impossible to process request for variable with unknown handler");
|
|
695
|
<< tr("Impossible to process request for variable with unknown handler");
|
|
696
|
return;
|
|
696
|
return;
|
|
697
|
}
|
|
697
|
}
|
|
698
|
|
|
698
|
|
|
699
|
auto oldRange = var->range();
|
|
699
|
auto oldRange = var->range();
|
|
700
|
|
|
700
|
|
|
701
|
auto varHandler = itVarHandler->second.get();
|
|
701
|
auto varHandler = itVarHandler->second.get();
|
|
702
|
|
|
702
|
|
|
703
|
if (varHandler->m_State != VariableRequestHandlerState::OFF) {
|
|
703
|
if (varHandler->m_State != VariableRequestHandlerState::OFF) {
|
|
704
|
oldRange = varHandler->m_RunningVarRequest.m_RangeRequested;
|
|
704
|
oldRange = varHandler->m_RunningVarRequest.m_RangeRequested;
|
|
705
|
}
|
|
705
|
}
|
|
706
|
|
|
706
|
|
|
707
|
auto varRequest = VariableRequest{};
|
|
707
|
auto varRequest = VariableRequest{};
|
|
708
|
varRequest.m_VariableGroupId = varRequestId;
|
|
708
|
varRequest.m_VariableGroupId = varRequestId;
|
|
709
|
auto varStrategyRangesRequested
|
|
709
|
auto varStrategyRangesRequested
|
|
710
|
= m_VariableCacheStrategy->computeRange(oldRange, rangeRequested);
|
|
710
|
= m_VariableCacheStrategy->computeRange(oldRange, rangeRequested);
|
|
711
|
varRequest.m_RangeRequested = varStrategyRangesRequested.first;
|
|
711
|
varRequest.m_RangeRequested = varStrategyRangesRequested.first;
|
|
712
|
varRequest.m_CacheRangeRequested = varStrategyRangesRequested.second;
|
|
712
|
varRequest.m_CacheRangeRequested = varStrategyRangesRequested.second;
|
|
713
|
|
|
713
|
|
|
714
|
switch (varHandler->m_State) {
|
|
714
|
switch (varHandler->m_State) {
|
|
715
|
case VariableRequestHandlerState::OFF: {
|
|
715
|
case VariableRequestHandlerState::OFF: {
|
|
716
|
qCDebug(LOG_VariableController()) << tr("Process Request OFF")
|
|
716
|
qCDebug(LOG_VariableController()) << tr("Process Request OFF")
|
|
717
|
<< varRequest.m_RangeRequested
|
|
717
|
<< varRequest.m_RangeRequested
|
|
718
|
<< varRequest.m_CacheRangeRequested;
|
|
718
|
<< varRequest.m_CacheRangeRequested;
|
|
719
|
varHandler->m_RunningVarRequest = varRequest;
|
|
719
|
varHandler->m_RunningVarRequest = varRequest;
|
|
720
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
720
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
721
|
executeVarRequest(var, varRequest);
|
|
721
|
executeVarRequest(var, varRequest);
|
|
722
|
break;
|
|
722
|
break;
|
|
723
|
}
|
|
723
|
}
|
|
724
|
case VariableRequestHandlerState::RUNNING: {
|
|
724
|
case VariableRequestHandlerState::RUNNING: {
|
|
725
|
qCDebug(LOG_VariableController()) << tr("Process Request RUNNING")
|
|
725
|
qCDebug(LOG_VariableController()) << tr("Process Request RUNNING")
|
|
726
|
<< varRequest.m_RangeRequested
|
|
726
|
<< varRequest.m_RangeRequested
|
|
727
|
<< varRequest.m_CacheRangeRequested;
|
|
727
|
<< varRequest.m_CacheRangeRequested;
|
|
728
|
varHandler->m_State = VariableRequestHandlerState::PENDING;
|
|
728
|
varHandler->m_State = VariableRequestHandlerState::PENDING;
|
|
729
|
varHandler->m_PendingVarRequest = varRequest;
|
|
729
|
varHandler->m_PendingVarRequest = varRequest;
|
|
730
|
break;
|
|
730
|
break;
|
|
731
|
}
|
|
731
|
}
|
|
732
|
case VariableRequestHandlerState::PENDING: {
|
|
732
|
case VariableRequestHandlerState::PENDING: {
|
|
733
|
qCDebug(LOG_VariableController()) << tr("Process Request PENDING")
|
|
733
|
qCDebug(LOG_VariableController()) << tr("Process Request PENDING")
|
|
734
|
<< varRequest.m_RangeRequested
|
|
734
|
<< varRequest.m_RangeRequested
|
|
735
|
<< varRequest.m_CacheRangeRequested;
|
|
735
|
<< varRequest.m_CacheRangeRequested;
|
|
736
|
auto variableGroupIdToCancel = varHandler->m_PendingVarRequest.m_VariableGroupId;
|
|
736
|
auto variableGroupIdToCancel = varHandler->m_PendingVarRequest.m_VariableGroupId;
|
|
737
|
cancelVariableRequest(variableGroupIdToCancel);
|
|
737
|
cancelVariableRequest(variableGroupIdToCancel);
|
|
738
|
// Cancel variable can make state downgrade
|
|
738
|
// Cancel variable can make state downgrade
|
|
739
|
varHandler->m_State = VariableRequestHandlerState::PENDING;
|
|
739
|
varHandler->m_State = VariableRequestHandlerState::PENDING;
|
|
740
|
varHandler->m_PendingVarRequest = varRequest;
|
|
740
|
varHandler->m_PendingVarRequest = varRequest;
|
|
741
|
|
|
741
|
|
|
742
|
break;
|
|
742
|
break;
|
|
743
|
}
|
|
743
|
}
|
|
744
|
default:
|
|
744
|
default:
|
|
745
|
qCCritical(LOG_VariableController())
|
|
745
|
qCCritical(LOG_VariableController())
|
|
746
|
<< QObject::tr("Unknown VariableRequestHandlerState");
|
|
746
|
<< QObject::tr("Unknown VariableRequestHandlerState");
|
|
747
|
}
|
|
747
|
}
|
|
748
|
}
|
|
748
|
}
|
|
749
|
|
|
749
|
|
|
750
|
std::shared_ptr<Variable>
|
|
750
|
std::shared_ptr<Variable>
|
|
751
|
VariableController::VariableControllerPrivate::findVariable(QUuid vIdentifier)
|
|
751
|
VariableController::VariableControllerPrivate::findVariable(QUuid vIdentifier)
|
|
752
|
{
|
|
752
|
{
|
|
753
|
std::shared_ptr<Variable> var;
|
|
753
|
std::shared_ptr<Variable> var;
|
|
754
|
auto findReply = [vIdentifier](const auto &entry) { return vIdentifier == entry.second; };
|
|
754
|
auto findReply = [vIdentifier](const auto &entry) { return vIdentifier == entry.second; };
|
|
755
|
|
|
755
|
|
|
756
|
auto end = m_VariableToIdentifierMap.cend();
|
|
756
|
auto end = m_VariableToIdentifierMap.cend();
|
|
757
|
auto it = std::find_if(m_VariableToIdentifierMap.cbegin(), end, findReply);
|
|
757
|
auto it = std::find_if(m_VariableToIdentifierMap.cbegin(), end, findReply);
|
|
758
|
if (it != end) {
|
|
758
|
if (it != end) {
|
|
759
|
var = it->first;
|
|
759
|
var = it->first;
|
|
760
|
}
|
|
760
|
}
|
|
761
|
else {
|
|
761
|
else {
|
|
762
|
qCCritical(LOG_VariableController())
|
|
762
|
qCCritical(LOG_VariableController())
|
|
763
|
<< tr("Impossible to find the variable with the identifier: ") << vIdentifier;
|
|
763
|
<< tr("Impossible to find the variable with the identifier: ") << vIdentifier;
|
|
764
|
}
|
|
764
|
}
|
|
765
|
|
|
765
|
|
|
766
|
return var;
|
|
766
|
return var;
|
|
767
|
}
|
|
767
|
}
|
|
768
|
|
|
768
|
|
|
769
|
std::shared_ptr<IDataSeries> VariableController::VariableControllerPrivate::retrieveDataSeries(
|
|
769
|
std::shared_ptr<IDataSeries> VariableController::VariableControllerPrivate::retrieveDataSeries(
|
|
770
|
const QVector<AcquisitionDataPacket> acqDataPacketVector)
|
|
770
|
const QVector<AcquisitionDataPacket> acqDataPacketVector)
|
|
771
|
{
|
|
771
|
{
|
|
772
|
qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size")
|
|
772
|
qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size")
|
|
773
|
<< acqDataPacketVector.size();
|
|
773
|
<< acqDataPacketVector.size();
|
|
774
|
std::shared_ptr<IDataSeries> dataSeries;
|
|
774
|
std::shared_ptr<IDataSeries> dataSeries;
|
|
775
|
if (!acqDataPacketVector.isEmpty()) {
|
|
775
|
if (!acqDataPacketVector.isEmpty()) {
|
|
776
|
dataSeries = acqDataPacketVector[0].m_DateSeries;
|
|
776
|
dataSeries = acqDataPacketVector[0].m_DateSeries;
|
|
777
|
for (int i = 1; i < acqDataPacketVector.size(); ++i) {
|
|
777
|
for (int i = 1; i < acqDataPacketVector.size(); ++i) {
|
|
778
|
dataSeries->merge(acqDataPacketVector[i].m_DateSeries.get());
|
|
778
|
dataSeries->merge(acqDataPacketVector[i].m_DateSeries.get());
|
|
779
|
}
|
|
779
|
}
|
|
780
|
}
|
|
780
|
}
|
|
781
|
qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size END")
|
|
781
|
qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size END")
|
|
782
|
<< acqDataPacketVector.size();
|
|
782
|
<< acqDataPacketVector.size();
|
|
783
|
return dataSeries;
|
|
783
|
return dataSeries;
|
|
784
|
}
|
|
784
|
}
|
|
785
|
|
|
785
|
|
|
786
|
void VariableController::VariableControllerPrivate::registerProvider(
|
|
786
|
void VariableController::VariableControllerPrivate::registerProvider(
|
|
787
|
std::shared_ptr<IDataProvider> provider)
|
|
787
|
std::shared_ptr<IDataProvider> provider)
|
|
788
|
{
|
|
788
|
{
|
|
789
|
if (m_ProviderSet.find(provider) == m_ProviderSet.end()) {
|
|
789
|
if (m_ProviderSet.find(provider) == m_ProviderSet.end()) {
|
|
790
|
qCDebug(LOG_VariableController()) << tr("Registering of a new provider")
|
|
790
|
qCDebug(LOG_VariableController()) << tr("Registering of a new provider")
|
|
791
|
<< provider->objectName();
|
|
791
|
<< provider->objectName();
|
|
792
|
m_ProviderSet.insert(provider);
|
|
792
|
m_ProviderSet.insert(provider);
|
|
793
|
connect(provider.get(), &IDataProvider::dataProvided, m_VariableAcquisitionWorker.get(),
|
|
793
|
connect(provider.get(), &IDataProvider::dataProvided, m_VariableAcquisitionWorker.get(),
|
|
794
|
&VariableAcquisitionWorker::onVariableDataAcquired);
|
|
794
|
&VariableAcquisitionWorker::onVariableDataAcquired);
|
|
795
|
connect(provider.get(), &IDataProvider::dataProvidedProgress,
|
|
795
|
connect(provider.get(), &IDataProvider::dataProvidedProgress,
|
|
796
|
m_VariableAcquisitionWorker.get(),
|
|
796
|
m_VariableAcquisitionWorker.get(),
|
|
797
|
&VariableAcquisitionWorker::onVariableRetrieveDataInProgress);
|
|
797
|
&VariableAcquisitionWorker::onVariableRetrieveDataInProgress);
|
|
798
|
connect(provider.get(), &IDataProvider::dataProvidedFailed,
|
|
798
|
connect(provider.get(), &IDataProvider::dataProvidedFailed,
|
|
799
|
m_VariableAcquisitionWorker.get(),
|
|
799
|
m_VariableAcquisitionWorker.get(),
|
|
800
|
&VariableAcquisitionWorker::onVariableAcquisitionFailed);
|
|
800
|
&VariableAcquisitionWorker::onVariableAcquisitionFailed);
|
|
801
|
}
|
|
801
|
}
|
|
802
|
else {
|
|
802
|
else {
|
|
803
|
qCDebug(LOG_VariableController()) << tr("Cannot register provider, it already exists ");
|
|
803
|
qCDebug(LOG_VariableController()) << tr("Cannot register provider, it already exists ");
|
|
804
|
}
|
|
804
|
}
|
|
805
|
}
|
|
805
|
}
|
|
806
|
|
|
806
|
|
|
807
|
QUuid VariableController::VariableControllerPrivate::acceptVariableRequest(
|
|
807
|
QUuid VariableController::VariableControllerPrivate::acceptVariableRequest(
|
|
808
|
QUuid varId, std::shared_ptr<IDataSeries> dataSeries)
|
|
808
|
QUuid varId, std::shared_ptr<IDataSeries> dataSeries)
|
|
809
|
{
|
|
809
|
{
|
|
810
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(varId);
|
|
810
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(varId);
|
|
811
|
if (itVarHandler == m_VarIdToVarRequestHandler.cend()) {
|
|
811
|
if (itVarHandler == m_VarIdToVarRequestHandler.cend()) {
|
|
812
|
return QUuid();
|
|
812
|
return QUuid();
|
|
813
|
}
|
|
813
|
}
|
|
814
|
|
|
814
|
|
|
815
|
auto varHandler = itVarHandler->second.get();
|
|
815
|
auto varHandler = itVarHandler->second.get();
|
|
816
|
if (varHandler->m_State == VariableRequestHandlerState::OFF) {
|
|
816
|
if (varHandler->m_State == VariableRequestHandlerState::OFF) {
|
|
817
|
qCCritical(LOG_VariableController())
|
|
817
|
qCCritical(LOG_VariableController())
|
|
818
|
<< tr("acceptVariableRequest impossible on a variable with OFF state");
|
|
818
|
<< tr("acceptVariableRequest impossible on a variable with OFF state");
|
|
819
|
}
|
|
819
|
}
|
|
820
|
|
|
820
|
|
|
821
|
varHandler->m_RunningVarRequest.m_DataSeries = dataSeries;
|
|
821
|
varHandler->m_RunningVarRequest.m_DataSeries = dataSeries;
|
|
822
|
varHandler->m_CanUpdate = true;
|
|
822
|
varHandler->m_CanUpdate = true;
|
|
823
|
|
|
823
|
|
|
824
|
// Element traitΓ©, on a dΓ©jΓ toutes les donnΓ©es necessaires
|
|
824
|
// Element traitΓ©, on a dΓ©jΓ toutes les donnΓ©es necessaires
|
|
825
|
auto varGroupId = varHandler->m_RunningVarRequest.m_VariableGroupId;
|
|
825
|
auto varGroupId = varHandler->m_RunningVarRequest.m_VariableGroupId;
|
|
826
|
qCDebug(LOG_VariableController()) << "Variable::acceptVariableRequest" << varGroupId
|
|
826
|
qCDebug(LOG_VariableController()) << "Variable::acceptVariableRequest" << varGroupId
|
|
827
|
<< m_VarGroupIdToVarIds.size();
|
|
827
|
<< m_VarGroupIdToVarIds.size();
|
|
828
|
|
|
828
|
|
|
829
|
return varHandler->m_RunningVarRequest.m_VariableGroupId;
|
|
829
|
return varHandler->m_RunningVarRequest.m_VariableGroupId;
|
|
830
|
}
|
|
830
|
}
|
|
831
|
|
|
831
|
|
|
832
|
void VariableController::VariableControllerPrivate::updateVariables(QUuid varRequestId)
|
|
832
|
void VariableController::VariableControllerPrivate::updateVariables(QUuid varRequestId)
|
|
833
|
{
|
|
833
|
{
|
|
834
|
qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
|
|
834
|
qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
|
|
835
|
<< QThread::currentThread()->objectName() << varRequestId;
|
|
835
|
<< QThread::currentThread()->objectName() << varRequestId;
|
|
836
|
|
|
836
|
|
|
837
|
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
|
|
837
|
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
|
|
838
|
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
|
|
838
|
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
|
|
839
|
qCWarning(LOG_VariableController())
|
|
839
|
qCWarning(LOG_VariableController())
|
|
840
|
<< tr("Impossible to updateVariables of unknown variables") << varRequestId;
|
|
840
|
<< tr("Impossible to updateVariables of unknown variables") << varRequestId;
|
|
841
|
return;
|
|
841
|
return;
|
|
842
|
}
|
|
842
|
}
|
|
843
|
|
|
843
|
|
|
844
|
auto &varIds = varGroupIdToVarIdsIt->second;
|
|
844
|
auto &varIds = varGroupIdToVarIdsIt->second;
|
|
845
|
auto varIdsEnd = varIds.end();
|
|
845
|
auto varIdsEnd = varIds.end();
|
|
846
|
bool processVariableUpdate = true;
|
|
846
|
bool processVariableUpdate = true;
|
|
847
|
qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
|
|
847
|
qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
|
|
848
|
<< varRequestId << varIds.size();
|
|
848
|
<< varRequestId << varIds.size();
|
|
849
|
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate;
|
|
849
|
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate;
|
|
850
|
++varIdsIt) {
|
|
850
|
++varIdsIt) {
|
|
851
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
851
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
852
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
852
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
853
|
processVariableUpdate &= itVarHandler->second->m_CanUpdate;
|
|
853
|
processVariableUpdate &= itVarHandler->second->m_CanUpdate;
|
|
854
|
}
|
|
854
|
}
|
|
855
|
}
|
|
855
|
}
|
|
856
|
|
|
856
|
|
|
857
|
if (processVariableUpdate) {
|
|
857
|
if (processVariableUpdate) {
|
|
858
|
qCDebug(LOG_VariableController()) << "Final update OK for the var request" << varIds.size();
|
|
858
|
qCDebug(LOG_VariableController()) << "Final update OK for the var request" << varIds.size();
|
|
859
|
for (auto varIdsIt = varIds.begin(); varIdsIt != varIdsEnd; ++varIdsIt) {
|
|
859
|
for (auto varIdsIt = varIds.begin(); varIdsIt != varIdsEnd; ++varIdsIt) {
|
|
860
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
860
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
861
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
861
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
862
|
if (auto var = findVariable(*varIdsIt)) {
|
|
862
|
if (auto var = findVariable(*varIdsIt)) {
|
|
863
|
auto &varRequest = itVarHandler->second->m_RunningVarRequest;
|
|
863
|
auto &varRequest = itVarHandler->second->m_RunningVarRequest;
|
|
864
|
var->setRange(varRequest.m_RangeRequested);
|
|
864
|
var->setRange(varRequest.m_RangeRequested);
|
|
865
|
var->setCacheRange(varRequest.m_CacheRangeRequested);
|
|
865
|
var->setCacheRange(varRequest.m_CacheRangeRequested);
|
|
866
|
qCDebug(LOG_VariableController()) << tr("1: onDataProvided")
|
|
866
|
qCDebug(LOG_VariableController()) << tr("1: onDataProvided")
|
|
867
|
<< varRequest.m_RangeRequested
|
|
867
|
<< varRequest.m_RangeRequested
|
|
868
|
<< varRequest.m_CacheRangeRequested;
|
|
868
|
<< varRequest.m_CacheRangeRequested;
|
|
869
|
qCDebug(LOG_VariableController()) << tr("2: onDataProvided var points before")
|
|
869
|
qCDebug(LOG_VariableController()) << tr("2: onDataProvided var points before")
|
|
870
|
<< var->nbPoints()
|
|
870
|
<< var->nbPoints()
|
|
871
|
<< varRequest.m_DataSeries->nbPoints();
|
|
871
|
<< varRequest.m_DataSeries->nbPoints();
|
|
872
|
var->mergeDataSeries(varRequest.m_DataSeries);
|
|
872
|
var->mergeDataSeries(varRequest.m_DataSeries);
|
|
873
|
qCDebug(LOG_VariableController()) << tr("3: onDataProvided var points after")
|
|
873
|
qCDebug(LOG_VariableController()) << tr("3: onDataProvided var points after")
|
|
874
|
<< var->nbPoints();
|
|
874
|
<< var->nbPoints();
|
|
875
|
|
|
875
|
|
|
876
|
emit var->updated();
|
|
876
|
emit var->updated();
|
|
877
|
qCDebug(LOG_VariableController()) << tr("Update OK");
|
|
877
|
qCDebug(LOG_VariableController()) << tr("Update OK");
|
|
878
|
}
|
|
878
|
}
|
|
879
|
else {
|
|
879
|
else {
|
|
880
|
qCCritical(LOG_VariableController())
|
|
880
|
qCCritical(LOG_VariableController())
|
|
881
|
<< tr("Impossible to update data to a null variable");
|
|
881
|
<< tr("Impossible to update data to a null variable");
|
|
882
|
}
|
|
882
|
}
|
|
883
|
}
|
|
883
|
}
|
|
884
|
}
|
|
884
|
}
|
|
885
|
updateVariableRequest(varRequestId);
|
|
885
|
updateVariableRequest(varRequestId);
|
|
886
|
|
|
886
|
|
|
887
|
// cleaning varRequestId
|
|
887
|
// cleaning varRequestId
|
|
888
|
qCDebug(LOG_VariableController()) << tr("m_VarGroupIdToVarIds erase") << varRequestId;
|
|
888
|
qCDebug(LOG_VariableController()) << tr("m_VarGroupIdToVarIds erase") << varRequestId;
|
|
889
|
m_VarGroupIdToVarIds.erase(varRequestId);
|
|
889
|
m_VarGroupIdToVarIds.erase(varRequestId);
|
|
890
|
if (m_VarGroupIdToVarIds.empty()) {
|
|
890
|
if (m_VarGroupIdToVarIds.empty()) {
|
|
891
|
emit q->acquisitionFinished();
|
|
891
|
emit q->acquisitionFinished();
|
|
892
|
}
|
|
892
|
}
|
|
893
|
}
|
|
893
|
}
|
|
894
|
}
|
|
894
|
}
|
|
895
|
|
|
895
|
|
|
896
|
|
|
896
|
|
|
897
|
void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid varRequestId)
|
|
897
|
void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid varRequestId)
|
|
898
|
{
|
|
898
|
{
|
|
899
|
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
|
|
899
|
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
|
|
900
|
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
|
|
900
|
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
|
|
901
|
qCCritical(LOG_VariableController()) << QObject::tr(
|
|
901
|
qCCritical(LOG_VariableController()) << QObject::tr(
|
|
902
|
"Impossible to updateVariableRequest since varGroupdId isn't here anymore");
|
|
902
|
"Impossible to updateVariableRequest since varGroupdId isn't here anymore");
|
|
903
|
|
|
903
|
|
|
904
|
return;
|
|
904
|
return;
|
|
905
|
}
|
|
905
|
}
|
|
906
|
|
|
906
|
|
|
907
|
auto &varIds = varGroupIdToVarIdsIt->second;
|
|
907
|
auto &varIds = varGroupIdToVarIdsIt->second;
|
|
908
|
auto varIdsEnd = varIds.end();
|
|
908
|
auto varIdsEnd = varIds.end();
|
|
909
|
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) {
|
|
909
|
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) {
|
|
910
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
910
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
911
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
911
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
912
|
|
|
912
|
|
|
913
|
auto varHandler = itVarHandler->second.get();
|
|
913
|
auto varHandler = itVarHandler->second.get();
|
|
914
|
varHandler->m_CanUpdate = false;
|
|
914
|
varHandler->m_CanUpdate = false;
|
|
915
|
|
|
915
|
|
|
916
|
|
|
916
|
|
|
917
|
switch (varHandler->m_State) {
|
|
917
|
switch (varHandler->m_State) {
|
|
918
|
case VariableRequestHandlerState::OFF: {
|
|
918
|
case VariableRequestHandlerState::OFF: {
|
|
919
|
qCCritical(LOG_VariableController())
|
|
919
|
qCCritical(LOG_VariableController())
|
|
920
|
<< QObject::tr("Impossible to update a variable with handler in OFF state");
|
|
920
|
<< QObject::tr("Impossible to update a variable with handler in OFF state");
|
|
921
|
} break;
|
|
921
|
} break;
|
|
922
|
case VariableRequestHandlerState::RUNNING: {
|
|
922
|
case VariableRequestHandlerState::RUNNING: {
|
|
923
|
varHandler->m_State = VariableRequestHandlerState::OFF;
|
|
923
|
varHandler->m_State = VariableRequestHandlerState::OFF;
|
|
924
|
varHandler->m_RunningVarRequest = VariableRequest{};
|
|
924
|
varHandler->m_RunningVarRequest = VariableRequest{};
|
|
925
|
break;
|
|
925
|
break;
|
|
926
|
}
|
|
926
|
}
|
|
927
|
case VariableRequestHandlerState::PENDING: {
|
|
927
|
case VariableRequestHandlerState::PENDING: {
|
|
928
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
928
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
929
|
varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
|
|
929
|
varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
|
|
930
|
varHandler->m_PendingVarRequest = VariableRequest{};
|
|
930
|
varHandler->m_PendingVarRequest = VariableRequest{};
|
|
931
|
auto var = findVariable(itVarHandler->first);
|
|
931
|
auto var = findVariable(itVarHandler->first);
|
|
932
|
executeVarRequest(var, varHandler->m_RunningVarRequest);
|
|
932
|
executeVarRequest(var, varHandler->m_RunningVarRequest);
|
|
933
|
updateVariables(varHandler->m_RunningVarRequest.m_VariableGroupId);
|
|
933
|
updateVariables(varHandler->m_RunningVarRequest.m_VariableGroupId);
|
|
934
|
break;
|
|
934
|
break;
|
|
935
|
}
|
|
935
|
}
|
|
936
|
default:
|
|
936
|
default:
|
|
937
|
qCCritical(LOG_VariableController())
|
|
937
|
qCCritical(LOG_VariableController())
|
|
938
|
<< QObject::tr("Unknown VariableRequestHandlerState");
|
|
938
|
<< QObject::tr("Unknown VariableRequestHandlerState");
|
|
939
|
}
|
|
939
|
}
|
|
940
|
}
|
|
940
|
}
|
|
941
|
}
|
|
941
|
}
|
|
942
|
}
|
|
942
|
}
|
|
943
|
|
|
943
|
|
|
944
|
|
|
944
|
|
|
945
|
void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid varRequestId)
|
|
945
|
void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid varRequestId)
|
|
946
|
{
|
|
946
|
{
|
|
947
|
qCDebug(LOG_VariableController()) << tr("cancelVariableRequest") << varRequestId;
|
|
947
|
qCDebug(LOG_VariableController()) << tr("cancelVariableRequest") << varRequestId;
|
|
948
|
|
|
948
|
|
|
949
|
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
|
|
949
|
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
|
|
950
|
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
|
|
950
|
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
|
|
951
|
qCCritical(LOG_VariableController())
|
|
951
|
qCCritical(LOG_VariableController())
|
|
952
|
<< tr("Impossible to cancelVariableRequest for unknown varGroupdId") << varRequestId;
|
|
952
|
<< tr("Impossible to cancelVariableRequest for unknown varGroupdId") << varRequestId;
|
|
953
|
return;
|
|
953
|
return;
|
|
954
|
}
|
|
954
|
}
|
|
955
|
|
|
955
|
|
|
956
|
auto &varIds = varGroupIdToVarIdsIt->second;
|
|
956
|
auto &varIds = varGroupIdToVarIdsIt->second;
|
|
957
|
auto varIdsEnd = varIds.end();
|
|
957
|
auto varIdsEnd = varIds.end();
|
|
958
|
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) {
|
|
958
|
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) {
|
|
959
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
959
|
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
|
|
960
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
960
|
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
|
|
961
|
|
|
961
|
|
|
962
|
auto varHandler = itVarHandler->second.get();
|
|
962
|
auto varHandler = itVarHandler->second.get();
|
|
963
|
varHandler->m_VarId = QUuid{};
|
|
963
|
varHandler->m_VarId = QUuid{};
|
|
964
|
switch (varHandler->m_State) {
|
|
964
|
switch (varHandler->m_State) {
|
|
965
|
case VariableRequestHandlerState::OFF: {
|
|
965
|
case VariableRequestHandlerState::OFF: {
|
|
966
|
qCWarning(LOG_VariableController())
|
|
966
|
qCWarning(LOG_VariableController())
|
|
967
|
<< QObject::tr("Impossible to cancel a variable with no running request");
|
|
967
|
<< QObject::tr("Impossible to cancel a variable with no running request");
|
|
968
|
break;
|
|
968
|
break;
|
|
969
|
}
|
|
969
|
}
|
|
970
|
case VariableRequestHandlerState::RUNNING: {
|
|
970
|
case VariableRequestHandlerState::RUNNING: {
|
|
971
|
|
|
971
|
|
|
972
|
if (varHandler->m_RunningVarRequest.m_VariableGroupId == varRequestId) {
|
|
972
|
if (varHandler->m_RunningVarRequest.m_VariableGroupId == varRequestId) {
|
|
973
|
auto var = findVariable(itVarHandler->first);
|
|
973
|
auto var = findVariable(itVarHandler->first);
|
|
974
|
auto varProvider = m_VariableToProviderMap.at(var);
|
|
974
|
auto varProvider = m_VariableToProviderMap.at(var);
|
|
975
|
if (varProvider != nullptr) {
|
|
975
|
if (varProvider != nullptr) {
|
|
976
|
m_VariableAcquisitionWorker->abortProgressRequested(
|
|
976
|
m_VariableAcquisitionWorker->abortProgressRequested(
|
|
977
|
itVarHandler->first);
|
|
977
|
itVarHandler->first);
|
|
978
|
}
|
|
978
|
}
|
|
979
|
m_VariableModel->setDataProgress(var, 0.0);
|
|
979
|
m_VariableModel->setDataProgress(var, 0.0);
|
|
980
|
varHandler->m_CanUpdate = false;
|
|
980
|
varHandler->m_CanUpdate = false;
|
|
981
|
varHandler->m_State = VariableRequestHandlerState::OFF;
|
|
981
|
varHandler->m_State = VariableRequestHandlerState::OFF;
|
|
982
|
varHandler->m_RunningVarRequest = VariableRequest{};
|
|
982
|
varHandler->m_RunningVarRequest = VariableRequest{};
|
|
983
|
}
|
|
983
|
}
|
|
984
|
else {
|
|
984
|
else {
|
|
985
|
// TODO: log Impossible to cancel the running variable request beacause its
|
|
985
|
// TODO: log Impossible to cancel the running variable request beacause its
|
|
986
|
// varRequestId isn't not the canceled one
|
|
986
|
// varRequestId isn't not the canceled one
|
|
987
|
}
|
|
987
|
}
|
|
988
|
break;
|
|
988
|
break;
|
|
989
|
}
|
|
989
|
}
|
|
990
|
case VariableRequestHandlerState::PENDING: {
|
|
990
|
case VariableRequestHandlerState::PENDING: {
|
|
991
|
if (varHandler->m_RunningVarRequest.m_VariableGroupId == varRequestId) {
|
|
991
|
if (varHandler->m_RunningVarRequest.m_VariableGroupId == varRequestId) {
|
|
992
|
auto var = findVariable(itVarHandler->first);
|
|
992
|
auto var = findVariable(itVarHandler->first);
|
|
993
|
auto varProvider = m_VariableToProviderMap.at(var);
|
|
993
|
auto varProvider = m_VariableToProviderMap.at(var);
|
|
994
|
if (varProvider != nullptr) {
|
|
994
|
if (varProvider != nullptr) {
|
|
995
|
m_VariableAcquisitionWorker->abortProgressRequested(
|
|
995
|
m_VariableAcquisitionWorker->abortProgressRequested(
|
|
996
|
itVarHandler->first);
|
|
996
|
itVarHandler->first);
|
|
997
|
}
|
|
997
|
}
|
|
998
|
m_VariableModel->setDataProgress(var, 0.0);
|
|
998
|
m_VariableModel->setDataProgress(var, 0.0);
|
|
999
|
varHandler->m_CanUpdate = false;
|
|
999
|
varHandler->m_CanUpdate = false;
|
|
1000
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
1000
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
1001
|
varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
|
|
1001
|
varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
|
|
1002
|
varHandler->m_PendingVarRequest = VariableRequest{};
|
|
1002
|
varHandler->m_PendingVarRequest = VariableRequest{};
|
|
1003
|
executeVarRequest(var, varHandler->m_RunningVarRequest);
|
|
1003
|
executeVarRequest(var, varHandler->m_RunningVarRequest);
|
|
1004
|
}
|
|
1004
|
}
|
|
1005
|
else if (varHandler->m_PendingVarRequest.m_VariableGroupId == varRequestId) {
|
|
1005
|
else if (varHandler->m_PendingVarRequest.m_VariableGroupId == varRequestId) {
|
|
1006
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
1006
|
varHandler->m_State = VariableRequestHandlerState::RUNNING;
|
|
1007
|
varHandler->m_PendingVarRequest = VariableRequest{};
|
|
1007
|
varHandler->m_PendingVarRequest = VariableRequest{};
|
|
1008
|
}
|
|
1008
|
}
|
|
1009
|
else {
|
|
1009
|
else {
|
|
1010
|
// TODO: log Impossible to cancel the variable request beacause its
|
|
1010
|
// TODO: log Impossible to cancel the variable request beacause its
|
|
1011
|
// varRequestId isn't not the canceled one
|
|
1011
|
// varRequestId isn't not the canceled one
|
|
1012
|
}
|
|
1012
|
}
|
|
1013
|
break;
|
|
1013
|
break;
|
|
1014
|
}
|
|
1014
|
}
|
|
1015
|
default:
|
|
1015
|
default:
|
|
1016
|
qCCritical(LOG_VariableController())
|
|
1016
|
qCCritical(LOG_VariableController())
|
|
1017
|
<< QObject::tr("Unknown VariableRequestHandlerState");
|
|
1017
|
<< QObject::tr("Unknown VariableRequestHandlerState");
|
|
1018
|
}
|
|
1018
|
}
|
|
1019
|
}
|
|
1019
|
}
|
|
1020
|
}
|
|
1020
|
}
|
|
1021
|
qCDebug(LOG_VariableController()) << tr("cancelVariableRequest: erase") << varRequestId;
|
|
1021
|
qCDebug(LOG_VariableController()) << tr("cancelVariableRequest: erase") << varRequestId;
|
|
1022
|
m_VarGroupIdToVarIds.erase(varRequestId);
|
|
1022
|
m_VarGroupIdToVarIds.erase(varRequestId);
|
|
1023
|
if (m_VarGroupIdToVarIds.empty()) {
|
|
1023
|
if (m_VarGroupIdToVarIds.empty()) {
|
|
1024
|
emit q->acquisitionFinished();
|
|
1024
|
emit q->acquisitionFinished();
|
|
1025
|
}
|
|
1025
|
}
|
|
1026
|
}
|
|
1026
|
}
|
|
1027
|
|
|
1027
|
|
|
1028
|
void VariableController::VariableControllerPrivate::executeVarRequest(std::shared_ptr<Variable> var,
|
|
1028
|
void VariableController::VariableControllerPrivate::executeVarRequest(std::shared_ptr<Variable> var,
|
|
1029
|
VariableRequest &varRequest)
|
|
1029
|
VariableRequest &varRequest)
|
|
1030
|
{
|
|
1030
|
{
|
|
1031
|
qCDebug(LOG_VariableController()) << tr("TORM: executeVarRequest");
|
|
1031
|
qCDebug(LOG_VariableController()) << tr("TORM: executeVarRequest");
|
|
1032
|
|
|
1032
|
|
|
1033
|
auto varIdIt = m_VariableToIdentifierMap.find(var);
|
|
1033
|
auto varIdIt = m_VariableToIdentifierMap.find(var);
|
|
1034
|
if (varIdIt == m_VariableToIdentifierMap.cend()) {
|
|
1034
|
if (varIdIt == m_VariableToIdentifierMap.cend()) {
|
|
1035
|
qCWarning(LOG_VariableController()) << tr(
|
|
1035
|
qCWarning(LOG_VariableController()) << tr(
|
|
1036
|
"Can't execute request of a variable that is not registered (may has been deleted)");
|
|
1036
|
"Can't execute request of a variable that is not registered (may has been deleted)");
|
|
1037
|
return;
|
|
1037
|
return;
|
|
1038
|
}
|
|
1038
|
}
|
|
1039
|
|
|
1039
|
|
|
1040
|
auto varId = varIdIt->second;
|
|
1040
|
auto varId = varIdIt->second;
|
|
1041
|
|
|
1041
|
|
|
1042
|
auto varCacheRange = var->cacheRange();
|
|
1042
|
auto varCacheRange = var->cacheRange();
|
|
1043
|
auto varCacheRangeRequested = varRequest.m_CacheRangeRequested;
|
|
1043
|
auto varCacheRangeRequested = varRequest.m_CacheRangeRequested;
|
|
1044
|
auto notInCacheRangeList
|
|
1044
|
auto notInCacheRangeList
|
|
1045
|
= Variable::provideNotInCacheRangeList(varCacheRange, varCacheRangeRequested);
|
|
1045
|
= Variable::provideNotInCacheRangeList(varCacheRange, varCacheRangeRequested);
|
|
1046
|
auto inCacheRangeList
|
|
1046
|
auto inCacheRangeList
|
|
1047
|
= Variable::provideInCacheRangeList(varCacheRange, varCacheRangeRequested);
|
|
1047
|
= Variable::provideInCacheRangeList(varCacheRange, varCacheRangeRequested);
|
|
1048
|
|
|
1048
|
|
|
1049
|
if (!notInCacheRangeList.empty()) {
|
|
1049
|
if (!notInCacheRangeList.empty()) {
|
|
1050
|
|
|
1050
|
|
|
1051
|
auto varProvider = m_VariableToProviderMap.at(var);
|
|
1051
|
auto varProvider = m_VariableToProviderMap.at(var);
|
|
1052
|
if (varProvider != nullptr) {
|
|
1052
|
if (varProvider != nullptr) {
|
|
1053
|
qCDebug(LOG_VariableController()) << "executeVarRequest " << varRequest.m_RangeRequested
|
|
1053
|
qCDebug(LOG_VariableController()) << "executeVarRequest " << varRequest.m_RangeRequested
|
|
1054
|
<< varRequest.m_CacheRangeRequested;
|
|
1054
|
<< varRequest.m_CacheRangeRequested;
|
|
1055
|
m_VariableAcquisitionWorker->pushVariableRequest(
|
|
1055
|
m_VariableAcquisitionWorker->pushVariableRequest(
|
|
1056
|
varRequest.m_VariableGroupId, varId, varRequest.m_RangeRequested,
|
|
1056
|
varRequest.m_VariableGroupId, varId, varRequest.m_RangeRequested,
|
|
1057
|
varRequest.m_CacheRangeRequested,
|
|
1057
|
varRequest.m_CacheRangeRequested,
|
|
1058
|
DataProviderParameters{std::move(notInCacheRangeList), var->metadata()},
|
|
1058
|
DataProviderParameters{std::move(notInCacheRangeList), var->metadata()},
|
|
1059
|
varProvider);
|
|
1059
|
varProvider);
|
|
1060
|
}
|
|
1060
|
}
|
|
1061
|
else {
|
|
1061
|
else {
|
|
1062
|
qCCritical(LOG_VariableController())
|
|
1062
|
qCCritical(LOG_VariableController())
|
|
1063
|
<< "Impossible to provide data with a null provider";
|
|
1063
|
<< "Impossible to provide data with a null provider";
|
|
1064
|
}
|
|
1064
|
}
|
|
1065
|
|
|
1065
|
|
|
1066
|
if (!inCacheRangeList.empty()) {
|
|
1066
|
if (!inCacheRangeList.empty()) {
|
|
1067
|
emit q->updateVarDisplaying(var, inCacheRangeList.first());
|
|
1067
|
emit q->updateVarDisplaying(var, inCacheRangeList.first());
|
|
1068
|
}
|
|
1068
|
}
|
|
1069
|
}
|
|
1069
|
}
|
|
1070
|
else {
|
|
1070
|
else {
|
|
1071
|
acceptVariableRequest(varId,
|
|
1071
|
acceptVariableRequest(varId,
|
|
1072
|
var->dataSeries()->subDataSeries(varRequest.m_CacheRangeRequested));
|
|
1072
|
var->dataSeries()->subDataSeries(varRequest.m_CacheRangeRequested));
|
|
1073
|
}
|
|
1073
|
}
|
|
1074
|
}
|
|
1074
|
}
|
|
1075
|
|
|
1075
|
|
|
1076
|
bool VariableController::VariableControllerPrivate::hasPendingDownloads()
|
|
1076
|
bool VariableController::VariableControllerPrivate::hasPendingDownloads()
|
|
1077
|
{
|
|
1077
|
{
|
|
1078
|
return !m_VarGroupIdToVarIds.empty();
|
|
1078
|
return !m_VarGroupIdToVarIds.empty();
|
|
1079
|
}
|
|
1079
|
}
|
|
1080
|
|
|
1080
|
|
|
1081
|
template <typename VariableIterator>
|
|
1081
|
template <typename VariableIterator>
|
|
1082
|
void VariableController::VariableControllerPrivate::desynchronize(VariableIterator variableIt,
|
|
1082
|
void VariableController::VariableControllerPrivate::desynchronize(VariableIterator variableIt,
|
|
1083
|
const QUuid &syncGroupId)
|
|
1083
|
const QUuid &syncGroupId)
|
|
1084
|
{
|
|
1084
|
{
|
|
1085
|
const auto &variable = variableIt->first;
|
|
1085
|
const auto &variable = variableIt->first;
|
|
1086
|
const auto &variableId = variableIt->second;
|
|
1086
|
const auto &variableId = variableIt->second;
|
|
1087
|
|
|
1087
|
|
|
1088
|
// Gets synchronization group
|
|
1088
|
// Gets synchronization group
|
|
1089
|
auto groupIt = m_GroupIdToVariableSynchronizationGroupMap.find(syncGroupId);
|
|
1089
|
auto groupIt = m_GroupIdToVariableSynchronizationGroupMap.find(syncGroupId);
|
|
1090
|
if (groupIt == m_GroupIdToVariableSynchronizationGroupMap.cend()) {
|
|
1090
|
if (groupIt == m_GroupIdToVariableSynchronizationGroupMap.cend()) {
|
|
1091
|
qCCritical(LOG_VariableController())
|
|
1091
|
qCCritical(LOG_VariableController())
|
|
1092
|
<< tr("Can't desynchronize variable %1: unknown synchronization group")
|
|
1092
|
<< tr("Can't desynchronize variable %1: unknown synchronization group")
|
|
1093
|
.arg(variable->name());
|
|
1093
|
.arg(variable->name());
|
|
1094
|
return;
|
|
1094
|
return;
|
|
1095
|
}
|
|
1095
|
}
|
|
1096
|
|
|
1096
|
|
|
1097
|
// Removes variable from synchronization group
|
|
1097
|
// Removes variable from synchronization group
|
|
1098
|
auto synchronizationGroup = groupIt->second;
|
|
1098
|
auto synchronizationGroup = groupIt->second;
|
|
1099
|
synchronizationGroup->removeVariable(variableId);
|
|
1099
|
synchronizationGroup->removeVariable(variableId);
|
|
1100
|
|
|
1100
|
|
|
1101
|
// Removes link between variable and synchronization group
|
|
1101
|
// Removes link between variable and synchronization group
|
|
1102
|
m_VariableIdGroupIdMap.erase(variableId);
|
|
1102
|
m_VariableIdGroupIdMap.erase(variableId);
|
|
1103
|
}
|
|
1103
|
}
|