##// END OF EJS Templates
Add VariableSynchronizationGroup
Add VariableSynchronizationGroup

File last commit:

r532:6d67365e6b04
r537:8c1ac858caa5
Show More
Variable.cpp
142 lines | 3.7 KiB | text/x-c | CppLexer
Alexandre Leroux
Changes Variable from struct to class
r163 #include "Variable/Variable.h"
Alexandre Leroux
Adds data series to a variable
r164 #include <Data/IDataSeries.h>
Change SqpRange for SqpDateTime
r512 #include <Data/SqpRange.h>
Variable slot is called when x range of its graph changed
r226
Add current progression for thread fix
r364 #include <QReadWriteLock>
#include <QThread>
Variable slot is called when x range of its graph changed
r226 Q_LOGGING_CATEGORY(LOG_Variable, "Variable")
Alexandre Leroux
Adds data series to a variable
r164
Alexandre Leroux
Changes Variable from struct to class
r163 struct Variable::VariablePrivate {
Change SqpRange for SqpDateTime
r512 explicit VariablePrivate(const QString &name, const SqpRange &dateTime,
Alexandre Leroux
Adds QVariantHash to store metadata in a variable
r406 const QVariantHash &metadata)
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 : m_Name{name}, m_Range{dateTime}, m_Metadata{metadata}, m_DataSeries{nullptr}
Alexandre Leroux
Changes Variable from struct to class
r163 {
}
QString m_Name;
Variable slot is called when x range of its graph changed
r226
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 SqpRange m_Range;
SqpRange m_CacheRange;
Alexandre Leroux
Adds QVariantHash to store metadata in a variable
r406 QVariantHash m_Metadata;
Alexandre Leroux
Adds data series to a variable
r164 std::unique_ptr<IDataSeries> m_DataSeries;
Alexandre Leroux
Changes Variable from struct to class
r163 };
Change SqpRange for SqpDateTime
r512 Variable::Variable(const QString &name, const SqpRange &dateTime, const QVariantHash &metadata)
Alexandre Leroux
Adds QVariantHash to store metadata in a variable
r406 : impl{spimpl::make_unique_impl<VariablePrivate>(name, dateTime, metadata)}
Alexandre Leroux
Changes Variable from struct to class
r163 {
}
QString Variable::name() const noexcept
{
return impl->m_Name;
}
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 SqpRange Variable::range() const noexcept
The mock plugin can now create data with view operation
r235 {
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 return impl->m_Range;
The mock plugin can now create data with view operation
r235 }
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 void Variable::setRange(const SqpRange &range) noexcept
Implementation of the new Dela T computation strategy
r260 {
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 impl->m_Range = range;
}
SqpRange Variable::cacheRange() const noexcept
{
return impl->m_CacheRange;
}
void Variable::setCacheRange(const SqpRange &cacheRange) noexcept
{
impl->m_CacheRange = cacheRange;
Implementation of the new Dela T computation strategy
r260 }
Alexandre Leroux
Use std::shared_ptr in CosinusProvider
r310 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
Alexandre Leroux
Adds data series to a variable
r164 {
Change info to debug on thread display log
r367 qCDebug(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName();
Alexandre Leroux
Use std::shared_ptr in CosinusProvider
r310 if (!dataSeries) {
/// @todo ALX : log
return;
Alexandre Leroux
Adds data series to a variable
r164 }
The mock plugin can now create data with view operation
r235
Alexandre Leroux
Use std::shared_ptr in CosinusProvider
r310 // Inits the data series of the variable
if (!impl->m_DataSeries) {
impl->m_DataSeries = dataSeries->clone();
}
else {
The mock plugin can now create data with view operation
r235 impl->m_DataSeries->merge(dataSeries.get());
}
Alexandre Leroux
Adds data series to a variable
r164 }
Alexandre Leroux
Handles creations for scalar series
r182
IDataSeries *Variable::dataSeries() const noexcept
{
return impl->m_DataSeries.get();
}
Variable slot is called when x range of its graph changed
r226
Alexandre Leroux
Adds QVariantHash to store metadata in a variable
r406 QVariantHash Variable::metadata() const noexcept
{
return impl->m_Metadata;
}
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 bool Variable::contains(const SqpRange &range) const noexcept
Variable slot is called when x range of its graph changed
r226 {
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 return impl->m_Range.contains(range);
Variable slot is called when x range of its graph changed
r226 }
Add intersect méthode on variable and sqpDateTime...
r258
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 bool Variable::intersect(const SqpRange &range) const noexcept
Add intersect méthode on variable and sqpDateTime...
r258 {
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 return impl->m_Range.intersect(range);
Add intersect méthode on variable and sqpDateTime...
r258 }
The cache is now updated only if date requested has been successfully...
r318
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 bool Variable::isInside(const SqpRange &range) const noexcept
The cache is now updated only if date requested has been successfully...
r318 {
add CacheRange for Variable and the provideNotInCacheRangeList method
r532 return range.contains(SqpRange{impl->m_Range.m_TStart, impl->m_Range.m_TEnd});
}
bool Variable::cacheContains(const SqpRange &range) const noexcept
{
return impl->m_CacheRange.contains(range);
}
bool Variable::cacheIntersect(const SqpRange &range) const noexcept
{
return impl->m_CacheRange.intersect(range);
}
bool Variable::cacheIsInside(const SqpRange &range) const noexcept
{
return range.contains(SqpRange{impl->m_CacheRange.m_TStart, impl->m_CacheRange.m_TEnd});
}
QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range)
{
auto notInCache = QVector<SqpRange>{};
if (!this->cacheContains(range)) {
if (range.m_TEnd <= impl->m_CacheRange.m_TStart
|| range.m_TStart >= impl->m_CacheRange.m_TEnd) {
notInCache << range;
}
else if (range.m_TStart < impl->m_CacheRange.m_TStart
&& range.m_TEnd <= impl->m_CacheRange.m_TEnd) {
notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart};
}
else if (range.m_TStart < impl->m_CacheRange.m_TStart
&& range.m_TEnd > impl->m_CacheRange.m_TEnd) {
notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart}
<< SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart};
}
else if (range.m_TStart < impl->m_CacheRange.m_TEnd) {
notInCache << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart};
}
else {
qCCritical(LOG_Variable()) << tr("Detection of unknown case.")
<< QThread::currentThread();
}
}
return notInCache;
The cache is now updated only if date requested has been successfully...
r318 }