##// END OF EJS Templates
Vera corrections
Alexandre Leroux -
r614:976817e9ad15
parent child
Show More
@@ -1,61 +1,61
1 #ifndef SCIQLOP_VARIABLEACQUISITIONWORKER_H
1 #ifndef SCIQLOP_VARIABLEACQUISITIONWORKER_H
2 #define SCIQLOP_VARIABLEACQUISITIONWORKER_H
2 #define SCIQLOP_VARIABLEACQUISITIONWORKER_H
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Data/DataProviderParameters.h>
6 #include <Data/DataProviderParameters.h>
7 #include <QLoggingCategory>
7 #include <QLoggingCategory>
8 #include <QObject>
8 #include <QObject>
9 #include <QUuid>
9 #include <QUuid>
10
10
11 #include <Data/AcquisitionDataPacket.h>
11 #include <Data/AcquisitionDataPacket.h>
12 #include <Data/IDataSeries.h>
12 #include <Data/IDataSeries.h>
13 #include <Data/SqpRange.h>
13 #include <Data/SqpRange.h>
14
14
15 #include <QLoggingCategory>
15 #include <QLoggingCategory>
16
16
17 #include <Common/spimpl.h>
17 #include <Common/spimpl.h>
18
18
19 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableAcquisitionWorker)
19 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableAcquisitionWorker)
20
20
21 class Variable;
21 class Variable;
22 class IDataProvider;
22 class IDataProvider;
23
23
24 /// This class aims to handle all acquisition request
24 /// This class aims to handle all acquisition request
25 class SCIQLOP_CORE_EXPORT VariableAcquisitionWorker : public QObject {
25 class SCIQLOP_CORE_EXPORT VariableAcquisitionWorker : public QObject {
26 Q_OBJECT
26 Q_OBJECT
27 public:
27 public:
28 explicit VariableAcquisitionWorker(QObject *parent = 0);
28 explicit VariableAcquisitionWorker(QObject *parent = 0);
29 virtual ~VariableAcquisitionWorker();
29 virtual ~VariableAcquisitionWorker();
30
30
31 QUuid pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, SqpRange rangeRequested,
31 QUuid pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, SqpRange rangeRequested,
32 SqpRange cacheRangeRequested, DataProviderParameters parameters,
32 SqpRange cacheRangeRequested, DataProviderParameters parameters,
33 std::shared_ptr<IDataProvider> provider);
33 std::shared_ptr<IDataProvider> provider);
34
34
35 void abortProgressRequested(QUuid vIdentifier);
35 void abortProgressRequested(QUuid vIdentifier);
36
36
37 void initialize();
37 void initialize();
38 void finalize();
38 void finalize();
39 signals:
39 signals:
40 void dataProvided(QUuid vIdentifier, const SqpRange &rangeRequested,
40 void dataProvided(QUuid vIdentifier, const SqpRange &rangeRequested,
41 const SqpRange &cacheRangeRequested,
41 const SqpRange &cacheRangeRequested,
42 QVector<AcquisitionDataPacket> dataAcquired);
42 QVector<AcquisitionDataPacket> dataAcquired);
43
43
44 void variableRequestInProgress(QUuid vIdentifier, double progress);
44 void variableRequestInProgress(QUuid vIdentifier, double progress);
45
45
46 public slots:
46 public slots:
47 void onVariableDataAcquired(QUuid acqIdentifier, std::shared_ptr<IDataSeries> dataSeries,
47 void onVariableDataAcquired(QUuid acqIdentifier, std::shared_ptr<IDataSeries> dataSeries,
48 SqpRange dataRangeAcquired);
48 SqpRange dataRangeAcquired);
49 void onVariableRetrieveDataInProgress(QUuid acqIdentifier, double progress);
49 void onVariableRetrieveDataInProgress(QUuid acqIdentifier, double progress);
50
50
51 private slots:
52 void onExecuteRequest(QUuid acqIdentifier);
53
54 private:
51 private:
55 void waitForFinish();
52 void waitForFinish();
56
53
57 class VariableAcquisitionWorkerPrivate;
54 class VariableAcquisitionWorkerPrivate;
58 spimpl::unique_impl_ptr<VariableAcquisitionWorkerPrivate> impl;
55 spimpl::unique_impl_ptr<VariableAcquisitionWorkerPrivate> impl;
56
57 private slots:
58 void onExecuteRequest(QUuid acqIdentifier);
59 };
59 };
60
60
61 #endif // SCIQLOP_VARIABLEACQUISITIONWORKER_H
61 #endif // SCIQLOP_VARIABLEACQUISITIONWORKER_H
@@ -1,238 +1,238
1 #include "Variable/VariableAcquisitionWorker.h"
1 #include "Variable/VariableAcquisitionWorker.h"
2
2
3 #include "Variable/Variable.h"
3 #include "Variable/Variable.h"
4
4
5 #include <Data/AcquisitionRequest.h>
5 #include <Data/AcquisitionRequest.h>
6 #include <Data/SqpRange.h>
6 #include <Data/SqpRange.h>
7
7
8 #include <unordered_map>
8 #include <unordered_map>
9 #include <utility>
9 #include <utility>
10
10
11 #include <QMutex>
11 #include <QMutex>
12 #include <QReadWriteLock>
12 #include <QReadWriteLock>
13 #include <QThread>
13 #include <QThread>
14
14
15 Q_LOGGING_CATEGORY(LOG_VariableAcquisitionWorker, "VariableAcquisitionWorker")
15 Q_LOGGING_CATEGORY(LOG_VariableAcquisitionWorker, "VariableAcquisitionWorker")
16
16
17 struct VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate {
17 struct VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate {
18
18
19 explicit VariableAcquisitionWorkerPrivate() : m_Lock{QReadWriteLock::Recursive} {}
19 explicit VariableAcquisitionWorkerPrivate() : m_Lock{QReadWriteLock::Recursive} {}
20
20
21 void lockRead() { m_Lock.lockForRead(); }
21 void lockRead() { m_Lock.lockForRead(); }
22 void lockWrite() { m_Lock.lockForWrite(); }
22 void lockWrite() { m_Lock.lockForWrite(); }
23 void unlock() { m_Lock.unlock(); }
23 void unlock() { m_Lock.unlock(); }
24
24
25 void removeVariableRequest(QUuid vIdentifier);
25 void removeVariableRequest(QUuid vIdentifier);
26
26
27 QMutex m_WorkingMutex;
27 QMutex m_WorkingMutex;
28 QReadWriteLock m_Lock;
28 QReadWriteLock m_Lock;
29
29
30 std::map<QUuid, QVector<AcquisitionDataPacket> > m_AcqIdentifierToAcqDataPacketVectorMap;
30 std::map<QUuid, QVector<AcquisitionDataPacket> > m_AcqIdentifierToAcqDataPacketVectorMap;
31 std::map<QUuid, AcquisitionRequest> m_AcqIdentifierToAcqRequestMap;
31 std::map<QUuid, AcquisitionRequest> m_AcqIdentifierToAcqRequestMap;
32 std::map<QUuid, std::pair<QUuid, QUuid> > m_VIdentifierToCurrrentAcqIdNextIdPairMap;
32 std::map<QUuid, std::pair<QUuid, QUuid> > m_VIdentifierToCurrrentAcqIdNextIdPairMap;
33 };
33 };
34
34
35
35
36 VariableAcquisitionWorker::VariableAcquisitionWorker(QObject *parent)
36 VariableAcquisitionWorker::VariableAcquisitionWorker(QObject *parent)
37 : QObject{parent}, impl{spimpl::make_unique_impl<VariableAcquisitionWorkerPrivate>()}
37 : QObject{parent}, impl{spimpl::make_unique_impl<VariableAcquisitionWorkerPrivate>()}
38 {
38 {
39 }
39 }
40
40
41 VariableAcquisitionWorker::~VariableAcquisitionWorker()
41 VariableAcquisitionWorker::~VariableAcquisitionWorker()
42 {
42 {
43 qCInfo(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker destruction")
43 qCInfo(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker destruction")
44 << QThread::currentThread();
44 << QThread::currentThread();
45 this->waitForFinish();
45 this->waitForFinish();
46 }
46 }
47
47
48
48
49 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid vIdentifier,
49 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid vIdentifier,
50 SqpRange rangeRequested,
50 SqpRange rangeRequested,
51 SqpRange cacheRangeRequested,
51 SqpRange cacheRangeRequested,
52 DataProviderParameters parameters,
52 DataProviderParameters parameters,
53 std::shared_ptr<IDataProvider> provider)
53 std::shared_ptr<IDataProvider> provider)
54 {
54 {
55 qCDebug(LOG_VariableAcquisitionWorker())
55 qCDebug(LOG_VariableAcquisitionWorker())
56 << tr("TORM VariableAcquisitionWorker::pushVariableRequest ") << cacheRangeRequested;
56 << tr("TORM VariableAcquisitionWorker::pushVariableRequest ") << cacheRangeRequested;
57 auto varRequestIdCanceled = QUuid();
57 auto varRequestIdCanceled = QUuid();
58
58
59 // Request creation
59 // Request creation
60 auto acqRequest = AcquisitionRequest{};
60 auto acqRequest = AcquisitionRequest{};
61 acqRequest.m_VarRequestId = varRequestId;
61 acqRequest.m_VarRequestId = varRequestId;
62 acqRequest.m_vIdentifier = vIdentifier;
62 acqRequest.m_vIdentifier = vIdentifier;
63 acqRequest.m_DataProviderParameters = parameters;
63 acqRequest.m_DataProviderParameters = parameters;
64 acqRequest.m_RangeRequested = rangeRequested;
64 acqRequest.m_RangeRequested = rangeRequested;
65 acqRequest.m_CacheRangeRequested = cacheRangeRequested;
65 acqRequest.m_CacheRangeRequested = cacheRangeRequested;
66 acqRequest.m_Size = parameters.m_Times.size();
66 acqRequest.m_Size = parameters.m_Times.size();
67 acqRequest.m_Provider = provider;
67 acqRequest.m_Provider = provider;
68
68
69
69
70 // Register request
70 // Register request
71 impl->lockWrite();
71 impl->lockWrite();
72 impl->m_AcqIdentifierToAcqRequestMap.insert(
72 impl->m_AcqIdentifierToAcqRequestMap.insert(
73 std::make_pair(acqRequest.m_AcqIdentifier, acqRequest));
73 std::make_pair(acqRequest.m_AcqIdentifier, acqRequest));
74
74
75 auto it = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
75 auto it = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
76 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
76 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
77 // A current request already exists, we can replace the next one
77 // A current request already exists, we can replace the next one
78 auto nextAcqId = it->second.second;
78 auto nextAcqId = it->second.second;
79 auto acqIdentifierToAcqRequestMapIt = impl->m_AcqIdentifierToAcqRequestMap.find(nextAcqId);
79 auto acqIdentifierToAcqRequestMapIt = impl->m_AcqIdentifierToAcqRequestMap.find(nextAcqId);
80 if (acqIdentifierToAcqRequestMapIt != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
80 if (acqIdentifierToAcqRequestMapIt != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
81 auto request = acqIdentifierToAcqRequestMapIt->second;
81 auto request = acqIdentifierToAcqRequestMapIt->second;
82 varRequestIdCanceled = request.m_VarRequestId;
82 varRequestIdCanceled = request.m_VarRequestId;
83 }
83 }
84
84
85 it->second.second = acqRequest.m_AcqIdentifier;
85 it->second.second = acqRequest.m_AcqIdentifier;
86 impl->unlock();
86 impl->unlock();
87 }
87 }
88 else {
88 else {
89 // First request for the variable, it must be stored and executed
89 // First request for the variable, it must be stored and executed
90 impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.insert(
90 impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.insert(
91 std::make_pair(vIdentifier, std::make_pair(acqRequest.m_AcqIdentifier, QUuid())));
91 std::make_pair(vIdentifier, std::make_pair(acqRequest.m_AcqIdentifier, QUuid())));
92 impl->unlock();
92 impl->unlock();
93
93
94 QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection,
94 QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection,
95 Q_ARG(QUuid, acqRequest.m_AcqIdentifier));
95 Q_ARG(QUuid, acqRequest.m_AcqIdentifier));
96 }
96 }
97
97
98 return varRequestIdCanceled;
98 return varRequestIdCanceled;
99 }
99 }
100
100
101 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
101 void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier)
102 {
102 {
103 // TODO
103 // TODO
104 }
104 }
105
105
106 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdentifier,
106 void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdentifier,
107 double progress)
107 double progress)
108 {
108 {
109 // TODO
109 // TODO
110 }
110 }
111
111
112 void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier,
112 void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier,
113 std::shared_ptr<IDataSeries> dataSeries,
113 std::shared_ptr<IDataSeries> dataSeries,
114 SqpRange dataRangeAcquired)
114 SqpRange dataRangeAcquired)
115 {
115 {
116 qCDebug(LOG_VariableAcquisitionWorker()) << tr("onVariableDataAcquired on range ")
116 qCDebug(LOG_VariableAcquisitionWorker()) << tr("onVariableDataAcquired on range ")
117 << acqIdentifier << dataRangeAcquired;
117 << acqIdentifier << dataRangeAcquired;
118 impl->lockWrite();
118 impl->lockWrite();
119 auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
119 auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
120 if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
120 if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
121 // Store the result
121 // Store the result
122 auto dataPacket = AcquisitionDataPacket{};
122 auto dataPacket = AcquisitionDataPacket{};
123 dataPacket.m_Range = dataRangeAcquired;
123 dataPacket.m_Range = dataRangeAcquired;
124 dataPacket.m_DateSeries = dataSeries;
124 dataPacket.m_DateSeries = dataSeries;
125
125
126 auto aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier);
126 auto aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier);
127 if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) {
127 if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) {
128 // A current request result already exists, we can update it
128 // A current request result already exists, we can update it
129 aIdToADPVit->second.push_back(dataPacket);
129 aIdToADPVit->second.push_back(dataPacket);
130 }
130 }
131 else {
131 else {
132 // First request result for the variable, it must be stored
132 // First request result for the variable, it must be stored
133 impl->m_AcqIdentifierToAcqDataPacketVectorMap.insert(
133 impl->m_AcqIdentifierToAcqDataPacketVectorMap.insert(
134 std::make_pair(acqIdentifier, QVector<AcquisitionDataPacket>() << dataPacket));
134 std::make_pair(acqIdentifier, QVector<AcquisitionDataPacket>() << dataPacket));
135 }
135 }
136
136
137
137
138 // Decrement the counter of the request
138 // Decrement the counter of the request
139 auto &acqRequest = aIdToARit->second;
139 auto &acqRequest = aIdToARit->second;
140 acqRequest.m_Size = acqRequest.m_Size - 1;
140 acqRequest.m_Size = acqRequest.m_Size - 1;
141
141
142 // if the counter is 0, we can return data then run the next request if it exists and
142 // if the counter is 0, we can return data then run the next request if it exists and
143 // removed the finished request
143 // removed the finished request
144 if (acqRequest.m_Size == 0) {
144 if (acqRequest.m_Size == 0) {
145 // Return the data
145 // Return the data
146 aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier);
146 aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier);
147 if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) {
147 if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) {
148 emit dataProvided(acqRequest.m_vIdentifier, acqRequest.m_RangeRequested,
148 emit dataProvided(acqRequest.m_vIdentifier, acqRequest.m_RangeRequested,
149 acqRequest.m_CacheRangeRequested, aIdToADPVit->second);
149 acqRequest.m_CacheRangeRequested, aIdToADPVit->second);
150 }
150 }
151
151
152 // Execute the next one
152 // Execute the next one
153 auto it
153 auto it
154 = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(acqRequest.m_vIdentifier);
154 = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(acqRequest.m_vIdentifier);
155
155
156 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
156 if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
157 if (it->second.second.isNull()) {
157 if (it->second.second.isNull()) {
158 // There is no next request, we can remove the variable request
158 // There is no next request, we can remove the variable request
159 impl->removeVariableRequest(acqRequest.m_vIdentifier);
159 impl->removeVariableRequest(acqRequest.m_vIdentifier);
160 }
160 }
161 else {
161 else {
162 auto acqIdentifierToRemove = it->second.first;
162 auto acqIdentifierToRemove = it->second.first;
163 // Move the next request to the current request
163 // Move the next request to the current request
164 it->second.first = it->second.second;
164 it->second.first = it->second.second;
165 it->second.second = QUuid();
165 it->second.second = QUuid();
166 // Remove AcquisitionRequest and results;
166 // Remove AcquisitionRequest and results;
167 impl->m_AcqIdentifierToAcqRequestMap.erase(acqIdentifierToRemove);
167 impl->m_AcqIdentifierToAcqRequestMap.erase(acqIdentifierToRemove);
168 impl->m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqIdentifierToRemove);
168 impl->m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqIdentifierToRemove);
169 // Execute the current request
169 // Execute the current request
170 QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection,
170 QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection,
171 Q_ARG(QUuid, it->second.first));
171 Q_ARG(QUuid, it->second.first));
172 }
172 }
173 }
173 }
174 else {
174 else {
175 qCCritical(LOG_VariableAcquisitionWorker())
175 qCCritical(LOG_VariableAcquisitionWorker())
176 << tr("Impossible to execute the acquisition on an unfound variable ");
176 << tr("Impossible to execute the acquisition on an unfound variable ");
177 }
177 }
178 }
178 }
179 }
179 }
180 else {
180 else {
181 qCCritical(LOG_VariableAcquisitionWorker())
181 qCCritical(LOG_VariableAcquisitionWorker())
182 << tr("Impossible to retrieve AcquisitionRequest for the incoming data");
182 << tr("Impossible to retrieve AcquisitionRequest for the incoming data");
183 }
183 }
184 impl->unlock();
184 impl->unlock();
185 }
185 }
186
186
187 void VariableAcquisitionWorker::onExecuteRequest(QUuid acqIdentifier)
188 {
189 qCDebug(LOG_VariableAcquisitionWorker()) << tr("onExecuteRequest") << QThread::currentThread();
190 impl->lockRead();
191 auto it = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
192 if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
193 auto request = it->second;
194 impl->unlock();
195 request.m_Provider->requestDataLoading(acqIdentifier, request.m_DataProviderParameters);
196 }
197 else {
198 impl->unlock();
199 // TODO log no acqIdentifier recognized
200 }
201 }
202
203 void VariableAcquisitionWorker::initialize()
187 void VariableAcquisitionWorker::initialize()
204 {
188 {
205 qCDebug(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker init")
189 qCDebug(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker init")
206 << QThread::currentThread();
190 << QThread::currentThread();
207 impl->m_WorkingMutex.lock();
191 impl->m_WorkingMutex.lock();
208 qCDebug(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker init END");
192 qCDebug(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker init END");
209 }
193 }
210
194
211 void VariableAcquisitionWorker::finalize()
195 void VariableAcquisitionWorker::finalize()
212 {
196 {
213 impl->m_WorkingMutex.unlock();
197 impl->m_WorkingMutex.unlock();
214 }
198 }
215
199
216 void VariableAcquisitionWorker::waitForFinish()
200 void VariableAcquisitionWorker::waitForFinish()
217 {
201 {
218 QMutexLocker locker{&impl->m_WorkingMutex};
202 QMutexLocker locker{&impl->m_WorkingMutex};
219 }
203 }
220
204
221 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeVariableRequest(
205 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeVariableRequest(
222 QUuid vIdentifier)
206 QUuid vIdentifier)
223 {
207 {
224 lockWrite();
208 lockWrite();
225 auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
209 auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
226
210
227 if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
211 if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
228 // A current request already exists, we can replace the next one
212 // A current request already exists, we can replace the next one
229
213
230 m_AcqIdentifierToAcqRequestMap.erase(it->second.first);
214 m_AcqIdentifierToAcqRequestMap.erase(it->second.first);
231 m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.first);
215 m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.first);
232
216
233 m_AcqIdentifierToAcqRequestMap.erase(it->second.second);
217 m_AcqIdentifierToAcqRequestMap.erase(it->second.second);
234 m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.second);
218 m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.second);
235 }
219 }
236 m_VIdentifierToCurrrentAcqIdNextIdPairMap.erase(vIdentifier);
220 m_VIdentifierToCurrrentAcqIdNextIdPairMap.erase(vIdentifier);
237 unlock();
221 unlock();
238 }
222 }
223
224 void VariableAcquisitionWorker::onExecuteRequest(QUuid acqIdentifier)
225 {
226 qCDebug(LOG_VariableAcquisitionWorker()) << tr("onExecuteRequest") << QThread::currentThread();
227 impl->lockRead();
228 auto it = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier);
229 if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) {
230 auto request = it->second;
231 impl->unlock();
232 request.m_Provider->requestDataLoading(acqIdentifier, request.m_DataProviderParameters);
233 }
234 else {
235 impl->unlock();
236 // TODO log no acqIdentifier recognized
237 }
238 }
@@ -1,52 +1,39
1 # On ignore toutes les règles vera++ pour le fichier spimpl
1 # On ignore toutes les règles vera++ pour le fichier spimpl
2 Common/spimpl\.h:\d+:.*
2 Common/spimpl\.h:\d+:.*
3
3
4 # Ignore false positive relative to two class definitions in a same file
4 # Ignore false positive relative to two class definitions in a same file
5 ArrayData\.h:\d+:.*IPSIS_S01.*
6 ArrayDataIterator\.h:\d+:.*IPSIS_S01.*
5 DataSourceItem\.h:\d+:.*IPSIS_S01.*
7 DataSourceItem\.h:\d+:.*IPSIS_S01.*
6 DataSeries\.h:\d+:.*IPSIS_S01.*
8 DataSeries\.h:\d+:.*IPSIS_S01.*
7 DataSeriesIterator\.h:\d+:.*IPSIS_S01.*
9 DataSeriesIterator\.h:\d+:.*IPSIS_S01.*
8
10
9 # Ignore false positive relative to a template class
11 # Ignore false positive relative to a template class
10 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (D)
12 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (D)
11 ArrayData\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (arraydata_detail)
13 ArrayData\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (arraydata_detail)
12 ArrayData\.h:\d+:.*IPSIS_S06.*found: (D)
14 ArrayData\.h:\d+:.*IPSIS_S06.*found: (D)
13 ArrayData\.h:\d+:.*IPSIS_S06.*found: (Dim)
15 ArrayData\.h:\d+:.*IPSIS_S06.*found: (Dim)
14 DataSeries\.h:\d+:.*IPSIS_S04_METHOD.*found: LOG_DataSeries
16 DataSeries\.h:\d+:.*IPSIS_S04_METHOD.*found: LOG_DataSeries
15 DataSeries\.h:\d+:.*IPSIS_S04_VARIABLE.*
17 DataSeries\.h:\d+:.*IPSIS_S04_VARIABLE.*
16 DataSeries\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (dataseries_detail)
18 DataSeries\.h:\d+:.*IPSIS_S04_NAMESPACE.*found: (dataseries_detail)
17
19
18 # Ignore false positive relative to iterators
20 # Ignore false positive relative to iterators
19 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (forward_iterator_tag)
21 SqpIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (forward_iterator_tag)
20 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (IteratorValue)
22 SqpIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (T)
21 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (ptrdiff_t)
23 SqpIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (ptrdiff_t)
22 ArrayData\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (value_type)
24 SqpIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (value_type)
23 ArrayData\.h:\d+:.*IPSIS_S05.*
25 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
24 ArrayData\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
26 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
25 ArrayData\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
27 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (value_type)
26 ArrayData\.h:\d+:.*IPSIS_S06.*found: (value_type)
28 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (T)
27 ArrayData\.h:\d+:.*IPSIS_S06.*found: (IteratorValue)
29 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (difference_type)
28 ArrayData\.h:\d+:.*IPSIS_S06.*found: (difference_type)
30 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
29 ArrayData\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
31 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (pointer)
30 ArrayData\.h:\d+:.*IPSIS_S06.*found: (pointer)
32 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (reference)
31 ArrayData\.h:\d+:.*IPSIS_S06.*found: (reference)
33 SqpIterator\.h:\d+:.*IPSIS_S06.*found: (value_type)
32 ArrayData\.h:\d+:.*IPSIS_S06.*found: (value_type)
33 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (forward_iterator_tag)
34 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (DataSeriesIteratorValue)
35 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (ptrdiff_t)
36 DataSeriesIterator\.h:\d+:.*IPSIS_S04_VARIABLE.*found: (value_type)
37 DataSeriesIterator\.h:\d+:.*IPSIS_S05.*
38 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (iterator_category)
39 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (forward_iterator_tag)
40 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (value_type)
41 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (DataSeriesIteratorValue)
42 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (difference_type)
43 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (ptrdiff_t)
44 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (pointer)
45 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (reference)
46 DataSeriesIterator\.h:\d+:.*IPSIS_S06.*found: (value_type)
47
34
48 # Ignore false positive relative to an alias
35 # Ignore false positive relative to an alias
49 DataSourceItemAction\.h:\d+:.*IPSIS_S06.*found: (ExecuteFunction)
36 DataSourceItemAction\.h:\d+:.*IPSIS_S06.*found: (ExecuteFunction)
50
37
51 # Ignore false positive relative to unnamed namespace
38 # Ignore false positive relative to unnamed namespace
52 VariableController\.cpp:\d+:.*IPSIS_F13.*
39 VariableController\.cpp:\d+:.*IPSIS_F13.*
@@ -1,56 +1,55
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
3
3
4 #include "Visualization/IVisualizationWidget.h"
4 #include "Visualization/IVisualizationWidget.h"
5
5
6 #include <QLoggingCategory>
6 #include <QLoggingCategory>
7 #include <QWidget>
7 #include <QWidget>
8
8
9 #include <memory>
9 #include <memory>
10
10
11 #include <Common/spimpl.h>
11 #include <Common/spimpl.h>
12
12
13 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationZoneWidget)
13 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationZoneWidget)
14
14
15 namespace Ui {
15 namespace Ui {
16 class VisualizationZoneWidget;
16 class VisualizationZoneWidget;
17 } // Ui
17 } // Ui
18
18
19 class Variable;
19 class Variable;
20 class VisualizationGraphWidget;
20 class VisualizationGraphWidget;
21
21
22 class VisualizationZoneWidget : public QWidget, public IVisualizationWidget {
22 class VisualizationZoneWidget : public QWidget, public IVisualizationWidget {
23 Q_OBJECT
23 Q_OBJECT
24
24
25 public:
25 public:
26 explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0);
26 explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0);
27 virtual ~VisualizationZoneWidget();
27 virtual ~VisualizationZoneWidget();
28
28
29 /// Add a graph widget
29 /// Add a graph widget
30 void addGraph(VisualizationGraphWidget *graphWidget);
30 void addGraph(VisualizationGraphWidget *graphWidget);
31
31
32 /**
32 /**
33 * Creates a graph using a variable. The variable will be displayed in the new graph.
33 * Creates a graph using a variable. The variable will be displayed in the new graph.
34 * @param variable the variable for which to create the graph
34 * @param variable the variable for which to create the graph
35 * @return the pointer to the created graph
35 * @return the pointer to the created graph
36 */
36 */
37 VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable);
37 VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable);
38
38
39 // IVisualizationWidget interface
39 // IVisualizationWidget interface
40 void accept(IVisualizationWidgetVisitor *visitor) override;
40 void accept(IVisualizationWidgetVisitor *visitor) override;
41 bool canDrop(const Variable &variable) const override;
41 bool canDrop(const Variable &variable) const override;
42 bool contains(const Variable &variable) const override;
42 bool contains(const Variable &variable) const override;
43 QString name() const override;
43 QString name() const override;
44
44
45
46 private slots:
47 void onVariableAdded(std::shared_ptr<Variable> variable);
48
49 private:
45 private:
50 Ui::VisualizationZoneWidget *ui;
46 Ui::VisualizationZoneWidget *ui;
51
47
52 class VisualizationZoneWidgetPrivate;
48 class VisualizationZoneWidgetPrivate;
53 spimpl::unique_impl_ptr<VisualizationZoneWidgetPrivate> impl;
49 spimpl::unique_impl_ptr<VisualizationZoneWidgetPrivate> impl;
50
51 private slots:
52 void onVariableAdded(std::shared_ptr<Variable> variable);
54 };
53 };
55
54
56 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
55 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
General Comments 0
You need to be logged in to leave comments. Login now