##// END OF EJS Templates
Remove unused parameter of Amda callback lambda
Remove unused parameter of Amda callback lambda

File last commit:

r471:d00d6fd96c10
r499:2ff81754e6cf
Show More
VariableController.cpp
243 lines | 8.5 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>
Create a variable notify the variable cache parameter
r209 #include <Variable/VariableCacheController.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>
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
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")
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}},
Create a variable notify the variable cache parameter
r209 m_VariableCacheController{std::make_unique<VariableCacheController>()}
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;
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;
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);
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;
}
Create a variable notify the variable cache parameter
r209 auto dateTime = impl->m_TimeController->dateTime();
Alexandre Leroux
Updates variable creation to pass metadata...
r377
if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime, 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
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
Alexandre Leroux
Uses weak pointers in lambda functions to prevent a shared_ptr from ever being deleted (because a reference would always be kept in the lambda)
r334 auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ](
Implement the network controller to permit the execution of a request...
r359 QUuid identifier, auto dataSeriesAcquired, auto dateTimeToPutInCache)
Alexandre Leroux
Uses weak pointers in lambda functions to prevent a shared_ptr from ever being deleted (because a reference would always be kept in the lambda)
r334 {
if (auto variable = varW.lock()) {
Alexandre Leroux
Corrects regression on variable destruction
r386 auto varIdentifier = impl->m_VariableToIdentifierMap.at(variable);
Implement the network controller to permit the execution of a request...
r359 if (varIdentifier == identifier) {
Alexandre Leroux
Transits tokens in provider requests
r347 impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache);
variable->setDataSeries(dataSeriesAcquired);
Implementation of the cache feature : download before display needs
r399 emit variable->updated();
Alexandre Leroux
Transits tokens in provider requests
r347 }
Alexandre Leroux
Uses weak pointers in lambda functions to prevent a shared_ptr from ever being deleted (because a reference would always be kept in the lambda)
r334 }
};
The cache is now updated only if date requested has been successfully...
r293
connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired);
Remove connection for progress from NC -> VC to NC -> Provider.
r391 connect(provider.get(), &IDataProvider::dataProvidedProgress, this,
&VariableController::onVariableRetrieveDataInProgress);
It's now possible to create the variable and ask data to be retreived...
r294 this->onRequestDataLoading(newVariable, dateTime);
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 {
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())) {
selectedVariable->setDateTime(dateTime);
The data of the variable is now requested with the new provided...
r282 this->onRequestDataLoading(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 }
}
}
Add implementation of progress bar on variable inspector connected to...
r369 void VariableController::onVariableRetrieveDataInProgress(QUuid identifier, double progress)
{
auto findReply = [identifier](const auto &entry) { return identifier == entry.second; };
Alexandre Leroux
Corrects regression on variable destruction
r386 auto end = impl->m_VariableToIdentifierMap.cend();
auto it = std::find_if(impl->m_VariableToIdentifierMap.cbegin(), end, findReply);
Add implementation of progress bar on variable inspector connected to...
r369 if (it != end) {
impl->m_VariableModel->setDataProgress(it->first, progress);
}
}
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();
}
}
The mock plugin can now create data with view operation
r219
Fix the cosinus bug....
r276 void VariableController::onRequestDataLoading(std::shared_ptr<Variable> variable,
Change SqpRange for SqpDateTime
r471 const SqpRange &dateTime)
The mock plugin can now create data with view operation
r219 {
Correction clang format
r337 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.
if (variable) {
auto dateTimeListNotInCache
= impl->m_VariableCacheController->provideNotInCacheDateTimeList(variable, dateTime);
Fix the cosinus bug....
r276 if (!dateTimeListNotInCache.empty()) {
// Ask the provider for each data on the dateTimeListNotInCache
Alexandre Leroux
Corrects regression on variable destruction
r386 auto identifier = impl->m_VariableToIdentifierMap.at(variable);
Fix the cosinus bug....
r276 impl->m_VariableToProviderMap.at(variable)->requestDataLoading(
Alexandre Leroux
Pass variable metadata as parameters of a request in a provider
r378 identifier,
DataProviderParameters{std::move(dateTimeListNotInCache), variable->metadata()});
Fix the cosinus bug....
r276 }
else {
emit variable->updated();
}
The mock plugin can now create data with view operation
r219 }
else {
qCCritical(LOG_VariableController()) << tr("Impossible to load data of a variable null");
}
}
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};
}