##// END OF EJS Templates
Updates VisualizationGraphHelper to handle vectors
Updates VisualizationGraphHelper to handle vectors

File last commit:

r538:ba71c0cdaccd
r547:04be26486541
Show More
VariableController.cpp
550 lines | 21.2 KiB | text/x-c | CppLexer
/ core / src / Variable / VariableController.cpp
The mock plugin can now create data with view operation
r219 #include <Variable/Variable.h>
Implementation of V5 acquisition
r510 #include <Variable/VariableAcquisitionWorker.h>
Create a variable notify the variable cache parameter
r209 #include <Variable/VariableCacheController.h>
Implementation of V5 acquisition
r510 #include <Variable/VariableCacheStrategy.h>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 #include <Variable/VariableController.h>
Alexandre Leroux
Adds Variable model in the Variable controller
r108 #include <Variable/VariableModel.h>
Implementation of V5 acquisition
r510 #include <Variable/VariableSynchronizationGroup.h>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106
Alexandre Leroux
Updates VariableController::createVariable() method...
r154 #include <Data/DataProviderParameters.h>
#include <Data/IDataProvider.h>
#include <Data/IDataSeries.h>
Time widget is now used with the variable createion request
r179 #include <Time/TimeController.h>
Alexandre Leroux
Updates VariableController::createVariable() method...
r154
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 #include <QMutex>
#include <QThread>
Alexandre Leroux
Transits tokens in provider requests
r347 #include <QUuid>
Temporal parameters of the selected variables can be updated using the...
r281 #include <QtCore/QItemSelectionModel>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106
Implementation of V5 acquisition
r510 #include <set>
Create a variable notify the variable cache parameter
r209 #include <unordered_map>
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 Q_LOGGING_CATEGORY(LOG_VariableController, "VariableController")
Implementation of V5 acquisition
r510 namespace {
change grapheRange to graphRange
r516 SqpRange computeSynchroRangeRequested(const SqpRange &varRange, const SqpRange &graphRange,
Implementation of V5 acquisition
r510 const SqpRange &oldGraphRange)
{
change grapheRange to graphRange
r516 auto zoomType = VariableController::getZoomType(graphRange, oldGraphRange);
Implementation of V5 acquisition
r510
auto varRangeRequested = varRange;
switch (zoomType) {
case AcquisitionZoomType::ZoomIn: {
change grapheRange to graphRange
r516 auto deltaLeft = graphRange.m_TStart - oldGraphRange.m_TStart;
auto deltaRight = oldGraphRange.m_TEnd - graphRange.m_TEnd;
Implementation of V5 acquisition
r510 varRangeRequested.m_TStart += deltaLeft;
varRangeRequested.m_TEnd -= deltaRight;
break;
}
case AcquisitionZoomType::ZoomOut: {
change grapheRange to graphRange
r516 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
Implementation of V5 acquisition
r510 varRangeRequested.m_TStart -= deltaLeft;
varRangeRequested.m_TEnd += deltaRight;
break;
}
case AcquisitionZoomType::PanRight: {
change grapheRange to graphRange
r516 auto deltaRight = graphRange.m_TEnd - oldGraphRange.m_TEnd;
Implementation of V5 acquisition
r510 varRangeRequested.m_TStart += deltaRight;
varRangeRequested.m_TEnd += deltaRight;
break;
}
case AcquisitionZoomType::PanLeft: {
change grapheRange to graphRange
r516 auto deltaLeft = oldGraphRange.m_TStart - graphRange.m_TStart;
Implementation of V5 acquisition
r510 varRangeRequested.m_TStart -= deltaLeft;
varRangeRequested.m_TEnd -= deltaLeft;
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;
}
}
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 struct VariableController::VariableControllerPrivate {
Alexandre Leroux
Use raw pointer for VariableModel (QObject class)
r148 explicit VariableControllerPrivate(VariableController *parent)
Create a variable notify the variable cache parameter
r209 : m_WorkingMutex{},
m_VariableModel{new VariableModel{parent}},
Temporal parameters of the selected variables can be updated using the...
r281 m_VariableSelectionModel{new QItemSelectionModel{m_VariableModel, parent}},
Implementation of V5 acquisition
r510 m_VariableCacheController{std::make_unique<VariableCacheController>()},
m_VariableCacheStrategy{std::make_unique<VariableCacheStrategy>()},
add Skeleton for displaying data which are already in cache
r538 m_VariableAcquisitionWorker{std::make_unique<VariableAcquisitionWorker>()},
q{parent}
Implementation of V5 acquisition
r510 {
m_VariableAcquisitionWorker->moveToThread(&m_VariableAcquisitionWorkerThread);
m_VariableAcquisitionWorkerThread.setObjectName("VariableAcquisitionWorkerThread");
}
virtual ~VariableControllerPrivate()
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 {
Implementation of V5 acquisition
r510 qCDebug(LOG_VariableController()) << tr("VariableControllerPrivate destruction");
m_VariableAcquisitionWorkerThread.quit();
m_VariableAcquisitionWorkerThread.wait();
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 }
Implementation of V5 acquisition
r510
void processRequest(std::shared_ptr<Variable> var, const SqpRange &rangeRequested);
Update worker for SqpRange compatibility
r501 QVector<SqpRange> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
const SqpRange &dateTime);
Add code of ProvideNotInCacheRange in VC controller
r500
Implementation of V5 acquisition
r510 std::shared_ptr<Variable> findVariable(QUuid vIdentifier);
std::shared_ptr<IDataSeries>
retrieveDataSeries(const QVector<AcquisitionDataPacket> acqDataPacketVector);
void registerProvider(std::shared_ptr<IDataProvider> provider);
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 QMutex m_WorkingMutex;
Alexandre Leroux
Use raw pointer for VariableModel (QObject class)
r148 /// Variable model. The VariableController has the ownership
VariableModel *m_VariableModel;
Temporal parameters of the selected variables can be updated using the...
r281 QItemSelectionModel *m_VariableSelectionModel;
Time widget is now used with the variable createion request
r179
Create a variable notify the variable cache parameter
r209
Correction MR
r181 TimeController *m_TimeController{nullptr};
Create a variable notify the variable cache parameter
r209 std::unique_ptr<VariableCacheController> m_VariableCacheController;
Implementation of V5 acquisition
r510 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
r219
std::unordered_map<std::shared_ptr<Variable>, std::shared_ptr<IDataProvider> >
m_VariableToProviderMap;
Alexandre Leroux
Corrects regression on variable destruction
r386 std::unordered_map<std::shared_ptr<Variable>, QUuid> m_VariableToIdentifierMap;
Implementation of V5 acquisition
r510 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
r538
VariableController *q;
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 };
Implementation of V5 acquisition
r510
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 VariableController::VariableController(QObject *parent)
Alexandre Leroux
Use raw pointer for VariableModel (QObject class)
r148 : QObject{parent}, impl{spimpl::make_unique_impl<VariableControllerPrivate>(this)}
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 {
Correction clang format
r337 qCDebug(LOG_VariableController()) << tr("VariableController construction")
<< QThread::currentThread();
Implement of the abort download process
r388
connect(impl->m_VariableModel, &VariableModel::abortProgessRequested, this,
&VariableController::onAbortProgressRequested);
Implementation of V5 acquisition
r510
connect(impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::dataProvided, this,
&VariableController::onDataProvided);
connect(impl->m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::variableRequestInProgress, this,
&VariableController::onVariableRetrieveDataInProgress);
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::started,
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::initialize);
connect(&impl->m_VariableAcquisitionWorkerThread, &QThread::finished,
impl->m_VariableAcquisitionWorker.get(), &VariableAcquisitionWorker::finalize);
impl->m_VariableAcquisitionWorkerThread.start();
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 }
VariableController::~VariableController()
{
Correction clang format
r337 qCDebug(LOG_VariableController()) << tr("VariableController destruction")
<< QThread::currentThread();
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 this->waitForFinish();
}
Alexandre Leroux
Updates VariableController::createVariable() method...
r154 VariableModel *VariableController::variableModel() noexcept
Alexandre Leroux
Adds Variable model in the Variable controller
r108 {
Alexandre Leroux
Updates VariableController::createVariable() method...
r154 return impl->m_VariableModel;
Alexandre Leroux
Adds Variable model in the Variable controller
r108 }
Temporal parameters of the selected variables can be updated using the...
r281 QItemSelectionModel *VariableController::variableSelectionModel() noexcept
{
return impl->m_VariableSelectionModel;
}
Time widget is now used with the variable createion request
r179 void VariableController::setTimeController(TimeController *timeController) noexcept
{
impl->m_TimeController = timeController;
}
Alexandre Leroux
Variable deletion (1)...
r303 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)...
r309 // 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)...
r304
Alexandre Leroux
Corrects regression on variable destruction
r386 // Deletes identifier
impl->m_VariableToIdentifierMap.erase(variable);
Alexandre Leroux
Variable deletion (2)...
r304 // 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)...
r303
Alexandre Leroux
Variable deletion (2)...
r305 // Clears cache
impl->m_VariableCacheController->clear(variable);
Alexandre Leroux
Variable deletion (3)...
r306 // Deletes from model
impl->m_VariableModel->deleteVariable(variable);
}
Alexandre Leroux
Variable deletion (1)...
r303
void VariableController::deleteVariables(
const QVector<std::shared_ptr<Variable> > &variables) noexcept
{
for (auto variable : qAsConst(variables)) {
deleteVariable(variable);
}
}
Implement of the abort download process
r388 void VariableController::abortProgress(std::shared_ptr<Variable> variable)
{
}
Alexandre Leroux
Updates variable creation to pass metadata...
r377 void VariableController::createVariable(const QString &name, const QVariantHash &metadata,
Alexandre Leroux
Updates VariableController::createVariable() method...
r154 std::shared_ptr<IDataProvider> provider) noexcept
Alexandre Leroux
Affects model to the Variable Widget
r143 {
Time widget is now used with the variable createion request
r179
if (!impl->m_TimeController) {
qCCritical(LOG_VariableController())
<< tr("Impossible to create variable: The time controller is null");
return;
}
Implementation of V5 acquisition
r510 auto range = impl->m_TimeController->dateTime();
Alexandre Leroux
Updates variable creation to pass metadata...
r377
Implementation of V5 acquisition
r510 if (auto newVariable = impl->m_VariableModel->createVariable(name, range, metadata)) {
Implement the network controller to permit the execution of a request...
r359 auto identifier = QUuid::createUuid();
Create a variable notify the variable cache parameter
r209
The mock plugin can now create data with view operation
r219 // store the provider
Implementation of V5 acquisition
r510 impl->registerProvider(provider);
// Associate the provider
The mock plugin can now create data with view operation
r219 impl->m_VariableToProviderMap[newVariable] = provider;
Alexandre Leroux
Corrects regression on variable destruction
r386 impl->m_VariableToIdentifierMap[newVariable] = identifier;
The cache is now updated only if date requested has been successfully...
r293
Implementation of V5 acquisition
r510 impl->processRequest(newVariable, range);
Alexandre Leroux
Updates VariableController::createVariable() method...
r154 }
Alexandre Leroux
Affects model to the Variable Widget
r143 }
Change SqpRange for SqpDateTime
r471 void VariableController::onDateTimeOnSelection(const SqpRange &dateTime)
Temporal parameters of the selected variables can be updated using the...
r281 {
Implementation of V5 acquisition
r510 // TODO check synchronisation
Correction clang format
r337 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
<< QThread::currentThread()->objectName();
Temporal parameters of the selected variables can be updated using the...
r281 auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
for (const auto &selectedRow : qAsConst(selectedRows)) {
if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) {
Implementation of V5 acquisition
r510 selectedVariable->setRange(dateTime);
impl->processRequest(selectedVariable, dateTime);
Add comment
r408
// notify that rescale operation has to be done
Add connection logical for the rescale operation
r403 emit rangeChanged(selectedVariable, dateTime);
Temporal parameters of the selected variables can be updated using the...
r281 }
}
}
Implementation of V5 acquisition
r510 void VariableController::onDataProvided(QUuid vIdentifier, const SqpRange &rangeRequested,
const SqpRange &cacheRangeRequested,
QVector<AcquisitionDataPacket> dataAcquired)
Add implementation of progress bar on variable inspector connected to...
r369 {
Correction for MR
r517 if (auto var = impl->findVariable(vIdentifier)) {
Implementation of V5 acquisition
r510 var->setRange(rangeRequested);
var->setCacheRange(cacheRangeRequested);
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << tr("1: onDataProvided") << rangeRequested;
qCDebug(LOG_VariableController()) << tr("2: onDataProvided") << cacheRangeRequested;
Implementation of V5 acquisition
r510
auto retrievedDataSeries = impl->retrieveDataSeries(dataAcquired);
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << tr("3: onDataProvided")
<< retrievedDataSeries->range();
Implementation of V5 acquisition
r510 var->mergeDataSeries(retrievedDataSeries);
The dataSeries of a variable is now shared istead of uniq to avoid...
r513 qCDebug(LOG_VariableController()) << tr("4: onDataProvided");
Implementation of V5 acquisition
r510 emit var->updated();
}
else {
qCCritical(LOG_VariableController()) << tr("Impossible to provide data to a null variable");
}
}
Add implementation of progress bar on variable inspector connected to...
r369
Implementation of V5 acquisition
r510 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
{
Correction for MR
r517 if (auto var = impl->findVariable(identifier)) {
Implementation of V5 acquisition
r510 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...
r369 }
}
Implement of the abort download process
r388 void VariableController::onAbortProgressRequested(std::shared_ptr<Variable> variable)
{
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAbortProgressRequested"
<< QThread::currentThread()->objectName();
Add thread protection on AbortDownload process
r389 auto it = impl->m_VariableToIdentifierMap.find(variable);
if (it != impl->m_VariableToIdentifierMap.cend()) {
Implement of the abort download process
r388 impl->m_VariableToProviderMap.at(variable)->requestDataAborting(it->second);
}
else {
qCWarning(LOG_VariableController())
<< tr("Aborting progression of inexistant variable detected !!!")
<< QThread::currentThread()->objectName();
}
}
Implementation of V5 acquisition
r510 void VariableController::onAddSynchronizationGroupId(QUuid synchronizationGroupId)
{
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronizationGroupId"
<< QThread::currentThread()->objectName()
<< synchronizationGroupId;
Implementation of V5 acquisition
r510 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
r511 void VariableController::onAddSynchronized(std::shared_ptr<Variable> variable,
QUuid synchronizationGroupId)
{
qCDebug(LOG_VariableController()) << "TORM: VariableController::onAddSynchronized"
<< synchronizationGroupId;
Correction for MR
r517 auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(variable);
if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
auto groupIdToVSGIt
Add synchronization part of v5 acquisition
r511 = impl->m_GroupIdToVariableSynchronizationGroupMap.find(synchronizationGroupId);
Correction for MR
r517 if (groupIdToVSGIt != impl->m_GroupIdToVariableSynchronizationGroupMap.cend()) {
Add synchronization part of v5 acquisition
r511 impl->m_VariableIdGroupIdMap.insert(
Correction for MR
r517 std::make_pair(varToVarIdIt->second, synchronizationGroupId));
groupIdToVSGIt->second->addVariableId(varToVarIdIt->second);
Add synchronization part of v5 acquisition
r511 }
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();
}
}
The mock plugin can now create data with view operation
r219
Implementation of V5 acquisition
r510 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables,
const SqpRange &range, const SqpRange &oldRange,
bool synchronise)
The mock plugin can now create data with view operation
r219 {
Implementation of V5 acquisition
r510 // NOTE: oldRange isn't really necessary since oldRange == variable->range().
Correction for MR
r517 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
<< QThread::currentThread()->objectName();
The mock plugin can now create data with view operation
r219 // we want to load data of the variable for the dateTime.
// First we check if the cache contains some of them.
// For the other, we ask the provider to give them.
Correction for MR
r517 for (const auto &var : variables) {
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << "processRequest for" << var->name();
Implementation of V5 acquisition
r510 impl->processRequest(var, range);
}
The mock plugin can now create data with view operation
r219
Implementation of V5 acquisition
r510 if (synchronise) {
// Get the group ids
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController())
Correction for MR
r517 << "TORM VariableController::onRequestDataLoading for synchro var ENABLE";
Implementation of V5 acquisition
r510 auto groupIds = std::set<QUuid>();
Correction for MR
r517 for (const auto &var : variables) {
Add synchronization part of v5 acquisition
r511 auto varToVarIdIt = impl->m_VariableToIdentifierMap.find(var);
if (varToVarIdIt != impl->m_VariableToIdentifierMap.cend()) {
auto vId = varToVarIdIt->second;
auto varIdToGroupIdIt = impl->m_VariableIdGroupIdMap.find(vId);
if (varIdToGroupIdIt != impl->m_VariableIdGroupIdMap.cend()) {
auto gId = varIdToGroupIdIt->second;
Implementation of V5 acquisition
r510 if (groupIds.find(gId) == groupIds.cend()) {
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << "Synchro detect group " << gId;
Implementation of V5 acquisition
r510 groupIds.insert(gId);
}
}
}
Fix the cosinus bug....
r276 }
Implementation of V5 acquisition
r510
// We assume here all group ids exist
Correction for MR
r517 for (const auto &gId : groupIds) {
Implementation of V5 acquisition
r510 auto vSynchronizationGroup = impl->m_GroupIdToVariableSynchronizationGroupMap.at(gId);
auto vSyncIds = vSynchronizationGroup->getIds();
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << "Var in synchro group ";
Implementation of V5 acquisition
r510 for (auto vId : vSyncIds) {
auto var = impl->findVariable(vId);
Add synchronization part of v5 acquisition
r511
// Don't process already processed var
if (!variables.contains(var)) {
if (var != nullptr) {
qCDebug(LOG_VariableController()) << "processRequest synchro for"
<< var->name();
auto vSyncRangeRequested
= computeSynchroRangeRequested(var->range(), range, oldRange);
impl->processRequest(var, vSyncRangeRequested);
}
else {
qCCritical(LOG_VariableController())
<< tr("Impossible to synchronize a null variable");
}
Implementation of V5 acquisition
r510 }
}
Fix the cosinus bug....
r276 }
The mock plugin can now create data with view operation
r219 }
}
Alexandre Leroux
Inits variable controller and adds it to the SciQlop app
r106 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
r500
Implementation of V5 acquisition
r510 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) {
zoomType = AcquisitionZoomType::ZoomOut;
}
else if (range.m_TStart > oldRange.m_TStart && range.m_TEnd > oldRange.m_TEnd) {
zoomType = AcquisitionZoomType::PanRight;
}
else if (range.m_TStart < oldRange.m_TStart && range.m_TEnd < oldRange.m_TEnd) {
zoomType = AcquisitionZoomType::PanLeft;
}
else if (range.m_TStart > oldRange.m_TStart && oldRange.m_TEnd > range.m_TEnd) {
zoomType = AcquisitionZoomType::ZoomIn;
}
else {
qCCritical(LOG_VariableController()) << "getZoomType: Unknown type detected";
}
return zoomType;
}
Add code of ProvideNotInCacheRange in VC controller
r500
Implementation of V5 acquisition
r510 void VariableController::VariableControllerPrivate::processRequest(std::shared_ptr<Variable> var,
const SqpRange &rangeRequested)
Add code of ProvideNotInCacheRange in VC controller
r500 {
Implementation of V5 acquisition
r510 auto varRangesRequested
= m_VariableCacheStrategy->computeCacheRange(var->range(), rangeRequested);
auto notInCacheRangeList = var->provideNotInCacheRangeList(varRangesRequested.second);
add Skeleton for displaying data which are already in cache
r538 auto inCacheRangeList = var->provideInCacheRangeList(varRangesRequested.second);
Implementation of V5 acquisition
r510
if (!notInCacheRangeList.empty()) {
auto identifier = m_VariableToIdentifierMap.at(var);
auto varProvider = m_VariableToProviderMap.at(var);
if (varProvider != nullptr) {
m_VariableAcquisitionWorker->pushVariableRequest(
identifier, varRangesRequested.first, varRangesRequested.second,
DataProviderParameters{std::move(notInCacheRangeList), var->metadata()},
varProvider);
Add code of ProvideNotInCacheRange in VC controller
r500 }
else {
Implementation of V5 acquisition
r510 qCCritical(LOG_VariableController())
<< "Impossible to provide data with a null provider";
Add code of ProvideNotInCacheRange in VC controller
r500 }
add Skeleton for displaying data which are already in cache
r538
if (!inCacheRangeList.empty()) {
emit q->updateVarDisplaying(var, inCacheRangeList.first());
}
Add code of ProvideNotInCacheRange in VC controller
r500 }
Implementation of V5 acquisition
r510 else {
var->setRange(rangeRequested);
var->setCacheRange(varRangesRequested.second);
Alexandre Leroux
Renames subData() to subDataSeries()...
r522 var->setDataSeries(var->dataSeries()->subDataSeries(varRangesRequested.second));
Implementation of V5 acquisition
r510 emit var->updated();
}
}
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
r500
Implementation of V5 acquisition
r510 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...
r513 qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size")
<< acqDataPacketVector.size();
Implementation of V5 acquisition
r510 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...
r513 qCDebug(LOG_VariableController()) << tr("TORM: retrieveDataSeries acqDataPacketVector size END")
<< acqDataPacketVector.size();
Implementation of V5 acquisition
r510 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...
r513 qCDebug(LOG_VariableController()) << tr("Registering of a new provider")
<< provider->objectName();
Implementation of V5 acquisition
r510 m_ProviderSet.insert(provider);
connect(provider.get(), &IDataProvider::dataProvided, m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::onVariableDataAcquired);
connect(provider.get(), &IDataProvider::dataProvidedProgress,
m_VariableAcquisitionWorker.get(),
&VariableAcquisitionWorker::onVariableRetrieveDataInProgress);
}
else {
Add synchronization part of v5 acquisition
r511 qCDebug(LOG_VariableController()) << tr("Cannot register provider, it already exists ");
Implementation of V5 acquisition
r510 }
Add code of ProvideNotInCacheRange in VC controller
r500 }