Auto status change to "Under Review"
@@ -0,0 +1,28 | |||
|
1 | #ifndef SCIQLOP_VARIABLEREQUEST_H | |
|
2 | #define SCIQLOP_VARIABLEREQUEST_H | |
|
3 | ||
|
4 | #include <QObject> | |
|
5 | ||
|
6 | #include <QUuid> | |
|
7 | ||
|
8 | #include <Common/MetaTypes.h> | |
|
9 | #include <Data/IDataSeries.h> | |
|
10 | #include <Data/SqpRange.h> | |
|
11 | ||
|
12 | #include <memory> | |
|
13 | ||
|
14 | /** | |
|
15 | * @brief The VariableRequest struct holds the information of an acquisition request | |
|
16 | */ | |
|
17 | struct VariableRequest { | |
|
18 | VariableRequest() { m_CanUpdate = false; } | |
|
19 | ||
|
20 | SqpRange m_RangeRequested; | |
|
21 | SqpRange m_CacheRangeRequested; | |
|
22 | std::shared_ptr<IDataSeries> m_DataSeries; | |
|
23 | bool m_CanUpdate; | |
|
24 | }; | |
|
25 | ||
|
26 | SCIQLOP_REGISTER_META_TYPE(VARIABLEREQUEST_REGISTRY, VariableRequest) | |
|
27 | ||
|
28 | #endif // SCIQLOP_VARIABLEREQUEST_H |
@@ -1,38 +1,38 | |||
|
1 | 1 | #ifndef SCIQLOP_ACQUISITIONREQUEST_H |
|
2 | 2 | #define SCIQLOP_ACQUISITIONREQUEST_H |
|
3 | 3 | |
|
4 | 4 | #include <QObject> |
|
5 | 5 | |
|
6 | 6 | #include <QUuid> |
|
7 | 7 | |
|
8 | 8 | #include <Common/DateUtils.h> |
|
9 | 9 | #include <Common/MetaTypes.h> |
|
10 | 10 | #include <Data/DataProviderParameters.h> |
|
11 | 11 | #include <Data/IDataProvider.h> |
|
12 | 12 | #include <Data/SqpRange.h> |
|
13 | 13 | |
|
14 | 14 | #include <memory> |
|
15 | 15 | |
|
16 | 16 | /** |
|
17 |
* @brief The AcquisitionRequest struct holds the information of an |
|
|
17 | * @brief The AcquisitionRequest struct holds the information of an variable request | |
|
18 | 18 | */ |
|
19 | 19 | struct AcquisitionRequest { |
|
20 | 20 | AcquisitionRequest() |
|
21 | 21 | { |
|
22 | ||
|
23 | 22 | m_AcqIdentifier = QUuid::createUuid(); |
|
24 | 23 | m_Size = 0; |
|
25 | 24 | } |
|
26 | 25 | |
|
26 | QUuid m_VarRequestId; | |
|
27 | 27 | QUuid m_AcqIdentifier; |
|
28 | 28 | QUuid m_vIdentifier; |
|
29 | 29 | DataProviderParameters m_DataProviderParameters; |
|
30 | 30 | SqpRange m_RangeRequested; |
|
31 | 31 | SqpRange m_CacheRangeRequested; |
|
32 | 32 | int m_Size; |
|
33 | 33 | std::shared_ptr<IDataProvider> m_Provider; |
|
34 | 34 | }; |
|
35 | 35 | |
|
36 | 36 | SCIQLOP_REGISTER_META_TYPE(ACQUISITIONREQUEST_REGISTRY, AcquisitionRequest) |
|
37 | 37 | |
|
38 | 38 | #endif // SCIQLOP_ACQUISITIONREQUEST_H |
@@ -1,61 +1,61 | |||
|
1 | 1 | #ifndef SCIQLOP_VARIABLEACQUISITIONWORKER_H |
|
2 | 2 | #define SCIQLOP_VARIABLEACQUISITIONWORKER_H |
|
3 | 3 | |
|
4 | 4 | #include "CoreGlobal.h" |
|
5 | 5 | |
|
6 | 6 | #include <Data/DataProviderParameters.h> |
|
7 | 7 | #include <QLoggingCategory> |
|
8 | 8 | #include <QObject> |
|
9 | 9 | #include <QUuid> |
|
10 | 10 | |
|
11 | 11 | #include <Data/AcquisitionDataPacket.h> |
|
12 | 12 | #include <Data/IDataSeries.h> |
|
13 | 13 | #include <Data/SqpRange.h> |
|
14 | 14 | |
|
15 | 15 | #include <QLoggingCategory> |
|
16 | 16 | |
|
17 | 17 | #include <Common/spimpl.h> |
|
18 | 18 | |
|
19 | 19 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableAcquisitionWorker) |
|
20 | 20 | |
|
21 | 21 | class Variable; |
|
22 | 22 | class IDataProvider; |
|
23 | 23 | |
|
24 | 24 | /// This class aims to handle all acquisition request |
|
25 | 25 | class SCIQLOP_CORE_EXPORT VariableAcquisitionWorker : public QObject { |
|
26 | 26 | Q_OBJECT |
|
27 | 27 | public: |
|
28 | 28 | explicit VariableAcquisitionWorker(QObject *parent = 0); |
|
29 | 29 | virtual ~VariableAcquisitionWorker(); |
|
30 | 30 | |
|
31 |
|
|
|
31 | QUuid pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, SqpRange rangeRequested, | |
|
32 | 32 | SqpRange cacheRangeRequested, DataProviderParameters parameters, |
|
33 | 33 | std::shared_ptr<IDataProvider> provider); |
|
34 | 34 | |
|
35 | 35 | void abortProgressRequested(QUuid vIdentifier); |
|
36 | 36 | |
|
37 | 37 | void initialize(); |
|
38 | 38 | void finalize(); |
|
39 | 39 | signals: |
|
40 | 40 | void dataProvided(QUuid vIdentifier, const SqpRange &rangeRequested, |
|
41 | 41 | const SqpRange &cacheRangeRequested, |
|
42 | 42 | QVector<AcquisitionDataPacket> dataAcquired); |
|
43 | 43 | |
|
44 | 44 | void variableRequestInProgress(QUuid vIdentifier, double progress); |
|
45 | 45 | |
|
46 | 46 | public slots: |
|
47 | 47 | void onVariableDataAcquired(QUuid acqIdentifier, std::shared_ptr<IDataSeries> dataSeries, |
|
48 | 48 | SqpRange dataRangeAcquired); |
|
49 | 49 | void onVariableRetrieveDataInProgress(QUuid acqIdentifier, double progress); |
|
50 | 50 | |
|
51 | 51 | private slots: |
|
52 | 52 | void onExecuteRequest(QUuid acqIdentifier); |
|
53 | 53 | |
|
54 | 54 | private: |
|
55 | 55 | void waitForFinish(); |
|
56 | 56 | |
|
57 | 57 | class VariableAcquisitionWorkerPrivate; |
|
58 | 58 | spimpl::unique_impl_ptr<VariableAcquisitionWorkerPrivate> impl; |
|
59 | 59 | }; |
|
60 | 60 | |
|
61 | 61 | #endif // SCIQLOP_VARIABLEACQUISITIONWORKER_H |
@@ -1,40 +1,40 | |||
|
1 | 1 | #ifndef SCIQLOP_VARIABLECACHESTRATEGY_H |
|
2 | 2 | #define SCIQLOP_VARIABLECACHESTRATEGY_H |
|
3 | 3 | |
|
4 | 4 | #include "CoreGlobal.h" |
|
5 | 5 | |
|
6 | 6 | #include <QLoggingCategory> |
|
7 | 7 | #include <QObject> |
|
8 | 8 | |
|
9 | 9 | #include <Data/SqpRange.h> |
|
10 | 10 | |
|
11 | 11 | #include <QLoggingCategory> |
|
12 | 12 | |
|
13 | 13 | #include <Common/spimpl.h> |
|
14 | 14 | #include <utility> |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheStrategy) |
|
18 | 18 | |
|
19 | 19 | class Variable; |
|
20 | 20 | |
|
21 | 21 | /** |
|
22 | 22 | * Possible types of zoom operation |
|
23 | 23 | */ |
|
24 | 24 | enum class CacheStrategy { FixedTolerance, TwoThreashold }; |
|
25 | 25 | |
|
26 | 26 | /// This class aims to hande the cache strategy. |
|
27 | 27 | class SCIQLOP_CORE_EXPORT VariableCacheStrategy : public QObject { |
|
28 | 28 | Q_OBJECT |
|
29 | 29 | public: |
|
30 | 30 | explicit VariableCacheStrategy(QObject *parent = 0); |
|
31 | 31 | |
|
32 |
std::pair<SqpRange, SqpRange> compute |
|
|
32 | std::pair<SqpRange, SqpRange> computeStrategyRanges(const SqpRange &vRange, | |
|
33 | 33 | const SqpRange &rangeRequested); |
|
34 | 34 | |
|
35 | 35 | private: |
|
36 | 36 | class VariableCacheStrategyPrivate; |
|
37 | 37 | spimpl::unique_impl_ptr<VariableCacheStrategyPrivate> impl; |
|
38 | 38 | }; |
|
39 | 39 | |
|
40 | 40 | #endif // SCIQLOP_VARIABLECACHESTRATEGY_H |
@@ -1,225 +1,238 | |||
|
1 | 1 | #include "Variable/VariableAcquisitionWorker.h" |
|
2 | 2 | |
|
3 | 3 | #include "Variable/Variable.h" |
|
4 | 4 | |
|
5 | 5 | #include <Data/AcquisitionRequest.h> |
|
6 | 6 | #include <Data/SqpRange.h> |
|
7 | 7 | |
|
8 | 8 | #include <unordered_map> |
|
9 | 9 | #include <utility> |
|
10 | 10 | |
|
11 | 11 | #include <QMutex> |
|
12 | 12 | #include <QReadWriteLock> |
|
13 | 13 | #include <QThread> |
|
14 | 14 | |
|
15 | 15 | Q_LOGGING_CATEGORY(LOG_VariableAcquisitionWorker, "VariableAcquisitionWorker") |
|
16 | 16 | |
|
17 | 17 | struct VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate { |
|
18 | 18 | |
|
19 | 19 | explicit VariableAcquisitionWorkerPrivate() : m_Lock{QReadWriteLock::Recursive} {} |
|
20 | 20 | |
|
21 | 21 | void lockRead() { m_Lock.lockForRead(); } |
|
22 | 22 | void lockWrite() { m_Lock.lockForWrite(); } |
|
23 | 23 | void unlock() { m_Lock.unlock(); } |
|
24 | 24 | |
|
25 | 25 | void removeVariableRequest(QUuid vIdentifier); |
|
26 | 26 | |
|
27 | 27 | QMutex m_WorkingMutex; |
|
28 | 28 | QReadWriteLock m_Lock; |
|
29 | 29 | |
|
30 | 30 | std::map<QUuid, QVector<AcquisitionDataPacket> > m_AcqIdentifierToAcqDataPacketVectorMap; |
|
31 | 31 | std::map<QUuid, AcquisitionRequest> m_AcqIdentifierToAcqRequestMap; |
|
32 | 32 | std::map<QUuid, std::pair<QUuid, QUuid> > m_VIdentifierToCurrrentAcqIdNextIdPairMap; |
|
33 | 33 | }; |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | VariableAcquisitionWorker::VariableAcquisitionWorker(QObject *parent) |
|
37 | 37 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableAcquisitionWorkerPrivate>()} |
|
38 | 38 | { |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | VariableAcquisitionWorker::~VariableAcquisitionWorker() |
|
42 | 42 | { |
|
43 | 43 | qCInfo(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker destruction") |
|
44 | 44 | << QThread::currentThread(); |
|
45 | 45 | this->waitForFinish(); |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | |
|
49 |
|
|
|
49 | QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, | |
|
50 | SqpRange rangeRequested, | |
|
50 | 51 | SqpRange cacheRangeRequested, |
|
51 | 52 | DataProviderParameters parameters, |
|
52 | 53 | std::shared_ptr<IDataProvider> provider) |
|
53 | 54 | { |
|
54 |
qC |
|
|
55 | qCDebug(LOG_VariableAcquisitionWorker()) | |
|
55 | 56 | << tr("TORM VariableAcquisitionWorker::pushVariableRequest ") << cacheRangeRequested; |
|
57 | auto varRequestIdCanceled = QUuid(); | |
|
56 | 58 | |
|
57 | 59 | // Request creation |
|
58 | 60 | auto acqRequest = AcquisitionRequest{}; |
|
61 | acqRequest.m_VarRequestId = varRequestId; | |
|
59 | 62 | acqRequest.m_vIdentifier = vIdentifier; |
|
60 | 63 | acqRequest.m_DataProviderParameters = parameters; |
|
61 | 64 | acqRequest.m_RangeRequested = rangeRequested; |
|
62 | 65 | acqRequest.m_CacheRangeRequested = cacheRangeRequested; |
|
63 | 66 | acqRequest.m_Size = parameters.m_Times.size(); |
|
64 | 67 | acqRequest.m_Provider = provider; |
|
65 | 68 | |
|
69 | ||
|
66 | 70 | // Register request |
|
67 | 71 | impl->lockWrite(); |
|
68 | 72 | impl->m_AcqIdentifierToAcqRequestMap.insert( |
|
69 | 73 | std::make_pair(acqRequest.m_AcqIdentifier, acqRequest)); |
|
70 | 74 | |
|
71 | 75 | auto it = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier); |
|
72 | 76 | if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) { |
|
73 | 77 | // A current request already exists, we can replace the next one |
|
78 | auto nextAcqId = it->second.second; | |
|
79 | auto acqIdentifierToAcqRequestMapIt = impl->m_AcqIdentifierToAcqRequestMap.find(nextAcqId); | |
|
80 | if (acqIdentifierToAcqRequestMapIt != impl->m_AcqIdentifierToAcqRequestMap.cend()) { | |
|
81 | auto request = acqIdentifierToAcqRequestMapIt->second; | |
|
82 | varRequestIdCanceled = request.m_VarRequestId; | |
|
83 | } | |
|
84 | ||
|
74 | 85 | it->second.second = acqRequest.m_AcqIdentifier; |
|
75 | 86 | impl->unlock(); |
|
76 | 87 | } |
|
77 | 88 | else { |
|
78 | 89 | // First request for the variable, it must be stored and executed |
|
79 | 90 | impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.insert( |
|
80 | 91 | std::make_pair(vIdentifier, std::make_pair(acqRequest.m_AcqIdentifier, QUuid()))); |
|
81 | 92 | impl->unlock(); |
|
82 | 93 | |
|
83 | 94 | QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection, |
|
84 | 95 | Q_ARG(QUuid, acqRequest.m_AcqIdentifier)); |
|
85 | 96 | } |
|
97 | ||
|
98 | return varRequestIdCanceled; | |
|
86 | 99 | } |
|
87 | 100 | |
|
88 | 101 | void VariableAcquisitionWorker::abortProgressRequested(QUuid vIdentifier) |
|
89 | 102 | { |
|
90 | 103 | // TODO |
|
91 | 104 | } |
|
92 | 105 | |
|
93 | 106 | void VariableAcquisitionWorker::onVariableRetrieveDataInProgress(QUuid acqIdentifier, |
|
94 | 107 | double progress) |
|
95 | 108 | { |
|
96 | 109 | // TODO |
|
97 | 110 | } |
|
98 | 111 | |
|
99 | 112 | void VariableAcquisitionWorker::onVariableDataAcquired(QUuid acqIdentifier, |
|
100 | 113 | std::shared_ptr<IDataSeries> dataSeries, |
|
101 | 114 | SqpRange dataRangeAcquired) |
|
102 | 115 | { |
|
103 | 116 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("onVariableDataAcquired on range ") |
|
104 | 117 | << acqIdentifier << dataRangeAcquired; |
|
105 | 118 | impl->lockWrite(); |
|
106 | 119 | auto aIdToARit = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier); |
|
107 | 120 | if (aIdToARit != impl->m_AcqIdentifierToAcqRequestMap.cend()) { |
|
108 | 121 | // Store the result |
|
109 | 122 | auto dataPacket = AcquisitionDataPacket{}; |
|
110 | 123 | dataPacket.m_Range = dataRangeAcquired; |
|
111 | 124 | dataPacket.m_DateSeries = dataSeries; |
|
112 | 125 | |
|
113 | 126 | auto aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier); |
|
114 | 127 | if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) { |
|
115 | 128 | // A current request result already exists, we can update it |
|
116 | 129 | aIdToADPVit->second.push_back(dataPacket); |
|
117 | 130 | } |
|
118 | 131 | else { |
|
119 | 132 | // First request result for the variable, it must be stored |
|
120 | 133 | impl->m_AcqIdentifierToAcqDataPacketVectorMap.insert( |
|
121 | 134 | std::make_pair(acqIdentifier, QVector<AcquisitionDataPacket>() << dataPacket)); |
|
122 | 135 | } |
|
123 | 136 | |
|
124 | 137 | |
|
125 | 138 | // Decrement the counter of the request |
|
126 | 139 | auto &acqRequest = aIdToARit->second; |
|
127 | 140 | acqRequest.m_Size = acqRequest.m_Size - 1; |
|
128 | 141 | |
|
129 | 142 | // if the counter is 0, we can return data then run the next request if it exists and |
|
130 | 143 | // removed the finished request |
|
131 | 144 | if (acqRequest.m_Size == 0) { |
|
132 | 145 | // Return the data |
|
133 | 146 | aIdToADPVit = impl->m_AcqIdentifierToAcqDataPacketVectorMap.find(acqIdentifier); |
|
134 | 147 | if (aIdToADPVit != impl->m_AcqIdentifierToAcqDataPacketVectorMap.cend()) { |
|
135 | 148 | emit dataProvided(acqRequest.m_vIdentifier, acqRequest.m_RangeRequested, |
|
136 | 149 | acqRequest.m_CacheRangeRequested, aIdToADPVit->second); |
|
137 | 150 | } |
|
138 | 151 | |
|
139 | 152 | // Execute the next one |
|
140 | 153 | auto it |
|
141 | 154 | = impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(acqRequest.m_vIdentifier); |
|
142 | 155 | |
|
143 | 156 | if (it != impl->m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) { |
|
144 | 157 | if (it->second.second.isNull()) { |
|
145 | 158 | // There is no next request, we can remove the variable request |
|
146 | 159 | impl->removeVariableRequest(acqRequest.m_vIdentifier); |
|
147 | 160 | } |
|
148 | 161 | else { |
|
149 | 162 | auto acqIdentifierToRemove = it->second.first; |
|
150 | 163 | // Move the next request to the current request |
|
151 | 164 | it->second.first = it->second.second; |
|
152 | 165 | it->second.second = QUuid(); |
|
153 | 166 | // Remove AcquisitionRequest and results; |
|
154 | 167 | impl->m_AcqIdentifierToAcqRequestMap.erase(acqIdentifierToRemove); |
|
155 | 168 | impl->m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqIdentifierToRemove); |
|
156 | 169 | // Execute the current request |
|
157 | 170 | QMetaObject::invokeMethod(this, "onExecuteRequest", Qt::QueuedConnection, |
|
158 | 171 | Q_ARG(QUuid, it->second.first)); |
|
159 | 172 | } |
|
160 | 173 | } |
|
161 | 174 | else { |
|
162 | 175 | qCCritical(LOG_VariableAcquisitionWorker()) |
|
163 | 176 | << tr("Impossible to execute the acquisition on an unfound variable "); |
|
164 | 177 | } |
|
165 | 178 | } |
|
166 | 179 | } |
|
167 | 180 | else { |
|
168 | 181 | qCCritical(LOG_VariableAcquisitionWorker()) |
|
169 | 182 | << tr("Impossible to retrieve AcquisitionRequest for the incoming data"); |
|
170 | 183 | } |
|
171 | 184 | impl->unlock(); |
|
172 | 185 | } |
|
173 | 186 | |
|
174 | 187 | void VariableAcquisitionWorker::onExecuteRequest(QUuid acqIdentifier) |
|
175 | 188 | { |
|
176 |
qC |
|
|
189 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("onExecuteRequest") << QThread::currentThread(); | |
|
177 | 190 | impl->lockRead(); |
|
178 | 191 | auto it = impl->m_AcqIdentifierToAcqRequestMap.find(acqIdentifier); |
|
179 | 192 | if (it != impl->m_AcqIdentifierToAcqRequestMap.cend()) { |
|
180 | 193 | auto request = it->second; |
|
181 | 194 | impl->unlock(); |
|
182 | 195 | request.m_Provider->requestDataLoading(acqIdentifier, request.m_DataProviderParameters); |
|
183 | 196 | } |
|
184 | 197 | else { |
|
185 | 198 | impl->unlock(); |
|
186 | 199 | // TODO log no acqIdentifier recognized |
|
187 | 200 | } |
|
188 | 201 | } |
|
189 | 202 | |
|
190 | 203 | void VariableAcquisitionWorker::initialize() |
|
191 | 204 | { |
|
192 | 205 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker init") |
|
193 | 206 | << QThread::currentThread(); |
|
194 | 207 | impl->m_WorkingMutex.lock(); |
|
195 | 208 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("VariableAcquisitionWorker init END"); |
|
196 | 209 | } |
|
197 | 210 | |
|
198 | 211 | void VariableAcquisitionWorker::finalize() |
|
199 | 212 | { |
|
200 | 213 | impl->m_WorkingMutex.unlock(); |
|
201 | 214 | } |
|
202 | 215 | |
|
203 | 216 | void VariableAcquisitionWorker::waitForFinish() |
|
204 | 217 | { |
|
205 | 218 | QMutexLocker locker{&impl->m_WorkingMutex}; |
|
206 | 219 | } |
|
207 | 220 | |
|
208 | 221 | void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeVariableRequest( |
|
209 | 222 | QUuid vIdentifier) |
|
210 | 223 | { |
|
211 | 224 | lockWrite(); |
|
212 | 225 | auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier); |
|
213 | 226 | |
|
214 | 227 | if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) { |
|
215 | 228 | // A current request already exists, we can replace the next one |
|
216 | 229 | |
|
217 | 230 | m_AcqIdentifierToAcqRequestMap.erase(it->second.first); |
|
218 | 231 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.first); |
|
219 | 232 | |
|
220 | 233 | m_AcqIdentifierToAcqRequestMap.erase(it->second.second); |
|
221 | 234 | m_AcqIdentifierToAcqDataPacketVectorMap.erase(it->second.second); |
|
222 | 235 | } |
|
223 | 236 | m_VIdentifierToCurrrentAcqIdNextIdPairMap.erase(vIdentifier); |
|
224 | 237 | unlock(); |
|
225 | 238 | } |
@@ -1,52 +1,52 | |||
|
1 | 1 | #include "Variable/VariableCacheStrategy.h" |
|
2 | 2 | |
|
3 | 3 | #include "Settings/SqpSettingsDefs.h" |
|
4 | 4 | |
|
5 | 5 | #include "Variable/Variable.h" |
|
6 | 6 | #include "Variable/VariableController.h" |
|
7 | 7 | |
|
8 | 8 | Q_LOGGING_CATEGORY(LOG_VariableCacheStrategy, "VariableCacheStrategy") |
|
9 | 9 | |
|
10 | 10 | struct VariableCacheStrategy::VariableCacheStrategyPrivate { |
|
11 | 11 | VariableCacheStrategyPrivate() : m_CacheStrategy{CacheStrategy::FixedTolerance} {} |
|
12 | 12 | |
|
13 | 13 | CacheStrategy m_CacheStrategy; |
|
14 | 14 | }; |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | VariableCacheStrategy::VariableCacheStrategy(QObject *parent) |
|
18 | 18 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableCacheStrategyPrivate>()} |
|
19 | 19 | { |
|
20 | 20 | } |
|
21 | 21 | |
|
22 | 22 | std::pair<SqpRange, SqpRange> |
|
23 |
VariableCacheStrategy::compute |
|
|
23 | VariableCacheStrategy::computeStrategyRanges(const SqpRange &vRange, const SqpRange &rangeRequested) | |
|
24 | 24 | { |
|
25 | 25 | |
|
26 | 26 | auto varRanges = std::pair<SqpRange, SqpRange>{}; |
|
27 | 27 | |
|
28 | 28 | auto toleranceFactor = SqpSettings::toleranceValue(GENERAL_TOLERANCE_AT_UPDATE_KEY, |
|
29 | 29 | GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE); |
|
30 | 30 | auto tolerance = toleranceFactor * (rangeRequested.m_TEnd - rangeRequested.m_TStart); |
|
31 | 31 | |
|
32 | 32 | switch (impl->m_CacheStrategy) { |
|
33 | 33 | case CacheStrategy::FixedTolerance: { |
|
34 | 34 | varRanges.first = rangeRequested; |
|
35 | 35 | varRanges.second |
|
36 | 36 | = SqpRange{rangeRequested.m_TStart - tolerance, rangeRequested.m_TEnd + tolerance}; |
|
37 | 37 | break; |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | case CacheStrategy::TwoThreashold: { |
|
41 | 41 | // TODO Implement |
|
42 | 42 | break; |
|
43 | 43 | } |
|
44 | 44 | default: |
|
45 | 45 | qCCritical(LOG_VariableCacheStrategy()) |
|
46 | 46 | << tr("Impossible to use compute the cache range with an unknow cache strategy"); |
|
47 | 47 | // No action |
|
48 | 48 | break; |
|
49 | 49 | } |
|
50 | 50 | |
|
51 | 51 | return varRanges; |
|
52 | 52 | } |
@@ -1,552 +1,738 | |||
|
1 | 1 | #include <Variable/Variable.h> |
|
2 | 2 | #include <Variable/VariableAcquisitionWorker.h> |
|
3 | #include <Variable/VariableCacheController.h> | |
|
4 | 3 | #include <Variable/VariableCacheStrategy.h> |
|
5 | 4 | #include <Variable/VariableController.h> |
|
6 | 5 | #include <Variable/VariableModel.h> |
|
7 | 6 | #include <Variable/VariableSynchronizationGroup.h> |
|
8 | 7 | |
|
9 | 8 | #include <Data/DataProviderParameters.h> |
|
10 | 9 | #include <Data/IDataProvider.h> |
|
11 | 10 | #include <Data/IDataSeries.h> |
|
11 | #include <Data/VariableRequest.h> | |
|
12 | 12 | #include <Time/TimeController.h> |
|
13 | 13 | |
|
14 | 14 | #include <QMutex> |
|
15 | 15 | #include <QThread> |
|
16 | 16 | #include <QUuid> |
|
17 | 17 | #include <QtCore/QItemSelectionModel> |
|
18 | 18 | |
|
19 | #include <deque> | |
|
19 | 20 | #include <set> |
|
20 | 21 | #include <unordered_map> |
|
21 | 22 | |
|
22 | 23 | Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController") |
|
23 | 24 | |
|
24 | 25 | namespace { |
|
25 | 26 | |
|
26 | 27 | SqpRange computeSynchroRangeRequested(const SqpRange &varRange, const SqpRange &graphRange, |
|
27 | 28 | const SqpRange &oldGraphRange) |
|
28 | 29 | { |
|
29 | 30 | auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange); |
|
30 | 31 | |
|
31 | 32 | auto varRangeRequested = varRange; |
|
32 | 33 | switch (zoomType) { |
|
33 | 34 | case AcquisitionZoomType::ZoomIn: { |
|
34 | 35 | auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart; |
|
35 | 36 | auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd; |
|
36 | 37 | varRangeRequested.m_TStart += deltaLeft; |
|
37 | 38 | varRangeRequested.m_TEnd -= deltaRight; |
|
38 | 39 | break; |
|
39 | 40 | } |
|
40 | 41 | |
|
41 | 42 | case AcquisitionZoomType::ZoomOut: { |
|
42 | 43 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; |
|
43 | 44 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; |
|
44 | 45 | varRangeRequested.m_TStart -= deltaLeft; |
|
45 | 46 | varRangeRequested.m_TEnd += deltaRight; |
|
46 | 47 | break; |
|
47 | 48 | } |
|
48 | 49 | case AcquisitionZoomType::PanRight: { |
|
49 | 50 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; |
|
50 | 51 | varRangeRequested.m_TStart += deltaRight; |
|
51 | 52 | varRangeRequested.m_TEnd += deltaRight; |
|
52 | 53 | break; |
|
53 | 54 | } |
|
54 | 55 | case AcquisitionZoomType::PanLeft: { |
|
55 | 56 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; |
|
56 | 57 | varRangeRequested.m_TStart -= deltaLeft; |
|
57 | 58 | varRangeRequested.m_TEnd -= deltaLeft; |
|
58 | 59 | break; |
|
59 | 60 | } |
|
60 | 61 | case AcquisitionZoomType::Unknown: { |
|
61 | 62 | qCCritical(LOG_VariableController()) |
|
62 | 63 | << VariableController::tr("Impossible to synchronize: zoom type unknown"); |
|
63 | 64 | break; |
|
64 | 65 | } |
|
65 | 66 | default: |
|
66 | 67 | qCCritical(LOG_VariableController()) << VariableController::tr( |
|
67 | 68 | "Impossible to synchronize: zoom type not take into account"); |
|
68 | 69 | // No action |
|
69 | 70 | break; |
|
70 | 71 | } |
|
71 | 72 | |
|
72 | 73 | return varRangeRequested; |
|
73 | 74 | } |
|
74 | 75 | } |
|
75 | 76 | |
|
76 | 77 | struct VariableController::VariableControllerPrivate { |
|
77 | 78 | explicit VariableControllerPrivate(VariableController *parent) |
|
78 | 79 | : m_WorkingMutex{}, |
|
79 | 80 | m_VariableModel{new VariableModel{parent}}, |
|
80 | 81 | m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}}, |
|
81 | m_VariableCacheController{std::make_unique<VariableCacheController>()}, | |
|
82 | 82 | m_VariableCacheStrategy{std::make_unique<VariableCacheStrategy>()}, |
|
83 | 83 | m_VariableAcquisitionWorker{std::make_unique<VariableAcquisitionWorker>()}, |
|
84 | 84 | q{parent} |
|
85 | 85 | { |
|
86 | 86 | |
|
87 | 87 | m_VariableAcquisitionWorker->moveToThread(&m_VariableAcquisitionWorkerThread); |
|
88 | 88 | m_VariableAcquisitionWorkerThread.setObjectName("VariableAcquisitionWorkerThread"); |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | |
|
92 | 92 | virtual ~VariableControllerPrivate() |
|
93 | 93 | { |
|
94 | 94 | qCDebug(LOG_VariableController()) << tr("VariableControllerPrivate destruction"); |
|
95 | 95 | m_VariableAcquisitionWorkerThread.quit(); |
|
96 | 96 | m_VariableAcquisitionWorkerThread.wait(); |
|
97 | 97 | } |
|
98 | 98 | |
|
99 | 99 | |
|
100 |
void processRequest(std::shared_ptr<Variable> var, const SqpRange &rangeRequested |
|
|
100 | void processRequest(std::shared_ptr<Variable> var, const SqpRange &rangeRequested, | |
|
101 | QUuid varRequestId); | |
|
101 | 102 | |
|
102 | 103 | QVector<SqpRange> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable, |
|
103 | 104 | const SqpRange &dateTime); |
|
104 | 105 | |
|
105 | 106 | std::shared_ptr<Variable> findVariable(QUuid vIdentifier); |
|
106 | 107 | std::shared_ptr<IDataSeries> |
|
107 | 108 | retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector); |
|
108 | 109 | |
|
109 | 110 | void registerProvider(std::shared_ptr<IDataProvider> provider); |
|
110 | 111 | |
|
112 | void storeVariableRequest(QUuid varId, QUuid varRequestId, const VariableRequest &varRequest); | |
|
113 | QUuid acceptVariableRequest(QUuid varId, std::shared_ptr<IDataSeries> dataSeries); | |
|
114 | void updateVariableRequest(QUuid varRequestId); | |
|
115 | void cancelVariableRequest(QUuid varRequestId); | |
|
116 | ||
|
111 | 117 | QMutex m_WorkingMutex; |
|
112 | 118 | /// Variable model. The VariableController has the ownership |
|
113 | 119 | VariableModel *m_VariableModel; |
|
114 | 120 | QItemSelectionModel *m_VariableSelectionModel; |
|
115 | 121 | |
|
116 | 122 | |
|
117 | 123 | TimeController *m_TimeController{nullptr}; |
|
118 | std::unique_ptr<VariableCacheController> m_VariableCacheController; | |
|
119 | 124 | std::unique_ptr<VariableCacheStrategy> m_VariableCacheStrategy; |
|
120 | 125 | std::unique_ptr<VariableAcquisitionWorker> m_VariableAcquisitionWorker; |
|
121 | 126 | QThread m_VariableAcquisitionWorkerThread; |
|
122 | 127 | |
|
123 | 128 | std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> > |
|
124 | 129 | m_VariableToProviderMap; |
|
125 | 130 | std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap; |
|
126 | 131 | std::map<QUuid, std::shared_ptr<VariableSynchronizationGroup> > |
|
127 | 132 | m_GroupIdToVariableSynchronizationGroupMap; |
|
128 | 133 | std::map<QUuid, QUuid> m_VariableIdGroupIdMap; |
|
129 | 134 | std::set<std::shared_ptr<IDataProvider> > m_ProviderSet; |
|
130 | 135 | |
|
136 | std::map<QUuid, std::map<QUuid, VariableRequest> > m_VarRequestIdToVarIdVarRequestMap; | |
|
137 | ||
|
138 | std::map<QUuid, std::deque<QUuid> > m_VarIdToVarRequestIdQueueMap; | |
|
139 | ||
|
131 | 140 | |
|
132 | 141 | VariableController *q; |
|
133 | 142 | }; |
|
134 | 143 | |
|
135 | 144 | |
|
136 | 145 | VariableController::VariableController(QObject *parent) |
|
137 | 146 | : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)} |
|
138 | 147 | { |
|
139 | 148 | qCDebug(LOG_VariableController()) << tr("VariableController construction") |
|
140 | 149 | << QThread::currentThread(); |
|
141 | 150 | |
|
142 | 151 | connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this, |
|
143 | 152 | &VariableController::onAbortProgressRequested); |
|
144 | 153 | |
|
145 | 154 | connect(impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::dataProvided, this, |
|
146 | 155 | &VariableController::onDataProvided); |
|
147 | 156 | connect(impl->m_VariableAcquisitionWorker.get(), |
|
148 | 157 | &VariableAcquisitionWorker::variableRequestInProgress, this, |
|
149 | 158 | &VariableController::onVariableRetrieveDataInProgress); |
|
150 | 159 | |
|
151 | 160 | connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::started, |
|
152 | 161 | impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::initialize); |
|
153 | 162 | connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::finished, |
|
154 | 163 | impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::finalize); |
|
155 | 164 | |
|
156 | 165 | |
|
157 | 166 | impl->m_VariableAcquisitionWorkerThread.start(); |
|
158 | 167 | } |
|
159 | 168 | |
|
160 | 169 | VariableController::~VariableController() |
|
161 | 170 | { |
|
162 | 171 | qCDebug(LOG_VariableController()) << tr("VariableController destruction") |
|
163 | 172 | << QThread::currentThread(); |
|
164 | 173 | this->waitForFinish(); |
|
165 | 174 | } |
|
166 | 175 | |
|
167 | 176 | VariableModel *VariableController::variableModel() noexcept |
|
168 | 177 | { |
|
169 | 178 | return impl->m_VariableModel; |
|
170 | 179 | } |
|
171 | 180 | |
|
172 | 181 | QItemSelectionModel *VariableController::variableSelectionModel() noexcept |
|
173 | 182 | { |
|
174 | 183 | return impl->m_VariableSelectionModel; |
|
175 | 184 | } |
|
176 | 185 | |
|
177 | 186 | void VariableController::setTimeController(TimeController *timeController) noexcept |
|
178 | 187 | { |
|
179 | 188 | impl->m_TimeController = timeController; |
|
180 | 189 | } |
|
181 | 190 | |
|
182 | 191 | void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept |
|
183 | 192 | { |
|
184 | 193 | if (!variable) { |
|
185 | 194 | qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null"; |
|
186 | 195 | return; |
|
187 | 196 | } |
|
188 | 197 | |
|
189 | 198 | // Spreads in SciQlop that the variable will be deleted, so that potential receivers can |
|
190 | 199 | // make some treatments before the deletion |
|
191 | 200 | emit variableAboutToBeDeleted(variable); |
|
192 | 201 | |
|
193 | 202 | // Deletes identifier |
|
194 | 203 | impl->m_VariableToIdentifierMap.erase(variable); |
|
195 | 204 | |
|
196 | 205 | // Deletes provider |
|
197 | 206 | auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable); |
|
198 | 207 | qCDebug(LOG_VariableController()) |
|
199 | 208 | << tr("Number of providers deleted for variable %1: %2") |
|
200 | 209 | .arg(variable->name(), QString::number(nbProvidersDeleted)); |
|
201 | 210 | |
|
202 | // Clears cache | |
|
203 | impl->m_VariableCacheController->clear(variable); | |
|
204 | 211 | |
|
205 | 212 | // Deletes from model |
|
206 | 213 | impl->m_VariableModel->deleteVariable(variable); |
|
207 | 214 | } |
|
208 | 215 | |
|
209 | 216 | void VariableController::deleteVariables( |
|
210 | 217 | const QVector<std::shared_ptr<Variable> > &variables) noexcept |
|
211 | 218 | { |
|
212 | 219 | for (auto variable : qAsConst(variables)) { |
|
213 | 220 | deleteVariable(variable); |
|
214 | 221 | } |
|
215 | 222 | } |
|
216 | 223 | |
|
217 | 224 | void VariableController::abortProgress(std::shared_ptr<Variable> variable) |
|
218 | 225 | { |
|
219 | 226 | } |
|
220 | 227 | |
|
221 | 228 | std::shared_ptr<Variable> |
|
222 | 229 | VariableController::createVariable(const QString &name, const QVariantHash &metadata, |
|
223 | 230 | std::shared_ptr<IDataProvider> provider) noexcept |
|
224 | 231 | { |
|
225 | 232 | if (!impl->m_TimeController) { |
|
226 | 233 | qCCritical(LOG_VariableController()) |
|
227 | 234 | << tr("Impossible to create variable: The time controller is null"); |
|
228 | 235 | return nullptr; |
|
229 | 236 | } |
|
230 | 237 | |
|
231 | 238 | auto range = impl->m_TimeController->dateTime(); |
|
232 | 239 | |
|
233 | 240 | if (auto newVariable = impl->m_VariableModel->createVariable(name, range, metadata)) { |
|
234 | 241 | auto identifier = QUuid::createUuid(); |
|
235 | 242 | |
|
236 | 243 | // store the provider |
|
237 | 244 | impl->registerProvider(provider); |
|
238 | 245 | |
|
239 | 246 | // Associate the provider |
|
240 | 247 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
241 | 248 | impl->m_VariableToIdentifierMap[newVariable] = identifier; |
|
242 | 249 | |
|
243 | 250 | |
|
244 | impl->processRequest(newVariable, range); | |
|
251 | auto varRequestId = QUuid::createUuid(); | |
|
252 | qCInfo(LOG_VariableController()) << "processRequest for" << name << varRequestId; | |
|
253 | impl->processRequest(newVariable, range, varRequestId); | |
|
254 | impl->updateVariableRequest(varRequestId); | |
|
245 | 255 | |
|
246 | 256 | return newVariable; |
|
247 | 257 | } |
|
248 | 258 | } |
|
249 | 259 | |
|
250 | 260 | void VariableController::onDateTimeOnSelection(const SqpRange &dateTime) |
|
251 | 261 | { |
|
252 | // TODO check synchronisation | |
|
262 | // TODO check synchronisation and Rescale | |
|
253 | 263 | qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection" |
|
254 | 264 | << QThread::currentThread()->objectName(); |
|
255 | 265 | auto selectedRows = impl->m_VariableSelectionModel->selectedRows(); |
|
266 | auto varRequestId = QUuid::createUuid(); | |
|
256 | 267 | |
|
257 | 268 | for (const auto &selectedRow : qAsConst(selectedRows)) { |
|
258 | 269 | if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) { |
|
259 | 270 | selectedVariable->setRange(dateTime); |
|
260 | impl->processRequest(selectedVariable, dateTime); | |
|
271 | impl->processRequest(selectedVariable, dateTime, varRequestId); | |
|
261 | 272 | |
|
262 | 273 | // notify that rescale operation has to be done |
|
263 | 274 | emit rangeChanged(selectedVariable, dateTime); |
|
264 | 275 | } |
|
265 | 276 | } |
|
277 | impl->updateVariableRequest(varRequestId); | |
|
266 | 278 | } |
|
267 | 279 | |
|
268 | 280 | void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &rangeRequested, |
|
269 | 281 | const SqpRange &cacheRangeRequested, |
|
270 | 282 | QVector<AcquisitionDataPacket> dataAcquired) |
|
271 | 283 | { |
|
272 | if (auto var = impl->findVariable(vIdentifier)) { | |
|
273 | var->setRange(rangeRequested); | |
|
274 | var->setCacheRange(cacheRangeRequested); | |
|
275 | qCDebug(LOG_VariableController()) << tr("1: onDataProvided") << rangeRequested; | |
|
276 | qCDebug(LOG_VariableController()) << tr("2: onDataProvided") << cacheRangeRequested; | |
|
277 | ||
|
278 | 284 |
|
|
279 | qCDebug(LOG_VariableController()) << tr("3: onDataProvided") | |
|
280 | << retrievedDataSeries->range(); | |
|
281 | var->mergeDataSeries(retrievedDataSeries); | |
|
282 | qCDebug(LOG_VariableController()) << tr("4: onDataProvided"); | |
|
283 | emit var->updated(); | |
|
284 | } | |
|
285 | else { | |
|
286 | qCCritical(LOG_VariableController()) << tr("Impossible to provide data to a null variable"); | |
|
285 | auto varRequestId = impl->acceptVariableRequest(vIdentifier, retrievedDataSeries); | |
|
286 | if (!varRequestId.isNull()) { | |
|
287 | impl->updateVariableRequest(varRequestId); | |
|
287 | 288 | } |
|
288 | 289 | } |
|
289 | 290 | |
|
290 | 291 | void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress) |
|
291 | 292 | { |
|
292 | 293 | if (auto var = impl->findVariable(identifier)) { |
|
293 | 294 | impl->m_VariableModel->setDataProgress(var, progress); |
|
294 | 295 | } |
|
295 | 296 | else { |
|
296 | 297 | qCCritical(LOG_VariableController()) |
|
297 | 298 | << tr("Impossible to notify progression of a null variable"); |
|
298 | 299 | } |
|
299 | 300 | } |
|
300 | 301 | |
|
301 | 302 | void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable) |
|
302 | 303 | { |
|
303 | 304 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAbortProgressRequested" |
|
304 | 305 | << QThread::currentThread()->objectName(); |
|
305 | 306 | |
|
306 | 307 | auto it = impl->m_VariableToIdentifierMap.find(variable); |
|
307 | 308 | if (it != impl->m_VariableToIdentifierMap.cend()) { |
|
308 | 309 | impl->m_VariableToProviderMap.at(variable)->requestDataAborting(it->second); |
|
309 | 310 | } |
|
310 | 311 | else { |
|
311 | 312 | qCWarning(LOG_VariableController()) |
|
312 | 313 | << tr("Aborting progression of inexistant variable detected !!!") |
|
313 | 314 | << QThread::currentThread()->objectName(); |
|
314 | 315 | } |
|
315 | 316 | } |
|
316 | 317 | |
|
317 | 318 | void VariableController::onAddSynchronizationGroupId(QUuid synchronizationGroupId) |
|
318 | 319 | { |
|
319 | 320 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronizationGroupId" |
|
320 | 321 | << QThread::currentThread()->objectName() |
|
321 | 322 | << synchronizationGroupId; |
|
322 | 323 | auto vSynchroGroup = std::make_shared<VariableSynchronizationGroup>(); |
|
323 | 324 | impl->m_GroupIdToVariableSynchronizationGroupMap.insert( |
|
324 | 325 | std::make_pair(synchronizationGroupId, vSynchroGroup)); |
|
325 | 326 | } |
|
326 | 327 | |
|
327 | 328 | void VariableController::onRemoveSynchronizationGroupId(QUuid synchronizationGroupId) |
|
328 | 329 | { |
|
329 | 330 | impl->m_GroupIdToVariableSynchronizationGroupMap.erase(synchronizationGroupId); |
|
330 | 331 | } |
|
331 | 332 | |
|
332 | 333 | void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable, |
|
333 | 334 | QUuid synchronizationGroupId) |
|
334 | 335 | |
|
335 | 336 | { |
|
336 | 337 | qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized" |
|
337 | 338 | << synchronizationGroupId; |
|
338 | 339 | auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable); |
|
339 | 340 | if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) { |
|
340 | 341 | auto groupIdToVSGIt |
|
341 | 342 | = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId); |
|
342 | 343 | if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) { |
|
343 | 344 | impl->m_VariableIdGroupIdMap.insert( |
|
344 | 345 | std::make_pair(varToVarIdIt->second, synchronizationGroupId)); |
|
345 | 346 | groupIdToVSGIt->second->addVariableId(varToVarIdIt->second); |
|
346 | 347 | } |
|
347 | 348 | else { |
|
348 | 349 | qCCritical(LOG_VariableController()) |
|
349 | 350 | << tr("Impossible to synchronize a variable with an unknown sycnhronization group") |
|
350 | 351 | << variable->name(); |
|
351 | 352 | } |
|
352 | 353 | } |
|
353 | 354 | else { |
|
354 | 355 | qCCritical(LOG_VariableController()) |
|
355 | 356 | << tr("Impossible to synchronize a variable with no identifier") << variable->name(); |
|
356 | 357 | } |
|
357 | 358 | } |
|
358 | 359 | |
|
359 | 360 | |
|
360 | 361 | void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables, |
|
361 | 362 | const SqpRange &range, const SqpRange &oldRange, |
|
362 | 363 | bool synchronise) |
|
363 | 364 | { |
|
364 | 365 | // NOTE: oldRange isn't really necessary since oldRange == variable->range(). |
|
365 | 366 | |
|
366 | qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading" | |
|
367 | << QThread::currentThread()->objectName(); | |
|
368 | 367 | // we want to load data of the variable for the dateTime. |
|
369 | 368 | // First we check if the cache contains some of them. |
|
370 | 369 | // For the other, we ask the provider to give them. |
|
371 | 370 | |
|
371 | auto varRequestId = QUuid::createUuid(); | |
|
372 | qCInfo(LOG_VariableController()) << "VariableController::onRequestDataLoading" | |
|
373 | << QThread::currentThread()->objectName() << varRequestId; | |
|
374 | ||
|
372 | 375 | for (const auto &var : variables) { |
|
373 | qCDebug(LOG_VariableController()) << "processRequest for" << var->name(); | |
|
374 | impl->processRequest(var, range); | |
|
376 | qCDebug(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId; | |
|
377 | impl->processRequest(var, range, varRequestId); | |
|
375 | 378 | } |
|
376 | 379 | |
|
377 | 380 | if (synchronise) { |
|
378 | 381 | // Get the group ids |
|
379 | 382 | qCDebug(LOG_VariableController()) |
|
380 | 383 | << "TORM VariableController::onRequestDataLoading for synchro var ENABLE"; |
|
381 |
auto groupIds = std::set<QUuid> |
|
|
384 | auto groupIds = std::set<QUuid>{}; | |
|
385 | auto groupIdToOldRangeMap = std::map<QUuid, SqpRange>{}; | |
|
382 | 386 | for (const auto &var : variables) { |
|
383 | 387 | auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(var); |
|
384 | 388 | if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) { |
|
385 | 389 | auto vId = varToVarIdIt->second; |
|
386 | 390 | auto varIdToGroupIdIt = impl->m_VariableIdGroupIdMap.find(vId); |
|
387 | 391 | if (varIdToGroupIdIt != impl->m_VariableIdGroupIdMap.cend()) { |
|
388 | 392 | auto gId = varIdToGroupIdIt->second; |
|
393 | groupIdToOldRangeMap.insert(std::make_pair(gId, var->range())); | |
|
389 | 394 | if (groupIds.find(gId) == groupIds.cend()) { |
|
390 | 395 | qCDebug(LOG_VariableController()) << "Synchro detect group " << gId; |
|
391 | 396 | groupIds.insert(gId); |
|
392 | 397 | } |
|
393 | 398 | } |
|
394 | 399 | } |
|
395 | 400 | } |
|
396 | 401 | |
|
397 | 402 | // We assume here all group ids exist |
|
398 | 403 | for (const auto &gId : groupIds) { |
|
399 | 404 | auto vSynchronizationGroup = impl->m_GroupIdToVariableSynchronizationGroupMap.at(gId); |
|
400 | 405 | auto vSyncIds = vSynchronizationGroup->getIds(); |
|
401 | 406 | qCDebug(LOG_VariableController()) << "Var in synchro group "; |
|
402 | 407 | for (auto vId : vSyncIds) { |
|
403 | 408 | auto var = impl->findVariable(vId); |
|
404 | 409 | |
|
405 | 410 | // Don't process already processed var |
|
406 | 411 | if (!variables.contains(var)) { |
|
407 | 412 | if (var != nullptr) { |
|
408 | 413 | qCDebug(LOG_VariableController()) << "processRequest synchro for" |
|
409 | 414 | << var->name(); |
|
410 | auto vSyncRangeRequested | |
|
411 |
|
|
|
412 |
|
|
|
415 | auto vSyncRangeRequested = computeSynchroRangeRequested( | |
|
416 | var->range(), range, groupIdToOldRangeMap.at(gId)); | |
|
417 | qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested; | |
|
418 | impl->processRequest(var, vSyncRangeRequested, varRequestId); | |
|
413 | 419 | } |
|
414 | 420 | else { |
|
415 | 421 | qCCritical(LOG_VariableController()) |
|
416 | 422 | |
|
417 | 423 | << tr("Impossible to synchronize a null variable"); |
|
418 | 424 | } |
|
419 | 425 | } |
|
420 | 426 | } |
|
421 | 427 | } |
|
422 | 428 | } |
|
429 | ||
|
430 | impl->updateVariableRequest(varRequestId); | |
|
423 | 431 | } |
|
424 | 432 | |
|
425 | 433 | |
|
426 | 434 | void VariableController::initialize() |
|
427 | 435 | { |
|
428 | 436 | qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread(); |
|
429 | 437 | impl->m_WorkingMutex.lock(); |
|
430 | 438 | qCDebug(LOG_VariableController()) << tr("VariableController init END"); |
|
431 | 439 | } |
|
432 | 440 | |
|
433 | 441 | void VariableController::finalize() |
|
434 | 442 | { |
|
435 | 443 | impl->m_WorkingMutex.unlock(); |
|
436 | 444 | } |
|
437 | 445 | |
|
438 | 446 | void VariableController::waitForFinish() |
|
439 | 447 | { |
|
440 | 448 | QMutexLocker locker{&impl->m_WorkingMutex}; |
|
441 | 449 | } |
|
442 | 450 | |
|
443 | 451 | AcquisitionZoomType VariableController::getZoomType(const SqpRange &range, const SqpRange &oldRange) |
|
444 | 452 | { |
|
445 | 453 | // t1.m_TStart <= t2.m_TStart && t2.m_TEnd <= t1.m_TEnd |
|
446 | 454 | auto zoomType = AcquisitionZoomType::Unknown; |
|
447 | 455 | if (range.m_TStart <= oldRange.m_TStart && oldRange.m_TEnd <= range.m_TEnd) { |
|
448 | 456 | zoomType = AcquisitionZoomType::ZoomOut; |
|
449 | 457 | } |
|
450 | 458 | else if (range.m_TStart > oldRange.m_TStart && range.m_TEnd > oldRange.m_TEnd) { |
|
451 | 459 | zoomType = AcquisitionZoomType::PanRight; |
|
452 | 460 | } |
|
453 | 461 | else if (range.m_TStart < oldRange.m_TStart && range.m_TEnd < oldRange.m_TEnd) { |
|
454 | 462 | zoomType = AcquisitionZoomType::PanLeft; |
|
455 | 463 | } |
|
456 | 464 | else if (range.m_TStart > oldRange.m_TStart && oldRange.m_TEnd > range.m_TEnd) { |
|
457 | 465 | zoomType = AcquisitionZoomType::ZoomIn; |
|
458 | 466 | } |
|
459 | 467 | else { |
|
460 | 468 | qCCritical(LOG_VariableController()) << "getZoomType: Unknown type detected"; |
|
461 | 469 | } |
|
462 | 470 | return zoomType; |
|
463 | 471 | } |
|
464 | 472 | |
|
465 | 473 | void VariableController::VariableControllerPrivate::processRequest(std::shared_ptr<Variable> var, |
|
466 |
const SqpRange &rangeRequested |
|
|
474 | const SqpRange &rangeRequested, | |
|
475 | QUuid varRequestId) | |
|
467 | 476 | { |
|
468 | 477 | |
|
469 | auto varRangesRequested | |
|
470 | = m_VariableCacheStrategy->computeCacheRange(var->range(), rangeRequested); | |
|
471 | auto notInCacheRangeList = var->provideNotInCacheRangeList(varRangesRequested.second); | |
|
472 | auto inCacheRangeList = var->provideInCacheRangeList(varRangesRequested.second); | |
|
478 | // TODO: protect at | |
|
479 | auto varRequest = VariableRequest{}; | |
|
480 | auto varId = m_VariableToIdentifierMap.at(var); | |
|
481 | ||
|
482 | auto varStrategyRangesRequested | |
|
483 | = m_VariableCacheStrategy->computeStrategyRanges(var->range(), rangeRequested); | |
|
484 | auto notInCacheRangeList = var->provideNotInCacheRangeList(varStrategyRangesRequested.second); | |
|
485 | auto inCacheRangeList = var->provideInCacheRangeList(varStrategyRangesRequested.second); | |
|
473 | 486 | |
|
474 | 487 | if (!notInCacheRangeList.empty()) { |
|
475 | auto identifier = m_VariableToIdentifierMap.at(var); | |
|
488 | varRequest.m_RangeRequested = varStrategyRangesRequested.first; | |
|
489 | varRequest.m_CacheRangeRequested = varStrategyRangesRequested.second; | |
|
490 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM processRequest RR ") << rangeRequested; | |
|
491 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM processRequest R ") | |
|
492 | << varStrategyRangesRequested.first; | |
|
493 | qCDebug(LOG_VariableAcquisitionWorker()) << tr("TORM processRequest CR ") | |
|
494 | << varStrategyRangesRequested.second; | |
|
495 | // store VarRequest | |
|
496 | storeVariableRequest(varId, varRequestId, varRequest); | |
|
497 | ||
|
476 | 498 | auto varProvider = m_VariableToProviderMap.at(var); |
|
477 | 499 | if (varProvider != nullptr) { |
|
478 | m_VariableAcquisitionWorker->pushVariableRequest( | |
|
479 | identifier, varRangesRequested.first, varRangesRequested.second, | |
|
500 | auto varRequestIdCanceled = m_VariableAcquisitionWorker->pushVariableRequest( | |
|
501 | varRequestId, varId, varStrategyRangesRequested.first, | |
|
502 | varStrategyRangesRequested.second, | |
|
480 | 503 | DataProviderParameters{std::move(notInCacheRangeList), var->metadata()}, |
|
481 | 504 | varProvider); |
|
505 | ||
|
506 | if (!varRequestIdCanceled.isNull()) { | |
|
507 | qCInfo(LOG_VariableAcquisitionWorker()) << tr("varRequestIdCanceled: ") | |
|
508 | << varRequestIdCanceled; | |
|
509 | cancelVariableRequest(varRequestIdCanceled); | |
|
510 | } | |
|
482 | 511 | } |
|
483 | 512 | else { |
|
484 | 513 | qCCritical(LOG_VariableController()) |
|
485 | 514 | << "Impossible to provide data with a null provider"; |
|
486 | 515 | } |
|
487 | 516 | |
|
488 | 517 | if (!inCacheRangeList.empty()) { |
|
489 | 518 | emit q->updateVarDisplaying(var, inCacheRangeList.first()); |
|
490 | 519 | } |
|
491 | 520 | } |
|
492 | 521 | else { |
|
493 | var->setRange(rangeRequested); | |
|
494 |
var |
|
|
495 | var->setDataSeries(var->dataSeries()->subDataSeries(varRangesRequested.second)); | |
|
496 | emit var->updated(); | |
|
522 | ||
|
523 | varRequest.m_RangeRequested = varStrategyRangesRequested.first; | |
|
524 | varRequest.m_CacheRangeRequested = varStrategyRangesRequested.second; | |
|
525 | // store VarRequest | |
|
526 | storeVariableRequest(varId, varRequestId, varRequest); | |
|
527 | acceptVariableRequest(varId, | |
|
528 | var->dataSeries()->subDataSeries(varStrategyRangesRequested.second)); | |
|
497 | 529 | } |
|
498 | 530 | } |
|
499 | 531 | |
|
500 | 532 | std::shared_ptr<Variable> |
|
501 | 533 | VariableController::VariableControllerPrivate::findVariable(QUuid vIdentifier) |
|
502 | 534 | { |
|
503 | 535 | std::shared_ptr<Variable> var; |
|
504 | 536 | auto findReply = [vIdentifier](const auto &entry) { return vIdentifier == entry.second; }; |
|
505 | 537 | |
|
506 | 538 | auto end = m_VariableToIdentifierMap.cend(); |
|
507 | 539 | auto it = std::find_if(m_VariableToIdentifierMap.cbegin(), end, findReply); |
|
508 | 540 | if (it != end) { |
|
509 | 541 | var = it->first; |
|
510 | 542 | } |
|
511 | 543 | else { |
|
512 | 544 | qCCritical(LOG_VariableController()) |
|
513 | 545 | << tr("Impossible to find the variable with the identifier: ") << vIdentifier; |
|
514 | 546 | } |
|
515 | 547 | |
|
516 | 548 | return var; |
|
517 | 549 | } |
|
518 | 550 | |
|
519 | 551 | std::shared_ptr<IDataSeries> VariableController::VariableControllerPrivate::retrieveDataSeries( |
|
520 | 552 | const QVector<AcquisitionDataPacket> acqDataPacketVector) |
|
521 | 553 | { |
|
522 | 554 | qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size") |
|
523 | 555 | << acqDataPacketVector.size(); |
|
524 | 556 | std::shared_ptr<IDataSeries> dataSeries; |
|
525 | 557 | if (!acqDataPacketVector.isEmpty()) { |
|
526 | 558 | dataSeries = acqDataPacketVector[0].m_DateSeries; |
|
527 | 559 | for (int i = 1; i < acqDataPacketVector.size(); ++i) { |
|
528 | 560 | dataSeries->merge(acqDataPacketVector[i].m_DateSeries.get()); |
|
529 | 561 | } |
|
530 | 562 | } |
|
531 | 563 | qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size END") |
|
532 | 564 | << acqDataPacketVector.size(); |
|
533 | 565 | return dataSeries; |
|
534 | 566 | } |
|
535 | 567 | |
|
536 | 568 | void VariableController::VariableControllerPrivate::registerProvider( |
|
537 | 569 | std::shared_ptr<IDataProvider> provider) |
|
538 | 570 | { |
|
539 | 571 | if (m_ProviderSet.find(provider) == m_ProviderSet.end()) { |
|
540 | 572 | qCDebug(LOG_VariableController()) << tr("Registering of a new provider") |
|
541 | 573 | << provider->objectName(); |
|
542 | 574 | m_ProviderSet.insert(provider); |
|
543 | 575 | connect(provider.get(), &IDataProvider::dataProvided, m_VariableAcquisitionWorker.get(), |
|
544 | 576 | &VariableAcquisitionWorker::onVariableDataAcquired); |
|
545 | 577 | connect(provider.get(), &IDataProvider::dataProvidedProgress, |
|
546 | 578 | m_VariableAcquisitionWorker.get(), |
|
547 | 579 | &VariableAcquisitionWorker::onVariableRetrieveDataInProgress); |
|
548 | 580 | } |
|
549 | 581 | else { |
|
550 | 582 | qCDebug(LOG_VariableController()) << tr("Cannot register provider, it already exists "); |
|
551 | 583 | } |
|
552 | 584 | } |
|
585 | ||
|
586 | void VariableController::VariableControllerPrivate::storeVariableRequest( | |
|
587 | QUuid varId, QUuid varRequestId, const VariableRequest &varRequest) | |
|
588 | { | |
|
589 | // First request for the variable. we can create an entry for it | |
|
590 | auto varIdToVarRequestIdQueueMapIt = m_VarIdToVarRequestIdQueueMap.find(varId); | |
|
591 | if (varIdToVarRequestIdQueueMapIt == m_VarIdToVarRequestIdQueueMap.cend()) { | |
|
592 | auto varRequestIdQueue = std::deque<QUuid>{}; | |
|
593 | qCDebug(LOG_VariableController()) << tr("Store REQUEST in QUEUE"); | |
|
594 | varRequestIdQueue.push_back(varRequestId); | |
|
595 | m_VarIdToVarRequestIdQueueMap.insert(std::make_pair(varId, std::move(varRequestIdQueue))); | |
|
596 | } | |
|
597 | else { | |
|
598 | qCDebug(LOG_VariableController()) << tr("Store REQUEST in EXISTING QUEUE"); | |
|
599 | auto &varRequestIdQueue = varIdToVarRequestIdQueueMapIt->second; | |
|
600 | varRequestIdQueue.push_back(varRequestId); | |
|
601 | } | |
|
602 | ||
|
603 | auto varRequestIdToVarIdVarRequestMapIt = m_VarRequestIdToVarIdVarRequestMap.find(varRequestId); | |
|
604 | if (varRequestIdToVarIdVarRequestMapIt == m_VarRequestIdToVarIdVarRequestMap.cend()) { | |
|
605 | auto varIdToVarRequestMap = std::map<QUuid, VariableRequest>{}; | |
|
606 | varIdToVarRequestMap.insert(std::make_pair(varId, varRequest)); | |
|
607 | qCDebug(LOG_VariableController()) << tr("Store REQUESTID in MAP"); | |
|
608 | m_VarRequestIdToVarIdVarRequestMap.insert( | |
|
609 | std::make_pair(varRequestId, std::move(varIdToVarRequestMap))); | |
|
610 | } | |
|
611 | else { | |
|
612 | auto &varIdToVarRequestMap = varRequestIdToVarIdVarRequestMapIt->second; | |
|
613 | qCDebug(LOG_VariableController()) << tr("Store REQUESTID in EXISTING MAP"); | |
|
614 | varIdToVarRequestMap.insert(std::make_pair(varId, varRequest)); | |
|
615 | } | |
|
616 | } | |
|
617 | ||
|
618 | QUuid VariableController::VariableControllerPrivate::acceptVariableRequest( | |
|
619 | QUuid varId, std::shared_ptr<IDataSeries> dataSeries) | |
|
620 | { | |
|
621 | QUuid varRequestId; | |
|
622 | auto varIdToVarRequestIdQueueMapIt = m_VarIdToVarRequestIdQueueMap.find(varId); | |
|
623 | if (varIdToVarRequestIdQueueMapIt != m_VarIdToVarRequestIdQueueMap.cend()) { | |
|
624 | auto &varRequestIdQueue = varIdToVarRequestIdQueueMapIt->second; | |
|
625 | varRequestId = varRequestIdQueue.front(); | |
|
626 | auto varRequestIdToVarIdVarRequestMapIt | |
|
627 | = m_VarRequestIdToVarIdVarRequestMap.find(varRequestId); | |
|
628 | if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) { | |
|
629 | auto &varIdToVarRequestMap = varRequestIdToVarIdVarRequestMapIt->second; | |
|
630 | auto varIdToVarRequestMapIt = varIdToVarRequestMap.find(varId); | |
|
631 | if (varIdToVarRequestMapIt != varIdToVarRequestMap.cend()) { | |
|
632 | qCDebug(LOG_VariableController()) << tr("acceptVariableRequest"); | |
|
633 | auto &varRequest = varIdToVarRequestMapIt->second; | |
|
634 | varRequest.m_DataSeries = dataSeries; | |
|
635 | varRequest.m_CanUpdate = true; | |
|
636 | } | |
|
637 | else { | |
|
638 | qCDebug(LOG_VariableController()) | |
|
639 | << tr("Impossible to acceptVariableRequest of a unknown variable id attached " | |
|
640 | "to a variableRequestId") | |
|
641 | << varRequestId << varId; | |
|
642 | } | |
|
643 | } | |
|
644 | else { | |
|
645 | qCCritical(LOG_VariableController()) | |
|
646 | << tr("Impossible to acceptVariableRequest of a unknown variableRequestId") | |
|
647 | << varRequestId; | |
|
648 | } | |
|
649 | ||
|
650 | qCDebug(LOG_VariableController()) << tr("1: erase REQUEST in QUEUE ?") | |
|
651 | << varRequestIdQueue.size(); | |
|
652 | varRequestIdQueue.pop_front(); | |
|
653 | qCDebug(LOG_VariableController()) << tr("2: erase REQUEST in QUEUE ?") | |
|
654 | << varRequestIdQueue.size(); | |
|
655 | if (varRequestIdQueue.empty()) { | |
|
656 | m_VarIdToVarRequestIdQueueMap.erase(varId); | |
|
657 | } | |
|
658 | } | |
|
659 | else { | |
|
660 | qCCritical(LOG_VariableController()) | |
|
661 | << tr("Impossible to acceptVariableRequest of a unknown variable id") << varId; | |
|
662 | } | |
|
663 | ||
|
664 | return varRequestId; | |
|
665 | } | |
|
666 | ||
|
667 | void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid varRequestId) | |
|
668 | { | |
|
669 | ||
|
670 | auto varRequestIdToVarIdVarRequestMapIt = m_VarRequestIdToVarIdVarRequestMap.find(varRequestId); | |
|
671 | if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) { | |
|
672 | bool processVariableUpdate = true; | |
|
673 | auto &varIdToVarRequestMap = varRequestIdToVarIdVarRequestMapIt->second; | |
|
674 | for (auto varIdToVarRequestMapIt = varIdToVarRequestMap.cbegin(); | |
|
675 | (varIdToVarRequestMapIt != varIdToVarRequestMap.cend()) && processVariableUpdate; | |
|
676 | ++varIdToVarRequestMapIt) { | |
|
677 | processVariableUpdate &= varIdToVarRequestMapIt->second.m_CanUpdate; | |
|
678 | qCDebug(LOG_VariableController()) << tr("updateVariableRequest") | |
|
679 | << processVariableUpdate; | |
|
680 | } | |
|
681 | ||
|
682 | if (processVariableUpdate) { | |
|
683 | for (auto varIdToVarRequestMapIt = varIdToVarRequestMap.cbegin(); | |
|
684 | varIdToVarRequestMapIt != varIdToVarRequestMap.cend(); ++varIdToVarRequestMapIt) { | |
|
685 | if (auto var = findVariable(varIdToVarRequestMapIt->first)) { | |
|
686 | auto &varRequest = varIdToVarRequestMapIt->second; | |
|
687 | var->setRange(varRequest.m_RangeRequested); | |
|
688 | var->setCacheRange(varRequest.m_CacheRangeRequested); | |
|
689 | qCDebug(LOG_VariableController()) << tr("1: onDataProvided") | |
|
690 | << varRequest.m_RangeRequested; | |
|
691 | qCDebug(LOG_VariableController()) << tr("2: onDataProvided") | |
|
692 | << varRequest.m_CacheRangeRequested; | |
|
693 | var->mergeDataSeries(varRequest.m_DataSeries); | |
|
694 | qCDebug(LOG_VariableController()) << tr("3: onDataProvided") | |
|
695 | << varRequest.m_DataSeries->range(); | |
|
696 | qCDebug(LOG_VariableController()) << tr("4: onDataProvided"); | |
|
697 | emit var->updated(); | |
|
698 | } | |
|
699 | else { | |
|
700 | qCCritical(LOG_VariableController()) | |
|
701 | << tr("Impossible to update data to a null variable"); | |
|
702 | } | |
|
703 | } | |
|
704 | ||
|
705 | // cleaning varRequestId | |
|
706 | qCDebug(LOG_VariableController()) << tr("0: erase REQUEST in MAP ?") | |
|
707 | << m_VarRequestIdToVarIdVarRequestMap.size(); | |
|
708 | m_VarRequestIdToVarIdVarRequestMap.erase(varRequestId); | |
|
709 | qCDebug(LOG_VariableController()) << tr("1: erase REQUEST in MAP ?") | |
|
710 | << m_VarRequestIdToVarIdVarRequestMap.size(); | |
|
711 | } | |
|
712 | } | |
|
713 | else { | |
|
714 | qCCritical(LOG_VariableController()) | |
|
715 | << tr("Cannot updateVariableRequest for a unknow varRequestId") << varRequestId; | |
|
716 | } | |
|
717 | } | |
|
718 | ||
|
719 | void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid varRequestId) | |
|
720 | { | |
|
721 | // cleaning varRequestId | |
|
722 | m_VarRequestIdToVarIdVarRequestMap.erase(varRequestId); | |
|
723 | ||
|
724 | for (auto varIdToVarRequestIdQueueMapIt = m_VarIdToVarRequestIdQueueMap.begin(); | |
|
725 | varIdToVarRequestIdQueueMapIt != m_VarIdToVarRequestIdQueueMap.end();) { | |
|
726 | auto &varRequestIdQueue = varIdToVarRequestIdQueueMapIt->second; | |
|
727 | varRequestIdQueue.erase( | |
|
728 | std::remove(varRequestIdQueue.begin(), varRequestIdQueue.end(), varRequestId), | |
|
729 | varRequestIdQueue.end()); | |
|
730 | if (varRequestIdQueue.empty()) { | |
|
731 | varIdToVarRequestIdQueueMapIt | |
|
732 | = m_VarIdToVarRequestIdQueueMap.erase(varIdToVarRequestIdQueueMapIt); | |
|
733 | } | |
|
734 | else { | |
|
735 | ++varIdToVarRequestIdQueueMapIt; | |
|
736 | } | |
|
737 | } | |
|
738 | } |
@@ -1,257 +1,257 | |||
|
1 | 1 | #include "Visualization/VisualizationZoneWidget.h" |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | #include "Visualization/IVisualizationWidgetVisitor.h" |
|
5 | 5 | #include "Visualization/VisualizationGraphWidget.h" |
|
6 | 6 | #include "ui_VisualizationZoneWidget.h" |
|
7 | 7 | |
|
8 | 8 | #include <Data/SqpRange.h> |
|
9 | 9 | #include <Variable/Variable.h> |
|
10 | 10 | #include <Variable/VariableController.h> |
|
11 | 11 | |
|
12 | 12 | #include <QUuid> |
|
13 | 13 | #include <SqpApplication.h> |
|
14 | 14 | #include <cmath> |
|
15 | 15 | |
|
16 | 16 | Q_LOGGING_CATEGORY(LOG_VisualizationZoneWidget, "VisualizationZoneWidget") |
|
17 | 17 | |
|
18 | 18 | namespace { |
|
19 | 19 | |
|
20 | 20 | /// Minimum height for graph added in zones (in pixels) |
|
21 | 21 | const auto GRAPH_MINIMUM_HEIGHT = 300; |
|
22 | 22 | |
|
23 | 23 | /// Generates a default name for a new graph, according to the number of graphs already displayed in |
|
24 | 24 | /// the zone |
|
25 | 25 | QString defaultGraphName(const QLayout &layout) |
|
26 | 26 | { |
|
27 | 27 | auto count = 0; |
|
28 | 28 | for (auto i = 0; i < layout.count(); ++i) { |
|
29 | 29 | if (dynamic_cast<VisualizationGraphWidget *>(layout.itemAt(i)->widget())) { |
|
30 | 30 | count++; |
|
31 | 31 | } |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | return QObject::tr("Graph %1").arg(count + 1); |
|
35 | 35 | } |
|
36 | 36 | |
|
37 | 37 | } // namespace |
|
38 | 38 | |
|
39 | 39 | struct VisualizationZoneWidget::VisualizationZoneWidgetPrivate { |
|
40 | 40 | |
|
41 | 41 | explicit VisualizationZoneWidgetPrivate() : m_SynchronisationGroupId{QUuid::createUuid()} {} |
|
42 | 42 | QUuid m_SynchronisationGroupId; |
|
43 | 43 | }; |
|
44 | 44 | |
|
45 | 45 | VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *parent) |
|
46 | 46 | : QWidget{parent}, |
|
47 | 47 | ui{new Ui::VisualizationZoneWidget}, |
|
48 | 48 | impl{spimpl::make_unique_impl<VisualizationZoneWidgetPrivate>()} |
|
49 | 49 | { |
|
50 | 50 | ui->setupUi(this); |
|
51 | 51 | |
|
52 | 52 | ui->zoneNameLabel->setText(name); |
|
53 | 53 | |
|
54 | 54 | // 'Close' options : widget is deleted when closed |
|
55 | 55 | setAttribute(Qt::WA_DeleteOnClose); |
|
56 | 56 | connect(ui->closeButton, &QToolButton::clicked, this, &VisualizationZoneWidget::close); |
|
57 | 57 | ui->closeButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); |
|
58 | 58 | |
|
59 | 59 | // Synchronisation id |
|
60 | 60 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onAddSynchronizationGroupId", |
|
61 | 61 | Qt::QueuedConnection, Q_ARG(QUuid, impl->m_SynchronisationGroupId)); |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | VisualizationZoneWidget::~VisualizationZoneWidget() |
|
65 | 65 | { |
|
66 | 66 | delete ui; |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget) |
|
70 | 70 | { |
|
71 | 71 | ui->visualizationZoneFrame->layout()->addWidget(graphWidget); |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable) |
|
75 | 75 | { |
|
76 | 76 | auto graphWidget = new VisualizationGraphWidget{ |
|
77 | 77 | defaultGraphName(*ui->visualizationZoneFrame->layout()), this}; |
|
78 | 78 | |
|
79 | 79 | |
|
80 | 80 | // Set graph properties |
|
81 | 81 | graphWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); |
|
82 | 82 | graphWidget->setMinimumHeight(GRAPH_MINIMUM_HEIGHT); |
|
83 | 83 | |
|
84 | 84 | |
|
85 | 85 | // Lambda to synchronize zone widget |
|
86 | 86 | auto synchronizeZoneWidget = [this, graphWidget](const SqpRange &graphRange, |
|
87 | 87 | const SqpRange &oldGraphRange) { |
|
88 | 88 | |
|
89 | 89 | auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange); |
|
90 | 90 | auto frameLayout = ui->visualizationZoneFrame->layout(); |
|
91 | 91 | for (auto i = 0; i < frameLayout->count(); ++i) { |
|
92 | 92 | auto graphChild |
|
93 | 93 | = dynamic_cast<VisualizationGraphWidget *>(frameLayout->itemAt(i)->widget()); |
|
94 | 94 | if (graphChild && (graphChild != graphWidget)) { |
|
95 | 95 | |
|
96 | 96 | auto graphChildRange = graphChild->graphRange(); |
|
97 | 97 | switch (zoomType) { |
|
98 | 98 | case AcquisitionZoomType::ZoomIn: { |
|
99 | 99 | auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart; |
|
100 | 100 | auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd; |
|
101 | 101 | graphChildRange.m_TStart += deltaLeft; |
|
102 | 102 | graphChildRange.m_TEnd -= deltaRight; |
|
103 |
qC |
|
|
104 |
qC |
|
|
103 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomIn"); | |
|
104 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft") | |
|
105 | 105 |
|
|
106 |
qC |
|
|
106 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight") | |
|
107 | 107 |
|
|
108 |
qC |
|
|
108 | qCDebug(LOG_VisualizationZoneWidget()) | |
|
109 | 109 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; |
|
110 | 110 | |
|
111 | 111 | break; |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | 114 | case AcquisitionZoomType::ZoomOut: { |
|
115 |
qC |
|
|
115 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: ZoomOut"); | |
|
116 | 116 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; |
|
117 | 117 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; |
|
118 |
qC |
|
|
118 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaLeft") | |
|
119 | 119 |
|
|
120 |
qC |
|
|
120 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: deltaRight") | |
|
121 | 121 |
|
|
122 |
qC |
|
|
122 | qCDebug(LOG_VisualizationZoneWidget()) | |
|
123 | 123 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; |
|
124 | 124 | graphChildRange.m_TStart -= deltaLeft; |
|
125 | 125 | graphChildRange.m_TEnd += deltaRight; |
|
126 | 126 | break; |
|
127 | 127 | } |
|
128 | 128 | case AcquisitionZoomType::PanRight: { |
|
129 |
qC |
|
|
129 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanRight"); | |
|
130 | 130 | auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd; |
|
131 | 131 | graphChildRange.m_TStart += deltaRight; |
|
132 | 132 | graphChildRange.m_TEnd += deltaRight; |
|
133 |
qC |
|
|
133 | qCDebug(LOG_VisualizationZoneWidget()) | |
|
134 | 134 | << tr("TORM: dt") << graphRange.m_TEnd - graphRange.m_TStart; |
|
135 | 135 | break; |
|
136 | 136 | } |
|
137 | 137 | case AcquisitionZoomType::PanLeft: { |
|
138 |
qC |
|
|
138 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: PanLeft"); | |
|
139 | 139 | auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart; |
|
140 | 140 | graphChildRange.m_TStart -= deltaLeft; |
|
141 | 141 | graphChildRange.m_TEnd -= deltaLeft; |
|
142 | 142 | break; |
|
143 | 143 | } |
|
144 | 144 | case AcquisitionZoomType::Unknown: { |
|
145 |
qC |
|
|
145 | qCDebug(LOG_VisualizationZoneWidget()) | |
|
146 | 146 | << tr("Impossible to synchronize: zoom type unknown"); |
|
147 | 147 | break; |
|
148 | 148 | } |
|
149 | 149 | default: |
|
150 | 150 | qCCritical(LOG_VisualizationZoneWidget()) |
|
151 | 151 | << tr("Impossible to synchronize: zoom type not take into account"); |
|
152 | 152 | // No action |
|
153 | 153 | break; |
|
154 | 154 | } |
|
155 | 155 | graphChild->enableAcquisition(false); |
|
156 |
qC |
|
|
156 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range before: ") | |
|
157 | 157 |
|
|
158 |
qC |
|
|
158 | qCDebug(LOG_VisualizationZoneWidget()) << tr("TORM: Range after : ") | |
|
159 | 159 |
|
|
160 |
qC |
|
|
160 | qCDebug(LOG_VisualizationZoneWidget()) | |
|
161 | 161 | << tr("TORM: child dt") << graphChildRange.m_TEnd - graphChildRange.m_TStart; |
|
162 | 162 | graphChild->setGraphRange(graphChildRange); |
|
163 | 163 | graphChild->enableAcquisition(true); |
|
164 | 164 | } |
|
165 | 165 | } |
|
166 | 166 | }; |
|
167 | 167 | |
|
168 | 168 | // connection for synchronization |
|
169 | 169 | connect(graphWidget, &VisualizationGraphWidget::synchronize, synchronizeZoneWidget); |
|
170 | 170 | connect(graphWidget, &VisualizationGraphWidget::variableAdded, this, |
|
171 | 171 | &VisualizationZoneWidget::onVariableAdded); |
|
172 | 172 | |
|
173 | 173 | auto range = SqpRange{}; |
|
174 | 174 | |
|
175 | 175 | // Apply visitor to graph children |
|
176 | 176 | auto layout = ui->visualizationZoneFrame->layout(); |
|
177 | 177 | if (layout->count() > 0) { |
|
178 | 178 | // Case of a new graph in a existant zone |
|
179 | 179 | if (auto visualizationGraphWidget |
|
180 | 180 | = dynamic_cast<VisualizationGraphWidget *>(layout->itemAt(0)->widget())) { |
|
181 | 181 | range = visualizationGraphWidget->graphRange(); |
|
182 | 182 | } |
|
183 | 183 | } |
|
184 | 184 | else { |
|
185 | 185 | // Case of a new graph as the first of the zone |
|
186 | 186 | range = variable->range(); |
|
187 | 187 | } |
|
188 | 188 | |
|
189 | 189 | this->addGraph(graphWidget); |
|
190 | 190 | |
|
191 | 191 | graphWidget->addVariable(variable, range); |
|
192 | 192 | |
|
193 | 193 | // get y using variable range |
|
194 | 194 | if (auto dataSeries = variable->dataSeries()) { |
|
195 | 195 | auto valuesBounds = dataSeries->valuesBounds(range.m_TStart, range.m_TEnd); |
|
196 | 196 | auto end = dataSeries->cend(); |
|
197 | 197 | if (valuesBounds.first != end && valuesBounds.second != end) { |
|
198 | 198 | auto rangeValue = [](const auto &value) { return std::isnan(value) ? 0. : value; }; |
|
199 | 199 | |
|
200 | 200 | auto minValue = rangeValue(valuesBounds.first->minValue()); |
|
201 | 201 | auto maxValue = rangeValue(valuesBounds.second->maxValue()); |
|
202 | 202 | |
|
203 | 203 | graphWidget->setYRange(SqpRange{minValue, maxValue}); |
|
204 | 204 | } |
|
205 | 205 | } |
|
206 | 206 | |
|
207 | 207 | return graphWidget; |
|
208 | 208 | } |
|
209 | 209 | |
|
210 | 210 | void VisualizationZoneWidget::accept(IVisualizationWidgetVisitor *visitor) |
|
211 | 211 | { |
|
212 | 212 | if (visitor) { |
|
213 | 213 | visitor->visitEnter(this); |
|
214 | 214 | |
|
215 | 215 | // Apply visitor to graph children |
|
216 | 216 | auto layout = ui->visualizationZoneFrame->layout(); |
|
217 | 217 | for (auto i = 0; i < layout->count(); ++i) { |
|
218 | 218 | if (auto item = layout->itemAt(i)) { |
|
219 | 219 | // Widgets different from graphs are not visited (no action) |
|
220 | 220 | if (auto visualizationGraphWidget |
|
221 | 221 | = dynamic_cast<VisualizationGraphWidget *>(item->widget())) { |
|
222 | 222 | visualizationGraphWidget->accept(visitor); |
|
223 | 223 | } |
|
224 | 224 | } |
|
225 | 225 | } |
|
226 | 226 | |
|
227 | 227 | visitor->visitLeave(this); |
|
228 | 228 | } |
|
229 | 229 | else { |
|
230 | 230 | qCCritical(LOG_VisualizationZoneWidget()) << tr("Can't visit widget : the visitor is null"); |
|
231 | 231 | } |
|
232 | 232 | } |
|
233 | 233 | |
|
234 | 234 | bool VisualizationZoneWidget::canDrop(const Variable &variable) const |
|
235 | 235 | { |
|
236 | 236 | // A tab can always accomodate a variable |
|
237 | 237 | Q_UNUSED(variable); |
|
238 | 238 | return true; |
|
239 | 239 | } |
|
240 | 240 | |
|
241 | 241 | bool VisualizationZoneWidget::contains(const Variable &variable) const |
|
242 | 242 | { |
|
243 | 243 | Q_UNUSED(variable); |
|
244 | 244 | return false; |
|
245 | 245 | } |
|
246 | 246 | |
|
247 | 247 | QString VisualizationZoneWidget::name() const |
|
248 | 248 | { |
|
249 | 249 | return ui->zoneNameLabel->text(); |
|
250 | 250 | } |
|
251 | 251 | |
|
252 | 252 | void VisualizationZoneWidget::onVariableAdded(std::shared_ptr<Variable> variable) |
|
253 | 253 | { |
|
254 | 254 | QMetaObject::invokeMethod(&sqpApp->variableController(), "onAddSynchronized", |
|
255 | 255 | Qt::QueuedConnection, Q_ARG(std::shared_ptr<Variable>, variable), |
|
256 | 256 | Q_ARG(QUuid, impl->m_SynchronisationGroupId)); |
|
257 | 257 | } |
@@ -1,168 +1,168 | |||
|
1 | 1 | #include "AmdaProvider.h" |
|
2 | 2 | #include "AmdaDefs.h" |
|
3 | 3 | #include "AmdaResultParser.h" |
|
4 | 4 | |
|
5 | 5 | #include <Common/DateUtils.h> |
|
6 | 6 | #include <Data/DataProviderParameters.h> |
|
7 | 7 | #include <Network/NetworkController.h> |
|
8 | 8 | #include <SqpApplication.h> |
|
9 | 9 | #include <Variable/Variable.h> |
|
10 | 10 | |
|
11 | 11 | #include <QNetworkAccessManager> |
|
12 | 12 | #include <QNetworkReply> |
|
13 | 13 | #include <QTemporaryFile> |
|
14 | 14 | #include <QThread> |
|
15 | 15 | |
|
16 | 16 | Q_LOGGING_CATEGORY(LOG_AmdaProvider, "AmdaProvider") |
|
17 | 17 | |
|
18 | 18 | namespace { |
|
19 | 19 | |
|
20 | 20 | /// URL format for a request on AMDA server. The parameters are as follows: |
|
21 | 21 | /// - %1: start date |
|
22 | 22 | /// - %2: end date |
|
23 | 23 | /// - %3: parameter id |
|
24 | 24 | const auto AMDA_URL_FORMAT = QStringLiteral( |
|
25 | 25 | "http://amda.irap.omp.eu/php/rest/" |
|
26 | 26 | "getParameter.php?startTime=%1&stopTime=%2¶meterID=%3&outputFormat=ASCII&" |
|
27 | 27 | "timeFormat=ISO8601&gzip=0"); |
|
28 | 28 | |
|
29 | 29 | /// Dates format passed in the URL (e.g 2013-09-23T09:00) |
|
30 | 30 | const auto AMDA_TIME_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss"); |
|
31 | 31 | |
|
32 | 32 | /// Formats a time to a date that can be passed in URL |
|
33 | 33 | QString dateFormat(double sqpRange) noexcept |
|
34 | 34 | { |
|
35 | 35 | auto dateTime = DateUtils::dateTime(sqpRange); |
|
36 | 36 | return dateTime.toString(AMDA_TIME_FORMAT); |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | AmdaResultParser::ValueType valueType(const QString &valueType) |
|
40 | 40 | { |
|
41 | 41 | if (valueType == QStringLiteral("scalar")) { |
|
42 | 42 | return AmdaResultParser::ValueType::SCALAR; |
|
43 | 43 | } |
|
44 | 44 | else if (valueType == QStringLiteral("vector")) { |
|
45 | 45 | return AmdaResultParser::ValueType::VECTOR; |
|
46 | 46 | } |
|
47 | 47 | else { |
|
48 | 48 | return AmdaResultParser::ValueType::UNKNOWN; |
|
49 | 49 | } |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | } // namespace |
|
53 | 53 | |
|
54 | 54 | AmdaProvider::AmdaProvider() |
|
55 | 55 | { |
|
56 | 56 | qCDebug(LOG_AmdaProvider()) << tr("AmdaProvider::AmdaProvider") << QThread::currentThread(); |
|
57 | 57 | if (auto app = sqpApp) { |
|
58 | 58 | auto &networkController = app->networkController(); |
|
59 | 59 | connect(this, SIGNAL(requestConstructed(QNetworkRequest, QUuid, |
|
60 | 60 | std::function<void(QNetworkReply *, QUuid)>)), |
|
61 | 61 | &networkController, |
|
62 | 62 | SLOT(onProcessRequested(QNetworkRequest, QUuid, |
|
63 | 63 | std::function<void(QNetworkReply *, QUuid)>))); |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | connect(&sqpApp->networkController(), SIGNAL(replyDownloadProgress(QUuid, double)), this, |
|
67 | 67 | SIGNAL(dataProvidedProgress(QUuid, double))); |
|
68 | 68 | } |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | void AmdaProvider::requestDataLoading(QUuid acqIdentifier, const DataProviderParameters ¶meters) |
|
72 | 72 | { |
|
73 | 73 | // NOTE: Try to use multithread if possible |
|
74 | 74 | const auto times = parameters.m_Times; |
|
75 | 75 | const auto data = parameters.m_Data; |
|
76 | 76 | for (const auto &dateTime : qAsConst(times)) { |
|
77 | 77 | this->retrieveData(acqIdentifier, dateTime, data); |
|
78 | 78 | |
|
79 | // TORM | |
|
80 |
|
|
|
79 | // TORM when AMDA will support quick asynchrone request | |
|
80 | QThread::msleep(1000); | |
|
81 | 81 | } |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | void AmdaProvider::requestDataAborting(QUuid acqIdentifier) |
|
85 | 85 | { |
|
86 | 86 | if (auto app = sqpApp) { |
|
87 | 87 | auto &networkController = app->networkController(); |
|
88 | 88 | networkController.onReplyCanceled(acqIdentifier); |
|
89 | 89 | } |
|
90 | 90 | } |
|
91 | 91 | |
|
92 | 92 | void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVariantHash &data) |
|
93 | 93 | { |
|
94 | 94 | // Retrieves product ID from data: if the value is invalid, no request is made |
|
95 | 95 | auto productId = data.value(AMDA_XML_ID_KEY).toString(); |
|
96 | 96 | if (productId.isNull()) { |
|
97 | 97 | qCCritical(LOG_AmdaProvider()) << tr("Can't retrieve data: unknown product id"); |
|
98 | 98 | return; |
|
99 | 99 | } |
|
100 | 100 | qCDebug(LOG_AmdaProvider()) << tr("AmdaProvider::retrieveData") << dateTime; |
|
101 | 101 | |
|
102 | 102 | // Retrieves the data type that determines whether the expected format for the result file is |
|
103 | 103 | // scalar, vector... |
|
104 | 104 | auto productValueType = valueType(data.value(AMDA_DATA_TYPE_KEY).toString()); |
|
105 | 105 | |
|
106 | 106 | // /////////// // |
|
107 | 107 | // Creates URL // |
|
108 | 108 | // /////////// // |
|
109 | 109 | |
|
110 | 110 | auto startDate = dateFormat(dateTime.m_TStart); |
|
111 | 111 | auto endDate = dateFormat(dateTime.m_TEnd); |
|
112 | 112 | |
|
113 | 113 | auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(startDate, endDate, productId)}; |
|
114 | 114 | qCInfo(LOG_AmdaProvider()) << tr("TORM AmdaProvider::retrieveData url:") << url; |
|
115 | 115 | auto tempFile = std::make_shared<QTemporaryFile>(); |
|
116 | 116 | |
|
117 | 117 | // LAMBDA |
|
118 | 118 | auto httpDownloadFinished = [this, dateTime, tempFile, |
|
119 | 119 | productValueType](QNetworkReply *reply, QUuid dataId) noexcept { |
|
120 | 120 | |
|
121 | 121 | // Don't do anything if the reply was abort |
|
122 | 122 | if (reply->error() != QNetworkReply::OperationCanceledError) { |
|
123 | 123 | |
|
124 | 124 | if (tempFile) { |
|
125 | 125 | auto replyReadAll = reply->readAll(); |
|
126 | 126 | if (!replyReadAll.isEmpty()) { |
|
127 | 127 | tempFile->write(replyReadAll); |
|
128 | 128 | } |
|
129 | 129 | tempFile->close(); |
|
130 | 130 | |
|
131 | 131 | // Parse results file |
|
132 | 132 | if (auto dataSeries |
|
133 | 133 | = AmdaResultParser::readTxt(tempFile->fileName(), productValueType)) { |
|
134 | 134 | emit dataProvided(dataId, dataSeries, dateTime); |
|
135 | 135 | } |
|
136 | 136 | else { |
|
137 | 137 | /// @todo ALX : debug |
|
138 | 138 | } |
|
139 | 139 | } |
|
140 | 140 | } |
|
141 | 141 | |
|
142 | 142 | }; |
|
143 | 143 | auto httpFinishedLambda |
|
144 | 144 | = [this, httpDownloadFinished, tempFile](QNetworkReply *reply, QUuid dataId) noexcept { |
|
145 | 145 | |
|
146 | 146 | // Don't do anything if the reply was abort |
|
147 | 147 | if (reply->error() != QNetworkReply::OperationCanceledError) { |
|
148 | 148 | auto downloadFileUrl = QUrl{QString{reply->readAll()}}; |
|
149 | 149 | |
|
150 | 150 | |
|
151 | 151 | qCInfo(LOG_AmdaProvider()) |
|
152 | 152 | << tr("TORM AmdaProvider::retrieveData downloadFileUrl:") << downloadFileUrl; |
|
153 | 153 | // Executes request for downloading file // |
|
154 | 154 | |
|
155 | 155 | // Creates destination file |
|
156 | 156 | if (tempFile->open()) { |
|
157 | 157 | // Executes request |
|
158 | 158 | emit requestConstructed(QNetworkRequest{downloadFileUrl}, dataId, |
|
159 | 159 | httpDownloadFinished); |
|
160 | 160 | } |
|
161 | 161 | } |
|
162 | 162 | }; |
|
163 | 163 | |
|
164 | 164 | // //////////////// // |
|
165 | 165 | // Executes request // |
|
166 | 166 | // //////////////// // |
|
167 | 167 | emit requestConstructed(QNetworkRequest{url}, token, httpFinishedLambda); |
|
168 | 168 | } |
@@ -1,197 +1,197 | |||
|
1 | 1 | #include "AmdaProvider.h" |
|
2 | 2 | #include "AmdaResultParser.h" |
|
3 | 3 | |
|
4 | 4 | #include "SqpApplication.h" |
|
5 | 5 | #include <Data/DataSeries.h> |
|
6 | 6 | #include <Data/IDataSeries.h> |
|
7 | 7 | #include <Data/ScalarSeries.h> |
|
8 | 8 | #include <Time/TimeController.h> |
|
9 | 9 | #include <Variable/Variable.h> |
|
10 | 10 | #include <Variable/VariableController.h> |
|
11 | 11 | |
|
12 | 12 | #include <QObject> |
|
13 | 13 | #include <QtTest> |
|
14 | 14 | |
|
15 | 15 | #include <memory> |
|
16 | 16 | |
|
17 | 17 | // TEST with REF: |
|
18 | 18 | // AmdaData-2012-01-01-12-00-00_2012-01-03-12-00-00 |
|
19 | 19 | // imf(0) - Type : Local Parameter @ CDPP/AMDA - |
|
20 | 20 | // Name : bx_gse - Units : nT - Size : 1 - |
|
21 | 21 | // Frame : GSE - Mission : ACE - |
|
22 | 22 | // Instrument : MFI - Dataset : mfi_final-prelim |
|
23 | 23 | // REFERENCE DOWNLOAD FILE = |
|
24 | 24 | // http://amda.irap.omp.eu/php/rest/getParameter.php?startTime=2012-01-01T12:00:00&stopTime=2012-01-03T12:00:00¶meterID=imf(0)&outputFormat=ASCII&timeFormat=ISO8601&gzip=0 |
|
25 | 25 | |
|
26 | 26 | namespace { |
|
27 | 27 | |
|
28 | 28 | /// Path for the tests |
|
29 | 29 | const auto TESTS_RESOURCES_PATH |
|
30 | 30 | = QFileInfo{QString{AMDA_TESTS_RESOURCES_DIR}, "TestAmdaAcquisition"}.absoluteFilePath(); |
|
31 | 31 | |
|
32 | 32 | const auto TESTS_AMDA_REF_FILE = QString{"AmdaData-2012-01-01-12-00-00_2012-01-03-12-00-00.txt"}; |
|
33 | 33 | |
|
34 | 34 | template <typename T> |
|
35 | 35 | bool compareDataSeries(std::shared_ptr<IDataSeries> candidate, SqpRange candidateCacheRange, |
|
36 | 36 | std::shared_ptr<IDataSeries> reference) |
|
37 | 37 | { |
|
38 | 38 | auto compareLambda = [](const auto &it1, const auto &it2) { |
|
39 | 39 | return (it1.x() == it2.x()) && (it1.value() == it2.value()); |
|
40 | 40 | }; |
|
41 | 41 | |
|
42 | 42 | auto candidateDS = std::dynamic_pointer_cast<T>(candidate); |
|
43 | 43 | auto referenceDS = std::dynamic_pointer_cast<T>(reference); |
|
44 | 44 | |
|
45 | 45 | if (candidateDS && referenceDS) { |
|
46 | 46 | |
|
47 | 47 | auto itRefs |
|
48 | 48 | = referenceDS->xAxisRange(candidateCacheRange.m_TStart, candidateCacheRange.m_TEnd); |
|
49 | 49 | qDebug() << " DISTANCE" << std::distance(candidateDS->cbegin(), candidateDS->cend()) |
|
50 | 50 | << std::distance(itRefs.first, itRefs.second); |
|
51 | 51 | |
|
52 | 52 | // auto xcValue = candidateDS->valuesData()->data(); |
|
53 | 53 | // auto dist = std::distance(itRefs.first, itRefs.second); |
|
54 | 54 | // auto it = itRefs.first; |
|
55 | 55 | // for (auto i = 0; i < dist - 1; ++i) { |
|
56 | 56 | // ++it; |
|
57 | 57 | // qInfo() << "END:" << it->value(); |
|
58 | 58 | // } |
|
59 | 59 | // qDebug() << "END:" << it->value() << xcValue.last(); |
|
60 | 60 | |
|
61 | 61 | return std::equal(candidateDS->cbegin(), candidateDS->cend(), itRefs.first, itRefs.second, |
|
62 | 62 | compareLambda); |
|
63 | 63 | } |
|
64 | 64 | else { |
|
65 | 65 | return false; |
|
66 | 66 | } |
|
67 | 67 | } |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | class TestAmdaAcquisition : public QObject { |
|
71 | 71 | Q_OBJECT |
|
72 | 72 | |
|
73 | 73 | private slots: |
|
74 | 74 | void testAcquisition(); |
|
75 | 75 | }; |
|
76 | 76 | |
|
77 | 77 | void TestAmdaAcquisition::testAcquisition() |
|
78 | 78 | { |
|
79 | 79 | // READ the ref file: |
|
80 | 80 | auto filePath = QFileInfo{TESTS_RESOURCES_PATH, TESTS_AMDA_REF_FILE}.absoluteFilePath(); |
|
81 | 81 | auto results = AmdaResultParser::readTxt(filePath, AmdaResultParser::ValueType::SCALAR); |
|
82 | 82 | |
|
83 | 83 | auto provider = std::make_shared<AmdaProvider>(); |
|
84 | 84 | auto timeController = std::make_unique<TimeController>(); |
|
85 | 85 | |
|
86 | 86 | auto varRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 3, 0, 0}}; |
|
87 | 87 | auto varRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 4, 0, 0}}; |
|
88 | 88 | |
|
89 | 89 | auto sqpR = SqpRange{DateUtils::secondsSinceEpoch(varRS), DateUtils::secondsSinceEpoch(varRE)}; |
|
90 | 90 | |
|
91 | 91 | timeController->onTimeToUpdate(sqpR); |
|
92 | 92 | |
|
93 | 93 | QVariantHash metaData; |
|
94 | 94 | metaData.insert("dataType", "scalar"); |
|
95 | 95 | metaData.insert("xml:id", "imf(0)"); |
|
96 | 96 | |
|
97 | 97 | VariableController vc; |
|
98 | 98 | vc.setTimeController(timeController.get()); |
|
99 | 99 | |
|
100 | 100 | auto var = vc.createVariable("bx_gse", metaData, provider); |
|
101 | 101 | |
|
102 | 102 | // 1 : Variable creation |
|
103 | 103 | QCOMPARE(var->range().m_TStart, sqpR.m_TStart); |
|
104 | 104 | QCOMPARE(var->range().m_TEnd, sqpR.m_TEnd); |
|
105 | 105 | |
|
106 | 106 | qDebug() << " 1: TIMECONTROLLER" << timeController->dateTime(); |
|
107 | 107 | qDebug() << " 1: RANGE " << var->range(); |
|
108 | 108 | qDebug() << " 1: CACHERANGE" << var->cacheRange(); |
|
109 | 109 | |
|
110 | 110 | // wait for 10 sec before asking next request toi permit asynchrone process to finish. |
|
111 | 111 | auto timeToWaitMs = 10000; |
|
112 | 112 | |
|
113 | 113 | QEventLoop loop; |
|
114 | 114 | QTimer::singleShot(timeToWaitMs, &loop, &QEventLoop::quit); |
|
115 | 115 | loop.exec(); |
|
116 | 116 | |
|
117 | 117 | // Tests on acquisition operation |
|
118 | 118 | |
|
119 | 119 | int count = 1; |
|
120 | 120 | |
|
121 | 121 | auto requestDataLoading = [&vc, var, timeToWaitMs, results, &count](auto tStart, auto tEnd) { |
|
122 | 122 | ++count; |
|
123 | 123 | |
|
124 | 124 | auto nextSqpR |
|
125 | 125 | = SqpRange{DateUtils::secondsSinceEpoch(tStart), DateUtils::secondsSinceEpoch(tEnd)}; |
|
126 | 126 | vc.onRequestDataLoading(QVector<std::shared_ptr<Variable> >{} << var, nextSqpR, |
|
127 | 127 | var->range(), true); |
|
128 | 128 | |
|
129 | 129 | QEventLoop loop; |
|
130 | 130 | QTimer::singleShot(timeToWaitMs, &loop, &QEventLoop::quit); |
|
131 | 131 | loop.exec(); |
|
132 | 132 | |
|
133 |
q |
|
|
134 |
q |
|
|
133 | qInfo() << count << "RANGE " << var->range(); | |
|
134 | qInfo() << count << "CACHERANGE" << var->cacheRange(); | |
|
135 | 135 | |
|
136 | 136 | QCOMPARE(var->range().m_TStart, nextSqpR.m_TStart); |
|
137 | 137 | QCOMPARE(var->range().m_TEnd, nextSqpR.m_TEnd); |
|
138 | 138 | |
|
139 | 139 | // Verify dataserie |
|
140 | 140 | QVERIFY(compareDataSeries<ScalarSeries>(var->dataSeries(), var->cacheRange(), results)); |
|
141 | 141 | |
|
142 | 142 | }; |
|
143 | 143 | |
|
144 | 144 | // 2 : pan (jump) left for one hour |
|
145 | 145 | auto nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 1, 0, 0}}; |
|
146 | 146 | auto nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 2, 0, 0}}; |
|
147 |
|
|
|
147 | requestDataLoading(nextVarRS, nextVarRE); | |
|
148 | 148 | |
|
149 | 149 | |
|
150 | 150 | // 3 : pan (jump) right for one hour |
|
151 | 151 | nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 5, 0, 0}}; |
|
152 | 152 | nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 6, 0, 0}}; |
|
153 | 153 | requestDataLoading(nextVarRS, nextVarRE); |
|
154 | 154 | |
|
155 | 155 | // 4 : pan (overlay) right for 30 min |
|
156 | 156 | nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 5, 30, 0}}; |
|
157 | 157 | nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 6, 30, 0}}; |
|
158 | 158 | // requestDataLoading(nextVarRS, nextVarRE); |
|
159 | 159 | |
|
160 | 160 | // 5 : pan (overlay) left for 30 min |
|
161 | 161 | nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 5, 0, 0}}; |
|
162 | 162 | nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 6, 0, 0}}; |
|
163 | 163 | // requestDataLoading(nextVarRS, nextVarRE); |
|
164 | 164 | |
|
165 | 165 | // 6 : pan (overlay) left for 30 min - BIS |
|
166 | 166 | nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 4, 30, 0}}; |
|
167 | 167 | nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 5, 30, 0}}; |
|
168 | 168 | // requestDataLoading(nextVarRS, nextVarRE); |
|
169 | 169 | |
|
170 | 170 | // 7 : Zoom in Inside 20 min range |
|
171 | 171 | nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 4, 50, 0}}; |
|
172 | 172 | nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 5, 10, 0}}; |
|
173 | 173 | // requestDataLoading(nextVarRS, nextVarRE); |
|
174 | 174 | |
|
175 | 175 | // 8 : Zoom out Inside 2 hours range |
|
176 | 176 | nextVarRS = QDateTime{QDate{2012, 01, 02}, QTime{2, 4, 0, 0}}; |
|
177 | 177 | nextVarRE = QDateTime{QDate{2012, 01, 02}, QTime{2, 6, 0, 0}}; |
|
178 | 178 | // requestDataLoading(nextVarRS, nextVarRE); |
|
179 | 179 | |
|
180 | 180 | |
|
181 | 181 | // Close the app after 10 sec |
|
182 | 182 | QTimer::singleShot(timeToWaitMs, &loop, &QEventLoop::quit); |
|
183 | 183 | loop.exec(); |
|
184 | 184 | } |
|
185 | 185 | |
|
186 | 186 | int main(int argc, char *argv[]) |
|
187 | 187 | { |
|
188 | 188 | SqpApplication app(argc, argv); |
|
189 | 189 | app.setAttribute(Qt::AA_Use96Dpi, true); |
|
190 | 190 | TestAmdaAcquisition tc; |
|
191 | 191 | QTEST_SET_MAIN_SOURCE_PATH |
|
192 | 192 | return QTest::qExec(&tc, argc, argv); |
|
193 | 193 | } |
|
194 | 194 | |
|
195 | 195 | // QTEST_MAIN(TestAmdaAcquisition) |
|
196 | 196 | |
|
197 | 197 | #include "TestAmdaAcquisition.moc" |
General Comments 3
Pull request updated. Auto status change to "Under Review"
Changed commits: * 1 added * 0 removed Changed files: * M core/include/Data/AcquisitionRequest.h * M core/include/Variable/VariableAcquisitionWorker.h * M core/include/Variable/VariableCacheStrategy.h * M core/include/Variable/VariableController.h * M core/src/Variable/VariableAcquisitionWorker.cpp * M core/src/Variable/VariableCacheStrategy.cpp * M core/src/Variable/VariableController.cpp * M gui/src/Visualization/VisualizationZoneWidget.cpp * M plugins/amda/include/AmdaPlugin.h * M plugins/amda/src/AmdaProvider.cpp * M plugins/amda/tests/TestAmdaAcquisition.cpp * M plugins/mockplugin/include/MockPlugin.h * R COPYING * R app/src/MainWindow.cpp * R app/ui/MainWindow.ui * R cmake/sciqlop_package_qt.cmake * R core/include/Common/DateUtils.h * R core/include/Common/MetaTypes.h * R core/include/Common/SortUtils.h * R core/include/CoreGlobal.h * R core/include/Data/AcquisitionDataPacket.h * R core/include/Data/ArrayData.h * R core/include/Data/DataProviderParameters.h * R core/include/Data/DataSeries.h * R core/include/Data/DataSeriesIterator.h * R core/include/Data/IDataProvider.h * R core/include/Data/IDataSeries.h * R core/include/Data/ScalarSeries.h * R core/include/Data/SqpRange.h * R core/include/Data/VectorSeries.h * R core/include/DataSource/DataSourceItemAction.h * R core/include/Network/NetworkController.h * R core/include/Plugin/PluginManager.h * R core/include/Settings/ISqpSettingsBindable.h * R core/include/Settings/SqpSettingsDefs.h * R core/include/Time/TimeController.h * R core/include/Variable/Variable.h * R core/include/Variable/VariableCacheController.h * R core/include/Variable/VariableModel.h * R core/include/Variable/VariableSynchronizationGroup.h * R core/include/Visualization/VisualizationController.h * R core/src/Common/DateUtils.cpp * R core/src/Data/DataSeriesIterator.cpp * R core/src/Data/ScalarSeries.cpp * R core/src/Data/VectorSeries.cpp * R core/src/DataSource/DataSourceItemAction.cpp * R core/src/Network/NetworkController.cpp * R core/src/Plugin/PluginManager.cpp * R core/src/Settings/SqpSettingsDefs.cpp * R core/src/Time/TimeController.cpp * R core/src/Variable/Variable.cpp * R core/src/Variable/VariableCacheController.cpp * R core/src/Variable/VariableModel.cpp * R core/src/Variable/VariableSynchronizationGroup.cpp * R core/src/Visualization/VisualizationController.cpp * R core/tests/Data/TestDataSeries.cpp * R core/tests/Data/TestOneDimArrayData.cpp * R core/tests/Data/TestTwoDimArrayData.cpp * R core/tests/Variable/TestVariable.cpp * R core/tests/Variable/TestVariableCacheController.cpp * R gui/include/Common/ColorUtils.h * R gui/include/DataSource/DataSourceTreeWidgetHelper.h * R gui/include/DataSource/DataSourceTreeWidgetItem.h * R gui/include/DataSource/DataSourceWidget.h * R gui/include/Settings/SqpSettingsDialog.h * R gui/include/Settings/SqpSettingsGeneralWidget.h * R gui/include/SidePane/SqpSidePane.h * R gui/include/TimeWidget/TimeWidget.h * R gui/include/Variable/VariableInspectorWidget.h * R gui/include/Variable/VariableMenuHeaderWidget.h * R gui/include/Visualization/IVariableContainer.h * R gui/include/Visualization/IVisualizationWidget.h * R gui/include/Visualization/IVisualizationWidgetVisitor.h * R gui/include/Visualization/VisualizationDefs.h * R gui/include/Visualization/VisualizationGraphHelper.h * R gui/include/Visualization/VisualizationGraphRenderingDelegate.h * R gui/include/Visualization/VisualizationGraphWidget.h * R gui/include/Visualization/VisualizationTabWidget.h * R gui/include/Visualization/VisualizationWidget.h * R gui/include/Visualization/VisualizationZoneWidget.h * R gui/include/Visualization/operations/GenerateVariableMenuOperation.h * R gui/include/Visualization/operations/MenuBuilder.h * R gui/include/Visualization/operations/RemoveVariableOperation.h * R gui/include/Visualization/operations/RescaleAxeOperation.h * R gui/include/Visualization/qcustomplot.h * R gui/resources/icones/dataSourceComponent.png * R gui/resources/icones/dataSourceNode.png * R gui/resources/icones/dataSourceProduct.png * R gui/resources/icones/dataSourceRoot.png * R gui/resources/icones/delete.png * R gui/resources/icones/next.png * R gui/resources/icones/openInspector.png * R gui/resources/icones/plot.png * R gui/resources/icones/previous.png * R gui/resources/icones/sciqlop2PNG_1024.png * R gui/resources/icones/unplot.png * R gui/resources/sqpguiresources.qrc * R gui/src/Common/ColorUtils.cpp * R gui/src/DataSource/DataSourceTreeWidgetHelper.cpp * R gui/src/DataSource/DataSourceTreeWidgetItem.cpp * R gui/src/DataSource/DataSourceWidget.cpp * R gui/src/Settings/SqpSettingsDialog.cpp * R gui/src/Settings/SqpSettingsGeneralWidget.cpp * R gui/src/SidePane/SqpSidePane.cpp * R gui/src/TimeWidget/TimeWidget.cpp * R gui/src/Variable/VariableInspectorWidget.cpp * R gui/src/Variable/VariableMenuHeaderWidget.cpp * R gui/src/Visualization/VisualizationGraphHelper.cpp * R gui/src/Visualization/VisualizationGraphRenderingDelegate.cpp * R gui/src/Visualization/VisualizationGraphWidget.cpp * R gui/src/Visualization/VisualizationTabWidget.cpp * R gui/src/Visualization/VisualizationWidget.cpp * R gui/src/Visualization/operations/GenerateVariableMenuOperation.cpp * R gui/src/Visualization/operations/MenuBuilder.cpp * R gui/src/Visualization/operations/RemoveVariableOperation.cpp * R gui/src/Visualization/operations/RescaleAxeOperation.cpp * R gui/src/Visualization/qcustomplot.cpp * R gui/ui/DataSource/DataSourceWidget.ui * R gui/ui/Settings/SqpSettingsDialog.ui * R gui/ui/Settings/SqpSettingsGeneralWidget.ui * R gui/ui/SidePane/SqpSidePane.ui * R gui/ui/TimeWidget/TimeWidget.ui * R gui/ui/Variable/VariableInspectorWidget.ui * R gui/ui/Variable/VariableMenuHeaderWidget.ui * R gui/ui/Visualization/VisualizationGraphWidget.ui * R gui/ui/Visualization/VisualizationTabWidget.ui * R gui/ui/Visualization/VisualizationWidget.ui * R gui/ui/Visualization/VisualizationZoneWidget.ui * R gui/vera-exclusions/exclusions.txt * R plugin/CMakeLists.txt * R plugin/cmake/Findsciqlop-plugin.cmake * R plugin/include/Plugin/IPlugin.h * R plugins/amda/CMakeLists.txt * R plugins/amda/cmake/Findsciqlop-amda.cmake * R plugins/amda/include/AmdaDefs.h * R plugins/amda/include/AmdaGlobal.h * R plugins/amda/include/AmdaParser.h * R plugins/amda/include/AmdaProvider.h * R plugins/amda/include/AmdaResultParser.h * R plugins/amda/resources/amda.json * R plugins/amda/resources/amdaresources.qrc * R plugins/amda/resources/samples/AmdaSample.json * R plugins/amda/resources/samples/AmdaSampleV2.json * R plugins/amda/src/AmdaDefs.cpp * R plugins/amda/src/AmdaParser.cpp * R plugins/amda/src/AmdaPlugin.cpp * R plugins/amda/src/AmdaResultParser.cpp * R plugins/amda/tests-resources/TestAmdaAcquisition/AmdaData-2012-01-01-12-00-00_2012-01-03-12-00-00.txt * R plugins/amda/tests-resources/TestAmdaParser/TwoRootsFile.json * R plugins/amda/tests-resources/TestAmdaParser/ValidFile1.json * R plugins/amda/tests-resources/TestAmdaParser/WrongRootKey.json * R plugins/amda/tests-resources/TestAmdaParser/WrongRootType.json * R plugins/amda/tests-resources/TestAmdaResultParser/FileNotFound.txt * R plugins/amda/tests-resources/TestAmdaResultParser/NaNValue.txt * R plugins/amda/tests-resources/TestAmdaResultParser/NaNX.txt * R plugins/amda/tests-resources/TestAmdaResultParser/NoUnit.txt * R plugins/amda/tests-resources/TestAmdaResultParser/TooManyValues.txt * R plugins/amda/tests-resources/TestAmdaResultParser/ValidScalar1.txt * R plugins/amda/tests-resources/TestAmdaResultParser/ValidVector1.txt * R plugins/amda/tests-resources/TestAmdaResultParser/WrongDate.txt * R plugins/amda/tests-resources/TestAmdaResultParser/WrongUnit.txt * R plugins/amda/tests-resources/TestAmdaResultParser/WrongValue.txt * R plugins/amda/tests/TestAmdaParser.cpp * R plugins/amda/tests/TestAmdaResultParser.cpp * R plugins/mockplugin/CMakeLists.txt * R plugins/mockplugin/cmake/Findsciqlop-mockplugin.cmake * R plugins/mockplugin/include/CosinusProvider.h * R plugins/mockplugin/include/MockPluginGlobal.h * R plugins/mockplugin/resources/mockplugin.json * R plugins/mockplugin/src/CosinusProvider.cpp * R plugins/mockplugin/src/MockPlugin.cpp * R README.md * R app/CMakeLists.txt * R app/include/MainWindow.h * R app/src/Main.cpp * R app/vera-exclusions/exclusions.txt * R cmake/sciqlop.cmake * R cmake/sciqlop_applications.cmake * R cmake/sciqlop_package.cmake * R cmake/sciqlop_params.cmake * R core/CMakeLists.txt * R core/include/Common/spimpl.h * R core/include/DataSource/DataSourceController.h * R core/include/DataSource/DataSourceItem.h * R core/src/DataSource/DataSourceController.cpp * R core/src/DataSource/DataSourceItem.cpp * R core/tests/DataSource/TestDataSourceController.cpp * R core/vera-exclusions/exclusions.txt * R formatting/cmake/use_clangformat.cmake * R formatting/vera-exclusions/exclusions.txt * R gui/CMakeLists.txt * R gui/include/SqpApplication.h * R gui/src/SqpApplication.cpp * R LICENSE * R app/src/mainwindow.cpp * R app/src/mainwindow.ui
Status change > Approved
You need to be logged in to leave comments.
Login now