Auto status change to "Under Review"
@@ -117,6 +117,8 struct VariableController::VariableControllerPrivate { | |||
|
117 | 117 | void updateVariableRequest(QUuid varRequestId); |
|
118 | 118 | void cancelVariableRequest(QUuid varRequestId); |
|
119 | 119 | |
|
120 | SqpRange getLastRequestedRange(QUuid varId); | |
|
121 | ||
|
120 | 122 | QMutex m_WorkingMutex; |
|
121 | 123 | /// Variable model. The VariableController has the ownership |
|
122 | 124 | VariableModel *m_VariableModel; |
@@ -570,18 +572,28 void VariableController::VariableControllerPrivate::processRequest(std::shared_p | |||
|
570 | 572 | const SqpRange &rangeRequested, |
|
571 | 573 | QUuid varRequestId) |
|
572 | 574 | { |
|
573 | ||
|
574 | // TODO: protect at | |
|
575 | 575 | auto varRequest = VariableRequest{}; |
|
576 | auto varId = m_VariableToIdentifierMap.at(var); | |
|
576 | ||
|
577 | auto it = m_VariableToIdentifierMap.find(var); | |
|
578 | if (it != m_VariableToIdentifierMap.cend()) { | |
|
579 | ||
|
580 | auto varId = it->second; | |
|
581 | ||
|
582 | auto oldRange = getLastRequestedRange(varId); | |
|
583 | ||
|
584 | // check for update oldRange to the last request range. | |
|
585 | if (oldRange == INVALID_RANGE) { | |
|
586 | oldRange = var->range(); | |
|
587 | } | |
|
577 | 588 | |
|
578 | 589 | auto varStrategyRangesRequested |
|
579 |
= m_VariableCacheStrategy->computeRange( |
|
|
590 | = m_VariableCacheStrategy->computeRange(oldRange, rangeRequested); | |
|
580 | 591 | |
|
581 | 592 | auto notInCacheRangeList = QVector<SqpRange>{varStrategyRangesRequested.second}; |
|
582 | 593 | auto inCacheRangeList = QVector<SqpRange>{}; |
|
583 | 594 | if (m_VarIdToVarRequestIdQueueMap.find(varId) == m_VarIdToVarRequestIdQueueMap.cend()) { |
|
584 | notInCacheRangeList = var->provideNotInCacheRangeList(varStrategyRangesRequested.second); | |
|
595 | notInCacheRangeList | |
|
596 | = var->provideNotInCacheRangeList(varStrategyRangesRequested.second); | |
|
585 | 597 | inCacheRangeList = var->provideInCacheRangeList(varStrategyRangesRequested.second); |
|
586 | 598 | } |
|
587 | 599 | |
@@ -620,8 +632,9 void VariableController::VariableControllerPrivate::processRequest(std::shared_p | |||
|
620 | 632 | varRequest.m_CacheRangeRequested = varStrategyRangesRequested.second; |
|
621 | 633 | // store VarRequest |
|
622 | 634 | storeVariableRequest(varId, varRequestId, varRequest); |
|
623 |
acceptVariableRequest( |
|
|
624 |
|
|
|
635 | acceptVariableRequest( | |
|
636 | varId, var->dataSeries()->subDataSeries(varStrategyRangesRequested.second)); | |
|
637 | } | |
|
625 | 638 | } |
|
626 | 639 | } |
|
627 | 640 | |
@@ -838,3 +851,40 void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid | |||
|
838 | 851 | } |
|
839 | 852 | } |
|
840 | 853 | } |
|
854 | ||
|
855 | SqpRange VariableController::VariableControllerPrivate::getLastRequestedRange(QUuid varId) | |
|
856 | { | |
|
857 | auto lastRangeRequested = SqpRange{INVALID_RANGE}; | |
|
858 | auto varIdToVarRequestIdQueueMapIt = m_VarIdToVarRequestIdQueueMap.find(varId); | |
|
859 | if (varIdToVarRequestIdQueueMapIt != m_VarIdToVarRequestIdQueueMap.cend()) { | |
|
860 | auto &varRequestIdQueue = varIdToVarRequestIdQueueMapIt->second; | |
|
861 | auto varRequestId = varRequestIdQueue.back(); | |
|
862 | auto varRequestIdToVarIdVarRequestMapIt | |
|
863 | = m_VarRequestIdToVarIdVarRequestMap.find(varRequestId); | |
|
864 | if (varRequestIdToVarIdVarRequestMapIt != m_VarRequestIdToVarIdVarRequestMap.cend()) { | |
|
865 | auto &varIdToVarRequestMap = varRequestIdToVarIdVarRequestMapIt->second; | |
|
866 | auto varIdToVarRequestMapIt = varIdToVarRequestMap.find(varId); | |
|
867 | if (varIdToVarRequestMapIt != varIdToVarRequestMap.cend()) { | |
|
868 | auto &varRequest = varIdToVarRequestMapIt->second; | |
|
869 | lastRangeRequested = varRequest.m_RangeRequested; | |
|
870 | } | |
|
871 | else { | |
|
872 | qCDebug(LOG_VariableController()) | |
|
873 | << tr("Impossible to getLastRequestedRange of a unknown variable id attached " | |
|
874 | "to a variableRequestId") | |
|
875 | << varRequestId << varId; | |
|
876 | } | |
|
877 | } | |
|
878 | else { | |
|
879 | qCCritical(LOG_VariableController()) | |
|
880 | << tr("Impossible to getLastRequestedRange of a unknown variableRequestId") | |
|
881 | << varRequestId; | |
|
882 | } | |
|
883 | } | |
|
884 | else { | |
|
885 | qDebug(LOG_VariableController()) | |
|
886 | << tr("Impossible to getLastRequestedRange of a unknown variable id") << varId; | |
|
887 | } | |
|
888 | ||
|
889 | return lastRangeRequested; | |
|
890 | } |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now