##// END OF EJS Templates
Uses new iterator in DataSeries.cpp...
Uses new iterator in DataSeries.cpp The code of the old iterator is deleted. The new iterator is now built from the Implementation of DataSeriesIteratorValue :: Impl for a DataSeries

File last commit:

r531:41183664294f
r596:96f73c42ec59
Show More
VariableCacheStrategy.cpp
52 lines | 1.6 KiB | text/x-c | CppLexer
/ core / src / Variable / VariableCacheStrategy.cpp
#include "Variable/VariableCacheStrategy.h"
#include "Settings/SqpSettingsDefs.h"
#include "Variable/Variable.h"
#include "Variable/VariableController.h"
Q_LOGGING_CATEGORY(LOG_VariableCacheStrategy, "VariableCacheStrategy")
struct VariableCacheStrategy::VariableCacheStrategyPrivate {
VariableCacheStrategyPrivate() : m_CacheStrategy{CacheStrategy::FixedTolerance} {}
CacheStrategy m_CacheStrategy;
};
VariableCacheStrategy::VariableCacheStrategy(QObject *parent)
: QObject{parent}, impl{spimpl::make_unique_impl<VariableCacheStrategyPrivate>()}
{
}
std::pair<SqpRange, SqpRange>
VariableCacheStrategy::computeCacheRange(const SqpRange &vRange, const SqpRange &rangeRequested)
{
auto varRanges = std::pair<SqpRange, SqpRange>{};
auto toleranceFactor = SqpSettings::toleranceValue(GENERAL_TOLERANCE_AT_UPDATE_KEY,
GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE);
auto tolerance = toleranceFactor * (rangeRequested.m_TEnd - rangeRequested.m_TStart);
switch (impl->m_CacheStrategy) {
case CacheStrategy::FixedTolerance: {
varRanges.first = rangeRequested;
varRanges.second
= SqpRange{rangeRequested.m_TStart - tolerance, rangeRequested.m_TEnd + tolerance};
break;
}
case CacheStrategy::TwoThreashold: {
// TODO Implement
break;
}
default:
qCCritical(LOG_VariableCacheStrategy())
<< tr("Impossible to use compute the cache range with an unknow cache strategy");
// No action
break;
}
return varRanges;
}