##// END OF EJS Templates
Reads variable's metadata to retrieve the type of data series (scalar, vector, spectrogram)
Reads variable's metadata to retrieve the type of data series (scalar, vector, spectrogram)

File last commit:

r1214:feac825a443e
r1250:23206e07bbc2
Show More
VariableController.cpp
1069 lines | 42.9 KiB | text/x-c | CppLexer
/ core / src / Variable / VariableController.cpp
The mock plugin can now create data with view operation
r235 #include <Variable/Variable.h>
Implementation of V5 acquisition
r539 #include <Variable/VariableAcquisitionWorker.h>
#include <Variable/VariableCacheStrategy.h>
Alexandre Leroux
Updates cache strategy
r771 #include <Variable/VariableCacheStrategyFactory.h>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 #include <Variable/VariableController.h>
Alexandre Leroux
Adds Variable model in the Variable controller
r113 #include <Variable/VariableModel.h>
Implementation of V5 acquisition
r539 #include <Variable/VariableSynchronizationGroup.h>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111
Alexandre Leroux
Updates VariableController::createVariable() method...
r166 #include <Data/DataProviderParameters.h>
#include <Data/IDataProvider.h>
#include <Data/IDataSeries.h>
Add implementation of the Var Acquisition waiting
r626 #include <Data/VariableRequest.h>
Time widget is now used with the variable createion request
r193 #include <Time/TimeController.h>
Alexandre Leroux
Updates VariableController::createVariable() method...
r166
Drag of variables
r849 #include <QDataStream>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 #include <QMutex>
#include <QThread>
Alexandre Leroux
Transits tokens in provider requests
r376 #include <QUuid>
Temporal parameters of the selected variables can be updated using the...
r304 #include <QtCore/QItemSelectionModel>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111
Add implementation of the Var Acquisition waiting
r626 #include <deque>
Implementation of V5 acquisition
r539 #include <set>
Create a variable notify the variable cache parameter
r225 #include <unordered_map>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
Implementation of V5 acquisition
r539 namespace {
change grapheRange to graphRange
r545 SqpRange computeSynchroRangeRequested(const SqpRange &varRange, const SqpRange &graphRange,
Implementation of V5 acquisition
r539 const SqpRange &oldGraphRange)
{
change grapheRange to graphRange
r545 auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
Implementation of V5 acquisition
r539
auto varRangeRequested = varRange;
switch (zoomType) {
case AcquisitionZoomType::ZoomIn: {
change grapheRange to graphRange
r545 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
Implementation of V5 acquisition
r539 varRangeRequested.m_TStart += deltaLeft;
varRangeRequested.m_TEnd -= deltaRight;
break;
}
case AcquisitionZoomType::ZoomOut: {
change grapheRange to graphRange
r545 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
Implementation of V5 acquisition
r539 varRangeRequested.m_TStart -= deltaLeft;
varRangeRequested.m_TEnd += deltaRight;
break;
}
case AcquisitionZoomType::PanRight: {
Fix bug in synchro for operation (jump + rescaling)
r809 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
change grapheRange to graphRange
r545 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
Fix bug in synchro for operation (jump + rescaling)
r809 varRangeRequested.m_TStart += deltaLeft;
Implementation of V5 acquisition
r539 varRangeRequested.m_TEnd += deltaRight;
break;
}
case AcquisitionZoomType::PanLeft: {
change grapheRange to graphRange
r545 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
Fix bug in synchro for operation (jump + rescaling)
r809 auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
Implementation of V5 acquisition
r539 varRangeRequested.m_TStart -= deltaLeft;
Fix bug in synchro for operation (jump + rescaling)
r809 varRangeRequested.m_TEnd -= deltaRight;
Implementation of V5 acquisition
r539 break;
}
case AcquisitionZoomType::Unknown: {
qCCritical(LOG_VariableController())
<< VariableController::tr("Impossible to synchronize: zoom type unknown");
break;
}
default:
qCCritical(LOG_VariableController()) << VariableController::tr(
"Impossible to synchronize: zoom type not take into account");
// No action
break;
}
return varRangeRequested;
}
}
Modify variable controller request managing with introduction of current
r825 enum class VariableRequestHandlerState { OFF, RUNNING, PENDING };
struct VariableRequestHandler {
VariableRequestHandler()
{
m_CanUpdate = false;
m_State = VariableRequestHandlerState::OFF;
}
QUuid m_VarId;
VariableRequest m_RunningVarRequest;
VariableRequest m_PendingVarRequest;
VariableRequestHandlerState m_State;
bool m_CanUpdate;
};
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 struct VariableController::VariableControllerPrivate {
Alexandre Leroux
Use raw pointer for VariableModel (QObject class)
r159 explicit VariableControllerPrivate(VariableController *parent)
Create a variable notify the variable cache parameter
r225 : m_WorkingMutex{},
m_VariableModel{new VariableModel{parent}},
Temporal parameters of the selected variables can be updated using the...
r304 m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}},
Alexandre Leroux
Updates cache strategy
r771 // m_VariableCacheStrategy{std::make_unique<VariableCacheStrategy>()},
m_VariableCacheStrategy{VariableCacheStrategyFactory::createCacheStrategy(
CacheStrategy::SingleThreshold)},
add Skeleton for displaying data which are already in cache
r571 m_VariableAcquisitionWorker{std::make_unique<VariableAcquisitionWorker>()},
q{parent}
Implementation of V5 acquisition
r539 {
m_VariableAcquisitionWorker->moveToThread(&m_VariableAcquisitionWorkerThread);
m_VariableAcquisitionWorkerThread.setObjectName("VariableAcquisitionWorkerThread");
}
virtual ~VariableControllerPrivate()
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 {
Implementation of V5 acquisition
r539 qCDebug(LOG_VariableController()) << tr("VariableControllerPrivate destruction");
m_VariableAcquisitionWorkerThread.quit();
m_VariableAcquisitionWorkerThread.wait();
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 }
Implementation of V5 acquisition
r539
Add implementation of the Var Acquisition waiting
r626 void processRequest(std::shared_ptr<Variable> var, const SqpRange &rangeRequested,
QUuid varRequestId);
Implementation of V5 acquisition
r539
std::shared_ptr<Variable> findVariable(QUuid vIdentifier);
std::shared_ptr<IDataSeries>
retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector);
void registerProvider(std::shared_ptr<IDataProvider> provider);
Add implementation of the Var Acquisition waiting
r626 void storeVariableRequest(QUuid varId, QUuid varRequestId, const VariableRequest &varRequest);
QUuid acceptVariableRequest(QUuid varId, std::shared_ptr<IDataSeries> dataSeries);
Modify variable controller request managing with introduction of current
r825 void updateVariables(QUuid varRequestId);
Add implementation of the Var Acquisition waiting
r626 void updateVariableRequest(QUuid varRequestId);
void cancelVariableRequest(QUuid varRequestId);
Modify variable controller request managing with introduction of current
r825 void executeVarRequest(std::shared_ptr<Variable> var, VariableRequest &varRequest);
Next var request parameter is now based on previous request instead of...
r807
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 QMutex m_WorkingMutex;
Alexandre Leroux
Use raw pointer for VariableModel (QObject class)
r159 /// Variable model. The VariableController has the ownership
VariableModel *m_VariableModel;
Temporal parameters of the selected variables can be updated using the...
r304 QItemSelectionModel *m_VariableSelectionModel;
Time widget is now used with the variable createion request
r193
Create a variable notify the variable cache parameter
r225
Correction MR
r195 TimeController *m_TimeController{nullptr};
Implementation of V5 acquisition
r539 std::unique_ptr<VariableCacheStrategy> m_VariableCacheStrategy;
std::unique_ptr<VariableAcquisitionWorker> m_VariableAcquisitionWorker;
QThread m_VariableAcquisitionWorkerThread;
The mock plugin can now create data with view operation
r235
std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> >
m_VariableToProviderMap;
Alexandre Leroux
Corrects regression on variable destruction
r420 std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap;
Implementation of V5 acquisition
r539 std::map<QUuid, std::shared_ptr<VariableSynchronizationGroup> >
m_GroupIdToVariableSynchronizationGroupMap;
std::map<QUuid, QUuid> m_VariableIdGroupIdMap;
std::set<std::shared_ptr<IDataProvider> > m_ProviderSet;
add Skeleton for displaying data which are already in cache
r571
Modify variable controller request managing with introduction of current
r825 std::map<QUuid, std::list<QUuid> > m_VarGroupIdToVarIds;
std::map<QUuid, std::unique_ptr<VariableRequestHandler> > m_VarIdToVarRequestHandler;
Add implementation of the Var Acquisition waiting
r626
add Skeleton for displaying data which are already in cache
r571 VariableController *q;
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 };
Implementation of V5 acquisition
r539
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 VariableController::VariableController(QObject *parent)
Alexandre Leroux
Use raw pointer for VariableModel (QObject class)
r159 : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)}
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 {
Correction clang format
r365 qCDebug(LOG_VariableController()) << tr("VariableController construction")
<< QThread::currentThread();
Implement of the abort download process
r422
connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this,
&VariableController::onAbortProgressRequested);
Implementation of V5 acquisition
r539
Implementation of automatic cancel for request that failed
r761 connect(impl->m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::variableCanceledRequested, this,
&VariableController::onAbortAcquisitionRequested);
Implementation of V5 acquisition
r539 connect(impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::dataProvided, this,
&VariableController::onDataProvided);
connect(impl->m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::variableRequestInProgress, this,
&VariableController::onVariableRetrieveDataInProgress);
Implementation of automatic cancel for request that failed
r761
Implementation of V5 acquisition
r539 connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::started,
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::initialize);
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::finished,
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::finalize);
Drop TIME mime data on a variable
r933 connect(impl->m_VariableModel, &VariableModel::requestVariableRangeUpdate, this,
&VariableController::onUpdateDateTime);
Implementation of V5 acquisition
r539
impl->m_VariableAcquisitionWorkerThread.start();
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 }
VariableController::~VariableController()
{
Correction clang format
r365 qCDebug(LOG_VariableController()) << tr("VariableController destruction")
<< QThread::currentThread();
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 this->waitForFinish();
}
Alexandre Leroux
Updates VariableController::createVariable() method...
r166 VariableModel *VariableController::variableModel() noexcept
Alexandre Leroux
Adds Variable model in the Variable controller
r113 {
Alexandre Leroux
Updates VariableController::createVariable() method...
r166 return impl->m_VariableModel;
Alexandre Leroux
Adds Variable model in the Variable controller
r113 }
Temporal parameters of the selected variables can be updated using the...
r304 QItemSelectionModel *VariableController::variableSelectionModel() noexcept
{
return impl->m_VariableSelectionModel;
}
Time widget is now used with the variable createion request
r193 void VariableController::setTimeController(TimeController *timeController) noexcept
{
impl->m_TimeController = timeController;
}
Alexandre Leroux
Adds 'Duplicate' action on variable menu
r706 std::shared_ptr<Variable>
VariableController::cloneVariable(std::shared_ptr<Variable> variable) noexcept
{
Alexandre Leroux
Creates duplicate only if the variable is in the model
r710 if (impl->m_VariableModel->containsVariable(variable)) {
// Clones variable
auto duplicate = variable->clone();
Alexandre Leroux
Clones variable
r707
Alexandre Leroux
Creates duplicate only if the variable is in the model
r710 // Adds clone to model
impl->m_VariableModel->addVariable(duplicate);
Alexandre Leroux
Adds variable to model
r708
Alexandre Leroux
Generates clone identifier in controller
r711 // Generates clone identifier
impl->m_VariableToIdentifierMap[duplicate] = QUuid::createUuid();
Alexandre Leroux
Generates and registers clone provider
r712 // Registers provider
auto variableProvider = impl->m_VariableToProviderMap.at(variable);
auto duplicateProvider = variableProvider != nullptr ? variableProvider->clone() : nullptr;
impl->m_VariableToProviderMap[duplicate] = duplicateProvider;
if (duplicateProvider) {
impl->registerProvider(duplicateProvider);
}
Alexandre Leroux
Creates duplicate only if the variable is in the model
r710 return duplicate;
}
else {
qCCritical(LOG_VariableController())
<< tr("Can't create duplicate of variable %1: variable not registered in the model")
.arg(variable->name());
return nullptr;
}
Alexandre Leroux
Adds 'Duplicate' action on variable menu
r706 }
Alexandre Leroux
Variable deletion (1)...
r329 void VariableController::deleteVariable(std::shared_ptr<Variable> variable) noexcept
{
if (!variable) {
qCCritical(LOG_VariableController()) << "Can't delete variable: variable is null";
return;
}
Alexandre Leroux
Variable deletion (6)...
r335 // Spreads in SciQlop that the variable will be deleted, so that potential receivers can
// make some treatments before the deletion
emit variableAboutToBeDeleted(variable);
Alexandre Leroux
Variable deletion (2)...
r330
Alexandre Leroux
Corrects regression on variable destruction
r420 // Deletes identifier
impl->m_VariableToIdentifierMap.erase(variable);
Alexandre Leroux
Variable deletion (2)...
r330 // Deletes provider
auto nbProvidersDeleted = impl->m_VariableToProviderMap.erase(variable);
qCDebug(LOG_VariableController())
<< tr("Number of providers deleted for variable %1: %2")
.arg(variable->name(), QString::number(nbProvidersDeleted));
Alexandre Leroux
Variable deletion (1)...
r329
Alexandre Leroux
Variable deletion (2)...
r331
Alexandre Leroux
Variable deletion (3)...
r332 // Deletes from model
impl->m_VariableModel->deleteVariable(variable);
}
Alexandre Leroux
Variable deletion (1)...
r329
void VariableController::deleteVariables(
const QVector<std::shared_ptr<Variable> > &variables) noexcept
{
for (auto variable : qAsConst(variables)) {
deleteVariable(variable);
}
}
Drag of variables
r849 QByteArray
VariableController::mimeDataForVariables(const QList<std::shared_ptr<Variable> > &variables) const
{
auto encodedData = QByteArray{};
QVariantList ids;
for (auto &var : variables) {
auto itVar = impl->m_VariableToIdentifierMap.find(var);
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
qCCritical(LOG_VariableController())
<< tr("Impossible to find the data for an unknown variable.");
}
ids << itVar->second.toByteArray();
}
QDataStream stream{&encodedData, QIODevice::WriteOnly};
stream << ids;
return encodedData;
}
QList<std::shared_ptr<Variable> >
VariableController::variablesForMimeData(const QByteArray &mimeData) const
{
auto variables = QList<std::shared_ptr<Variable> >{};
QDataStream stream{mimeData};
QVariantList ids;
stream >> ids;
for (auto id : ids) {
Drag of product
r868 auto uuid = QUuid{id.toByteArray()};
Drag of variables
r849 auto var = impl->findVariable(uuid);
variables << var;
}
return variables;
}
Add test acquisition.
r590 std::shared_ptr<Variable>
VariableController::createVariable(const QString &name, const QVariantHash &metadata,
std::shared_ptr<IDataProvider> provider) noexcept
Alexandre Leroux
Affects model to the Variable Widget
r152 {
Time widget is now used with the variable createion request
r193 if (!impl->m_TimeController) {
qCCritical(LOG_VariableController())
<< tr("Impossible to create variable: The time controller is null");
Add test acquisition.
r590 return nullptr;
Time widget is now used with the variable createion request
r193 }
Implementation of V5 acquisition
r539 auto range = impl->m_TimeController->dateTime();
Alexandre Leroux
Updates variable creation to pass metadata...
r410
Fix bug when creating two variables crash the app. ...
r756 if (auto newVariable = impl->m_VariableModel->createVariable(name, metadata)) {
Modify variable controller request managing with introduction of current
r825 auto varId = QUuid::createUuid();
// Create the handler
auto varRequestHandler = std::make_unique<VariableRequestHandler>();
varRequestHandler->m_VarId = varId;
impl->m_VarIdToVarRequestHandler.insert(
std::make_pair(varId, std::move(varRequestHandler)));
Create a variable notify the variable cache parameter
r225
The mock plugin can now create data with view operation
r235 // store the provider
Implementation of V5 acquisition
r539 impl->registerProvider(provider);
// Associate the provider
The mock plugin can now create data with view operation
r235 impl->m_VariableToProviderMap[newVariable] = provider;
Modify variable controller request managing with introduction of current
r825 impl->m_VariableToIdentifierMap[newVariable] = varId;
The cache is now updated only if date requested has been successfully...
r318
Modify variable controller request managing with introduction of current
r825 this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{newVariable}, range, false);
The cache is now updated only if date requested has been successfully...
r318
Modify variable controller request managing with introduction of current
r825 // auto varRequestId = QUuid::createUuid();
// qCInfo(LOG_VariableController()) << "createVariable: " << varId << varRequestId;
// impl->processRequest(newVariable, range, varRequestId);
// impl->updateVariableRequest(varRequestId);
Add test acquisition.
r590
return newVariable;
Alexandre Leroux
Updates VariableController::createVariable() method...
r166 }
Alexandre Leroux
Removes compilation warnings (with Meson)
r961
qCCritical(LOG_VariableController()) << tr("Impossible to create variable");
return nullptr;
Alexandre Leroux
Affects model to the Variable Widget
r152 }
Change SqpRange for SqpDateTime
r512 void VariableController::onDateTimeOnSelection(const SqpRange &dateTime)
Temporal parameters of the selected variables can be updated using the...
r304 {
Implémentation timewidget
r811 // NOTE: Even if acquisition request is aborting, the graphe range will be changed
Correction clang format
r365 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
<< QThread::currentThread()->objectName();
Temporal parameters of the selected variables can be updated using the...
r304 auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
Add displaying of cache data available when new acquisition is requested
r831 // NOTE we only permit the time modification for one variable
// DEPRECATED
// auto variables = QVector<std::shared_ptr<Variable> >{};
// for (const auto &selectedRow : qAsConst(selectedRows)) {
// if (auto selectedVariable =
// impl->m_VariableModel->variable(selectedRow.row())) {
// variables << selectedVariable;
// // notify that rescale operation has to be done
// emit rangeChanged(selectedVariable, dateTime);
// }
// }
// if (!variables.isEmpty()) {
// this->onRequestDataLoading(variables, dateTime, synchro);
// }
Implementation on time widget for only one selected variable
r830 if (selectedRows.size() == 1) {
Add displaying of cache data available when new acquisition is requested
r831
Implementation on time widget for only one selected variable
r830 if (auto selectedVariable
= impl->m_VariableModel->variable(qAsConst(selectedRows).first().row())) {
Drop TIME mime data on a variable
r933 onUpdateDateTime(selectedVariable, dateTime);
Temporal parameters of the selected variables can be updated using the...
r304 }
}
Implementation on time widget for only one selected variable
r830 else if (selectedRows.size() > 1) {
qCCritical(LOG_VariableController())
<< tr("Impossible to set time for more than 1 variable in the same time");
}
else {
qCWarning(LOG_VariableController())
<< tr("There is no variable selected to set the time one");
Implémentation timewidget
r811 }
Temporal parameters of the selected variables can be updated using the...
r304 }
Drop TIME mime data on a variable
r933 void VariableController::onUpdateDateTime(std::shared_ptr<Variable> variable,
const SqpRange &dateTime)
{
auto itVar = impl->m_VariableToIdentifierMap.find(variable);
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
qCCritical(LOG_VariableController())
<< tr("Impossible to onDateTimeOnSelection request for unknown variable");
return;
}
// notify that rescale operation has to be done
emit rangeChanged(variable, dateTime);
auto synchro
= impl->m_VariableIdGroupIdMap.find(itVar->second) != impl->m_VariableIdGroupIdMap.cend();
this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{variable}, dateTime, synchro);
}
Implementation of V5 acquisition
r539 void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &rangeRequested,
const SqpRange &cacheRangeRequested,
QVector<AcquisitionDataPacket> dataAcquired)
Add implementation of progress bar on variable inspector connected to...
r401 {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("onDataProvided") << QThread::currentThread();
Add implementation of the Var Acquisition waiting
r626 auto retrievedDataSeries = impl->retrieveDataSeries(dataAcquired);
auto varRequestId = impl->acceptVariableRequest(vIdentifier, retrievedDataSeries);
if (!varRequestId.isNull()) {
Modify variable controller request managing with introduction of current
r825 impl->updateVariables(varRequestId);
Implementation of V5 acquisition
r539 }
}
Add implementation of progress bar on variable inspector connected to...
r401
Implementation of V5 acquisition
r539 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
{
request is now passed by shared pointer instead of const &
r751 qCDebug(LOG_VariableController())
<< "TORM: variableController::onVariableRetrieveDataInProgress"
<< QThread::currentThread()->objectName() << progress;
Correction for MR
r546 if (auto var = impl->findVariable(identifier)) {
Implementation of V5 acquisition
r539 impl->m_VariableModel->setDataProgress(var, progress);
}
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to notify progression of a null variable");
Add implementation of progress bar on variable inspector connected to...
r401 }
}
Implement of the abort download process
r422 void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable)
{
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "TORM: variableController::onAbortProgressRequested"
<< QThread::currentThread()->objectName() << variable->name();
Implement cancel with the new kernel
r827
auto itVar = impl->m_VariableToIdentifierMap.find(variable);
if (itVar == impl->m_VariableToIdentifierMap.cend()) {
qCCritical(LOG_VariableController())
<< tr("Impossible to onAbortProgressRequested request for unknown variable");
return;
}
auto varId = itVar->second;
auto itVarHandler = impl->m_VarIdToVarRequestHandler.find(varId);
if (itVarHandler == impl->m_VarIdToVarRequestHandler.cend()) {
qCCritical(LOG_VariableController())
<< tr("Impossible to onAbortProgressRequested for variable with unknown handler");
return;
}
auto varHandler = itVarHandler->second.get();
// case where a variable has a running request
if (varHandler->m_State != VariableRequestHandlerState::OFF) {
impl->cancelVariableRequest(varHandler->m_RunningVarRequest.m_VariableGroupId);
}
Implement of the abort download process
r422 }
Implementation of automatic cancel for request that failed
r761 void VariableController::onAbortAcquisitionRequested(QUuid vIdentifier)
{
qCDebug(LOG_VariableController()) << "TORM: variableController::onAbortAcquisitionRequested"
<< QThread::currentThread()->objectName() << vIdentifier;
if (auto var = impl->findVariable(vIdentifier)) {
this->onAbortProgressRequested(var);
}
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to abort Acquisition Requestof a null variable");
}
}
Implementation of V5 acquisition
r539 void VariableController::onAddSynchronizationGroupId(QUuid synchronizationGroupId)
{
Add synchronization part of v5 acquisition
r540 qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronizationGroupId"
<< QThread::currentThread()->objectName()
<< synchronizationGroupId;
Implementation of V5 acquisition
r539 auto vSynchroGroup = std::make_shared<VariableSynchronizationGroup>();
impl->m_GroupIdToVariableSynchronizationGroupMap.insert(
std::make_pair(synchronizationGroupId, vSynchroGroup));
}
void VariableController::onRemoveSynchronizationGroupId(QUuid synchronizationGroupId)
{
impl->m_GroupIdToVariableSynchronizationGroupMap.erase(synchronizationGroupId);
}
Add synchronization part of v5 acquisition
r540 void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable,
QUuid synchronizationGroupId)
{
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
<< synchronizationGroupId;
Correction for MR
r546 auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable);
if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
auto groupIdToVSGIt
Add synchronization part of v5 acquisition
r540 = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
Correction for MR
r546 if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
Add synchronization part of v5 acquisition
r540 impl->m_VariableIdGroupIdMap.insert(
Correction for MR
r546 std::make_pair(varToVarIdIt->second, synchronizationGroupId));
groupIdToVSGIt->second->addVariableId(varToVarIdIt->second);
Add synchronization part of v5 acquisition
r540 }
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to synchronize a variable with an unknown sycnhronization group")
<< variable->name();
}
}
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to synchronize a variable with no identifier") << variable->name();
}
}
Alexandre Leroux
Handles desynchronisation when removing variable from a graph (1)...
r737 void VariableController::desynchronize(std::shared_ptr<Variable> variable,
QUuid synchronizationGroupId)
{
// Gets variable id
auto variableIt = impl->m_VariableToIdentifierMap.find(variable);
if (variableIt == impl->m_VariableToIdentifierMap.cend()) {
qCCritical(LOG_VariableController())
<< tr("Can't desynchronize variable %1: variable identifier not found")
.arg(variable->name());
return;
}
// Gets synchronization group
auto groupIt = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
if (groupIt == impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
qCCritical(LOG_VariableController())
<< tr("Can't desynchronize variable %1: unknown synchronization group")
.arg(variable->name());
return;
}
auto variableId = variableIt->second;
// Removes variable from synchronization group
auto synchronizationGroup = groupIt->second;
synchronizationGroup->removeVariableId(variableId);
// Removes link between variable and synchronization group
impl->m_VariableIdGroupIdMap.erase(variableId);
}
The mock plugin can now create data with view operation
r235
Implementation of V5 acquisition
r539 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables,
Implémentation timewidget
r811 const SqpRange &range, bool synchronise)
The mock plugin can now create data with view operation
r235 {
Modify variable controller request managing with introduction of current
r825 // variables is assumed synchronized
// TODO: Asser variables synchronization
The mock plugin can now create data with view operation
r235 // we want to load data of the variable for the dateTime.
Modify variable controller request managing with introduction of current
r825 if (variables.isEmpty()) {
return;
}
The mock plugin can now create data with view operation
r235
Add implementation of the Var Acquisition waiting
r626 auto varRequestId = QUuid::createUuid();
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
Add displaying of cache data available when new acquisition is requested
r831 << QThread::currentThread()->objectName() << varRequestId
<< range << synchronise;
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 if (!synchronise) {
auto varIds = std::list<QUuid>{};
for (const auto &var : variables) {
auto vId = impl->m_VariableToIdentifierMap.at(var);
varIds.push_back(vId);
}
impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds));
for (const auto &var : variables) {
Fix test to make them sucess
r835 qCDebug(LOG_VariableController()) << "processRequest for" << var->name() << varRequestId
<< varIds.size();
Modify variable controller request managing with introduction of current
r825 impl->processRequest(var, range, varRequestId);
}
Implementation of V5 acquisition
r539 }
Modify variable controller request managing with introduction of current
r825 else {
auto vId = impl->m_VariableToIdentifierMap.at(variables.first());
auto varIdToGroupIdIt = impl->m_VariableIdGroupIdMap.find(vId);
if (varIdToGroupIdIt != impl->m_VariableIdGroupIdMap.cend()) {
auto groupId = varIdToGroupIdIt->second;
auto vSynchronizationGroup
= impl->m_GroupIdToVariableSynchronizationGroupMap.at(groupId);
auto vSyncIds = vSynchronizationGroup->getIds();
The mock plugin can now create data with view operation
r235
Modify variable controller request managing with introduction of current
r825 auto varIds = std::list<QUuid>{};
for (auto vId : vSyncIds) {
varIds.push_back(vId);
Implementation of V5 acquisition
r539 }
Modify variable controller request managing with introduction of current
r825 impl->m_VarGroupIdToVarIds.insert(std::make_pair(varRequestId, varIds));
Implementation of V5 acquisition
r539
for (auto vId : vSyncIds) {
auto var = impl->findVariable(vId);
Add synchronization part of v5 acquisition
r540
// Don't process already processed var
Modify variable controller request managing with introduction of current
r825 if (var != nullptr) {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "processRequest synchro for" << var->name()
<< varRequestId;
Modify variable controller request managing with introduction of current
r825 auto vSyncRangeRequested
= variables.contains(var)
? range
: computeSynchroRangeRequested(var->range(), range,
variables.first()->range());
qCDebug(LOG_VariableController()) << "synchro RR" << vSyncRangeRequested;
impl->processRequest(var, vSyncRangeRequested, varRequestId);
}
else {
qCCritical(LOG_VariableController())
Add synchronization part of v5 acquisition
r540
Modify variable controller request managing with introduction of current
r825 << tr("Impossible to synchronize a null variable");
Implementation of V5 acquisition
r539 }
}
Fix the cosinus bug....
r298 }
The mock plugin can now create data with view operation
r235 }
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 impl->updateVariables(varRequestId);
The mock plugin can now create data with view operation
r235 }
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r111 void VariableController::initialize()
{
qCDebug(LOG_VariableController()) << tr("VariableController init") << QThread::currentThread();
impl->m_WorkingMutex.lock();
qCDebug(LOG_VariableController()) << tr("VariableController init END");
}
void VariableController::finalize()
{
impl->m_WorkingMutex.unlock();
}
void VariableController::waitForFinish()
{
QMutexLocker locker{&impl->m_WorkingMutex};
}
Add code of ProvideNotInCacheRange in VC controller
r529
Implementation of V5 acquisition
r539 AcquisitionZoomType VariableController::getZoomType(const SqpRange &range, const SqpRange &oldRange)
{
// t1.m_TStart <= t2.m_TStart && t2.m_TEnd <= t1.m_TEnd
auto zoomType = AcquisitionZoomType::Unknown;
if (range.m_TStart <= oldRange.m_TStart && oldRange.m_TEnd <= range.m_TEnd) {
Improve synchro robustness.
r815 qCDebug(LOG_VariableController()) << "zoomtype: ZoomOut";
Implementation of V5 acquisition
r539 zoomType = AcquisitionZoomType::ZoomOut;
}
else if (range.m_TStart > oldRange.m_TStart && range.m_TEnd > oldRange.m_TEnd) {
Improve synchro robustness.
r815 qCDebug(LOG_VariableController()) << "zoomtype: PanRight";
Implementation of V5 acquisition
r539 zoomType = AcquisitionZoomType::PanRight;
}
else if (range.m_TStart < oldRange.m_TStart && range.m_TEnd < oldRange.m_TEnd) {
Improve synchro robustness.
r815 qCDebug(LOG_VariableController()) << "zoomtype: PanLeft";
Implementation of V5 acquisition
r539 zoomType = AcquisitionZoomType::PanLeft;
}
Fix a problem with the update of a graph or a variable
r1139 else if (range.m_TStart >= oldRange.m_TStart && oldRange.m_TEnd >= range.m_TEnd) {
Improve synchro robustness.
r815 qCDebug(LOG_VariableController()) << "zoomtype: ZoomIn";
Implementation of V5 acquisition
r539 zoomType = AcquisitionZoomType::ZoomIn;
}
else {
Improve synchro robustness.
r815 qCDebug(LOG_VariableController()) << "getZoomType: Unknown type detected";
Implementation of V5 acquisition
r539 }
return zoomType;
}
Add code of ProvideNotInCacheRange in VC controller
r529
Implementation of V5 acquisition
r539 void VariableController::VariableControllerPrivate::processRequest(std::shared_ptr<Variable> var,
Add implementation of the Var Acquisition waiting
r626 const SqpRange &rangeRequested,
QUuid varRequestId)
Add code of ProvideNotInCacheRange in VC controller
r529 {
Modify variable controller request managing with introduction of current
r825 auto itVar = m_VariableToIdentifierMap.find(var);
if (itVar == m_VariableToIdentifierMap.cend()) {
qCCritical(LOG_VariableController())
<< tr("Impossible to process request for unknown variable");
return;
}
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 auto varId = itVar->second;
Next var request parameter is now based on previous request instead of...
r807
Modify variable controller request managing with introduction of current
r825 auto itVarHandler = m_VarIdToVarRequestHandler.find(varId);
if (itVarHandler == m_VarIdToVarRequestHandler.cend()) {
qCCritical(LOG_VariableController())
<< tr("Impossible to process request for variable with unknown handler");
return;
}
Next var request parameter is now based on previous request instead of...
r807
Modify variable controller request managing with introduction of current
r825 auto oldRange = var->range();
Next var request parameter is now based on previous request instead of...
r807
Modify variable controller request managing with introduction of current
r825 auto varHandler = itVarHandler->second.get();
Next var request parameter is now based on previous request instead of...
r807
Modify variable controller request managing with introduction of current
r825 if (varHandler->m_State != VariableRequestHandlerState::OFF) {
oldRange = varHandler->m_RunningVarRequest.m_RangeRequested;
}
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 auto varRequest = VariableRequest{};
varRequest.m_VariableGroupId = varRequestId;
auto varStrategyRangesRequested
= m_VariableCacheStrategy->computeRange(oldRange, rangeRequested);
varRequest.m_RangeRequested = varStrategyRangesRequested.first;
varRequest.m_CacheRangeRequested = varStrategyRangesRequested.second;
switch (varHandler->m_State) {
case VariableRequestHandlerState::OFF: {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("Process Request OFF")
<< varRequest.m_RangeRequested
<< varRequest.m_CacheRangeRequested;
Modify variable controller request managing with introduction of current
r825 varHandler->m_RunningVarRequest = varRequest;
varHandler->m_State = VariableRequestHandlerState::RUNNING;
executeVarRequest(var, varRequest);
break;
Add code of ProvideNotInCacheRange in VC controller
r529 }
Modify variable controller request managing with introduction of current
r825 case VariableRequestHandlerState::RUNNING: {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("Process Request RUNNING")
<< varRequest.m_RangeRequested
<< varRequest.m_CacheRangeRequested;
Modify variable controller request managing with introduction of current
r825 varHandler->m_State = VariableRequestHandlerState::PENDING;
varHandler->m_PendingVarRequest = varRequest;
break;
}
case VariableRequestHandlerState::PENDING: {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("Process Request PENDING")
<< varRequest.m_RangeRequested
<< varRequest.m_CacheRangeRequested;
Modify variable controller request managing with introduction of current
r825 auto variableGroupIdToCancel = varHandler->m_PendingVarRequest.m_VariableGroupId;
cancelVariableRequest(variableGroupIdToCancel);
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 // Cancel variable can make state downgrade
varHandler->m_State = VariableRequestHandlerState::PENDING;
varHandler->m_PendingVarRequest = varRequest;
Modify variable controller request managing with introduction of current
r825
break;
add Skeleton for displaying data which are already in cache
r571 }
Modify variable controller request managing with introduction of current
r825 default:
qCCritical(LOG_VariableController())
<< QObject::tr("Unknown VariableRequestHandlerState");
Add code of ProvideNotInCacheRange in VC controller
r529 }
Implementation of V5 acquisition
r539 }
std::shared_ptr<Variable>
VariableController::VariableControllerPrivate::findVariable(QUuid vIdentifier)
{
std::shared_ptr<Variable> var;
auto findReply = [vIdentifier](const auto &entry) { return vIdentifier == entry.second; };
auto end = m_VariableToIdentifierMap.cend();
auto it = std::find_if(m_VariableToIdentifierMap.cbegin(), end, findReply);
if (it != end) {
var = it->first;
}
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to find the variable with the identifier: ") << vIdentifier;
}
Add code of ProvideNotInCacheRange in VC controller
r529
Implementation of V5 acquisition
r539 return var;
}
std::shared_ptr<IDataSeries> VariableController::VariableControllerPrivate::retrieveDataSeries(
const QVector<AcquisitionDataPacket> acqDataPacketVector)
{
The dataSeries of a variable is now shared istead of uniq to avoid...
r542 qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size")
<< acqDataPacketVector.size();
Implementation of V5 acquisition
r539 std::shared_ptr<IDataSeries> dataSeries;
if (!acqDataPacketVector.isEmpty()) {
dataSeries = acqDataPacketVector[0].m_DateSeries;
for (int i = 1; i < acqDataPacketVector.size(); ++i) {
dataSeries->merge(acqDataPacketVector[i].m_DateSeries.get());
}
}
The dataSeries of a variable is now shared istead of uniq to avoid...
r542 qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size END")
<< acqDataPacketVector.size();
Implementation of V5 acquisition
r539 return dataSeries;
}
void VariableController::VariableControllerPrivate::registerProvider(
std::shared_ptr<IDataProvider> provider)
{
if (m_ProviderSet.find(provider) == m_ProviderSet.end()) {
The dataSeries of a variable is now shared istead of uniq to avoid...
r542 qCDebug(LOG_VariableController()) << tr("Registering of a new provider")
<< provider->objectName();
Implementation of V5 acquisition
r539 m_ProviderSet.insert(provider);
connect(provider.get(), &IDataProvider::dataProvided, m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::onVariableDataAcquired);
connect(provider.get(), &IDataProvider::dataProvidedProgress,
m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::onVariableRetrieveDataInProgress);
Implementation of automatic cancel for request that failed
r761 connect(provider.get(), &IDataProvider::dataProvidedFailed,
m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::onVariableAcquisitionFailed);
Implementation of V5 acquisition
r539 }
else {
Add synchronization part of v5 acquisition
r540 qCDebug(LOG_VariableController()) << tr("Cannot register provider, it already exists ");
Implementation of V5 acquisition
r539 }
Add code of ProvideNotInCacheRange in VC controller
r529 }
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 QUuid VariableController::VariableControllerPrivate::acceptVariableRequest(
QUuid varId, std::shared_ptr<IDataSeries> dataSeries)
Add implementation of the Var Acquisition waiting
r626 {
Modify variable controller request managing with introduction of current
r825 auto itVarHandler = m_VarIdToVarRequestHandler.find(varId);
if (itVarHandler == m_VarIdToVarRequestHandler.cend()) {
return QUuid();
Add implementation of the Var Acquisition waiting
r626 }
Modify variable controller request managing with introduction of current
r825 auto varHandler = itVarHandler->second.get();
if (varHandler->m_State == VariableRequestHandlerState::OFF) {
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 qCCritical(LOG_VariableController())
<< tr("acceptVariableRequest impossible on a variable with OFF state");
Add implementation of the Var Acquisition waiting
r626 }
Modify variable controller request managing with introduction of current
r825 varHandler->m_RunningVarRequest.m_DataSeries = dataSeries;
varHandler->m_CanUpdate = true;
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 // Element traité, on a déjà toutes les données necessaires
auto varGroupId = varHandler->m_RunningVarRequest.m_VariableGroupId;
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "Variable::acceptVariableRequest" << varGroupId
<< m_VarGroupIdToVarIds.size();
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 return varHandler->m_RunningVarRequest.m_VariableGroupId;
Add implementation of the Var Acquisition waiting
r626 }
Modify variable controller request managing with introduction of current
r825 void VariableController::VariableControllerPrivate::updateVariables(QUuid varRequestId)
Add implementation of the Var Acquisition waiting
r626 {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
<< QThread::currentThread()->objectName() << varRequestId;
Modify variable controller request managing with introduction of current
r825
auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCWarning(LOG_VariableController())
<< tr("Impossible to updateVariables of unknown variables") << varRequestId;
Modify variable controller request managing with introduction of current
r825 return;
}
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 auto &varIds = varGroupIdToVarIdsIt->second;
auto varIdsEnd = varIds.end();
bool processVariableUpdate = true;
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 qCDebug(LOG_VariableController()) << "VariableControllerPrivate::updateVariables"
<< varRequestId << varIds.size();
Modify variable controller request managing with introduction of current
r825 for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd) && processVariableUpdate;
++varIdsIt) {
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
processVariableUpdate &= itVarHandler->second->m_CanUpdate;
Add implementation of the Var Acquisition waiting
r626 }
Modify variable controller request managing with introduction of current
r825 }
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 if (processVariableUpdate) {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "Final update OK for the var request" << varIds.size();
Modify variable controller request managing with introduction of current
r825 for (auto varIdsIt = varIds.begin(); varIdsIt != varIdsEnd; ++varIdsIt) {
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
if (auto var = findVariable(*varIdsIt)) {
auto &varRequest = itVarHandler->second->m_RunningVarRequest;
Add implementation of the Var Acquisition waiting
r626 var->setRange(varRequest.m_RangeRequested);
var->setCacheRange(varRequest.m_CacheRangeRequested);
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("1: onDataProvided")
<< varRequest.m_RangeRequested
<< varRequest.m_CacheRangeRequested;
qCDebug(LOG_VariableController()) << tr("2: onDataProvided var points before")
<< var->nbPoints()
<< varRequest.m_DataSeries->nbPoints();
Add implementation of the Var Acquisition waiting
r626 var->mergeDataSeries(varRequest.m_DataSeries);
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("3: onDataProvided var points after")
<< var->nbPoints();
Alexandre Leroux
Blocks UI update of a variable while it has pending requests
r702
Implementation of abort mechanism
r754 emit var->updated();
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("Update OK");
Add implementation of the Var Acquisition waiting
r626 }
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to update data to a null variable");
}
}
}
Modify variable controller request managing with introduction of current
r825 updateVariableRequest(varRequestId);
// cleaning varRequestId
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("m_VarGroupIdToVarIds erase") << varRequestId;
Modify variable controller request managing with introduction of current
r825 m_VarGroupIdToVarIds.erase(varRequestId);
Alexandre Leroux
Wait for the end of an acquisition to validate an operation (2)...
r1214 if (m_VarGroupIdToVarIds.empty()) {
emit q->acquisitionFinished();
}
Add implementation of the Var Acquisition waiting
r626 }
}
Modify variable controller request managing with introduction of current
r825
void VariableController::VariableControllerPrivate::updateVariableRequest(QUuid varRequestId)
Add implementation of the Var Acquisition waiting
r626 {
Modify variable controller request managing with introduction of current
r825 auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 qCCritical(LOG_VariableController()) << QObject::tr(
"Impossible to updateVariableRequest since varGroupdId isn't here anymore");
Modify variable controller request managing with introduction of current
r825 return;
}
Add implementation of the Var Acquisition waiting
r626
Modify variable controller request managing with introduction of current
r825 auto &varIds = varGroupIdToVarIdsIt->second;
auto varIdsEnd = varIds.end();
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) {
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
Improve acquisition robustness
r818
Modify variable controller request managing with introduction of current
r825 auto varHandler = itVarHandler->second.get();
varHandler->m_CanUpdate = false;
switch (varHandler->m_State) {
case VariableRequestHandlerState::OFF: {
qCCritical(LOG_VariableController())
<< QObject::tr("Impossible to update a variable with handler in OFF state");
} break;
case VariableRequestHandlerState::RUNNING: {
varHandler->m_State = VariableRequestHandlerState::OFF;
varHandler->m_RunningVarRequest = VariableRequest{};
break;
}
case VariableRequestHandlerState::PENDING: {
varHandler->m_State = VariableRequestHandlerState::RUNNING;
varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
varHandler->m_PendingVarRequest = VariableRequest{};
auto var = findVariable(itVarHandler->first);
executeVarRequest(var, varHandler->m_RunningVarRequest);
break;
}
default:
qCCritical(LOG_VariableController())
<< QObject::tr("Unknown VariableRequestHandlerState");
}
Add implementation of the Var Acquisition waiting
r626 }
}
}
Next var request parameter is now based on previous request instead of...
r807
Modify variable controller request managing with introduction of current
r825
void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid varRequestId)
Implementation of varRequestId aborting to permit to cancel a request...
r822 {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("cancelVariableRequest") << varRequestId;
Modify variable controller request managing with introduction of current
r825 auto varGroupIdToVarIdsIt = m_VarGroupIdToVarIds.find(varRequestId);
if (varGroupIdToVarIdsIt == m_VarGroupIdToVarIds.end()) {
Implement cancel with the new kernel
r827 qCCritical(LOG_VariableController())
<< tr("Impossible to cancelVariableRequest for unknown varGroupdId") << varRequestId;
Modify variable controller request managing with introduction of current
r825 return;
Implementation of varRequestId aborting to permit to cancel a request...
r822 }
Modify variable controller request managing with introduction of current
r825 auto &varIds = varGroupIdToVarIdsIt->second;
auto varIdsEnd = varIds.end();
for (auto varIdsIt = varIds.begin(); (varIdsIt != varIdsEnd); ++varIdsIt) {
auto itVarHandler = m_VarIdToVarRequestHandler.find(*varIdsIt);
Implement cancel with the new kernel
r827 if (itVarHandler != m_VarIdToVarRequestHandler.cend()) {
Implementation of varRequestId aborting to permit to cancel a request...
r822
Modify variable controller request managing with introduction of current
r825 auto varHandler = itVarHandler->second.get();
varHandler->m_VarId = QUuid{};
switch (varHandler->m_State) {
case VariableRequestHandlerState::OFF: {
qCWarning(LOG_VariableController())
<< QObject::tr("Impossible to cancel a variable with no running request");
break;
}
case VariableRequestHandlerState::RUNNING: {
if (varHandler->m_RunningVarRequest.m_VariableGroupId == varRequestId) {
auto var = findVariable(itVarHandler->first);
auto varProvider = m_VariableToProviderMap.at(var);
if (varProvider != nullptr) {
m_VariableAcquisitionWorker->abortProgressRequested(
itVarHandler->first);
}
Implement cancel with the new kernel
r827 m_VariableModel->setDataProgress(var, 0.0);
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 varHandler->m_CanUpdate = false;
Implement cancel with the new kernel
r827 varHandler->m_State = VariableRequestHandlerState::OFF;
Modify variable controller request managing with introduction of current
r825 varHandler->m_RunningVarRequest = VariableRequest{};
Implementation of varRequestId aborting to permit to cancel a request...
r822 }
else {
Modify variable controller request managing with introduction of current
r825 // TODO: log Impossible to cancel the running variable request beacause its
// varRequestId isn't not the canceled one
}
break;
}
case VariableRequestHandlerState::PENDING: {
if (varHandler->m_RunningVarRequest.m_VariableGroupId == varRequestId) {
auto var = findVariable(itVarHandler->first);
auto varProvider = m_VariableToProviderMap.at(var);
if (varProvider != nullptr) {
m_VariableAcquisitionWorker->abortProgressRequested(
itVarHandler->first);
Implementation of varRequestId aborting to permit to cancel a request...
r822 }
Implement cancel with the new kernel
r827 m_VariableModel->setDataProgress(var, 0.0);
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 varHandler->m_CanUpdate = false;
Implement cancel with the new kernel
r827 varHandler->m_State = VariableRequestHandlerState::RUNNING;
Modify variable controller request managing with introduction of current
r825 varHandler->m_RunningVarRequest = varHandler->m_PendingVarRequest;
Fix bug in canceling process: the handler canUpdate was always set to ...
r832 varHandler->m_PendingVarRequest = VariableRequest{};
Modify variable controller request managing with introduction of current
r825 executeVarRequest(var, varHandler->m_RunningVarRequest);
}
else if (varHandler->m_PendingVarRequest.m_VariableGroupId == varRequestId) {
Implement cancel with the new kernel
r827 varHandler->m_State = VariableRequestHandlerState::RUNNING;
Modify variable controller request managing with introduction of current
r825 varHandler->m_PendingVarRequest = VariableRequest{};
}
else {
// TODO: log Impossible to cancel the variable request beacause its
// varRequestId isn't not the canceled one
Implementation of varRequestId aborting to permit to cancel a request...
r822 }
break;
}
Modify variable controller request managing with introduction of current
r825 default:
qCCritical(LOG_VariableController())
<< QObject::tr("Unknown VariableRequestHandlerState");
Implementation of varRequestId aborting to permit to cancel a request...
r822 }
}
}
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("cancelVariableRequest: erase") << varRequestId;
Implement cancel with the new kernel
r827 m_VarGroupIdToVarIds.erase(varRequestId);
Alexandre Leroux
Wait for the end of an acquisition to validate an operation (2)...
r1214 if (m_VarGroupIdToVarIds.empty()) {
emit q->acquisitionFinished();
}
Implementation of varRequestId aborting to permit to cancel a request...
r822 }
Modify variable controller request managing with introduction of current
r825 void VariableController::VariableControllerPrivate::executeVarRequest(std::shared_ptr<Variable> var,
VariableRequest &varRequest)
Next var request parameter is now based on previous request instead of...
r807 {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << tr("TORM: executeVarRequest");
Modify variable controller request managing with introduction of current
r825
auto varId = m_VariableToIdentifierMap.at(var);
auto varCacheRange = var->cacheRange();
auto varCacheRangeRequested = varRequest.m_CacheRangeRequested;
auto notInCacheRangeList
= Variable::provideNotInCacheRangeList(varCacheRange, varCacheRangeRequested);
Add displaying of cache data available when new acquisition is requested
r831 auto inCacheRangeList
= Variable::provideInCacheRangeList(varCacheRange, varCacheRangeRequested);
Modify variable controller request managing with introduction of current
r825
if (!notInCacheRangeList.empty()) {
auto varProvider = m_VariableToProviderMap.at(var);
if (varProvider != nullptr) {
Run request canceling when unit isn"t found in the file. Clean log.
r828 qCDebug(LOG_VariableController()) << "executeVarRequest " << varRequest.m_RangeRequested
<< varRequest.m_CacheRangeRequested;
Modify variable controller request managing with introduction of current
r825 m_VariableAcquisitionWorker->pushVariableRequest(
varRequest.m_VariableGroupId, varId, varRequest.m_RangeRequested,
varRequest.m_CacheRangeRequested,
DataProviderParameters{std::move(notInCacheRangeList), var->metadata()},
varProvider);
Next var request parameter is now based on previous request instead of...
r807 }
else {
qCCritical(LOG_VariableController())
Modify variable controller request managing with introduction of current
r825 << "Impossible to provide data with a null provider";
Next var request parameter is now based on previous request instead of...
r807 }
Modify variable controller request managing with introduction of current
r825
Add displaying of cache data available when new acquisition is requested
r831 if (!inCacheRangeList.empty()) {
emit q->updateVarDisplaying(var, inCacheRangeList.first());
}
Next var request parameter is now based on previous request instead of...
r807 }
else {
Modify variable controller request managing with introduction of current
r825 acceptVariableRequest(varId,
var->dataSeries()->subDataSeries(varRequest.m_CacheRangeRequested));
Next var request parameter is now based on previous request instead of...
r807 }
}