##// END OF EJS Templates
push method of worker return the id of the nextRange which is canceled
perrinel -
r625:d6648352006d
parent child
Show More
@@ -28,9 +28,9 public:
28 28 explicit VariableAcquisitionWorker(QObject *parent = 0);
29 29 virtual ~VariableAcquisitionWorker();
30 30
31 void pushVariableRequest(QUuid vIdentifier, SqpRange rangeRequested,
32 SqpRange cacheRangeRequested, DataProviderParameters parameters,
33 std::shared_ptr<IDataProvider> provider);
31 QUuid pushVariableRequest(QUuid varRequestId, QUuid vIdentifier, SqpRange rangeRequested,
32 SqpRange cacheRangeRequested, DataProviderParameters parameters,
33 std::shared_ptr<IDataProvider> provider);
34 34
35 35 void abortProgressRequested(QUuid vIdentifier);
36 36
@@ -46,16 +46,19 VariableAcquisitionWorker::~VariableAcquisitionWorker()
46 46 }
47 47
48 48
49 void VariableAcquisitionWorker::pushVariableRequest(QUuid vIdentifier, SqpRange rangeRequested,
50 SqpRange cacheRangeRequested,
51 DataProviderParameters parameters,
52 std::shared_ptr<IDataProvider> provider)
49 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid vIdentifier,
50 SqpRange rangeRequested,
51 SqpRange cacheRangeRequested,
52 DataProviderParameters parameters,
53 std::shared_ptr<IDataProvider> provider)
53 54 {
54 55 qCInfo(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;
@@ -63,6 +66,7 void VariableAcquisitionWorker::pushVariableRequest(QUuid vIdentifier, SqpRange
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(
@@ -71,6 +75,13 void VariableAcquisitionWorker::pushVariableRequest(QUuid vIdentifier, SqpRange
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 }
@@ -83,6 +94,8 void VariableAcquisitionWorker::pushVariableRequest(QUuid vIdentifier, SqpRange
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)
General Comments 0
You need to be logged in to leave comments. Login now