##// END OF EJS Templates
Update Variable impl for v5
perrinel -
r509:d251b3bc179d
parent child
Show More
@@ -47,10 +47,8 public:
47 bool cacheIsInside(const SqpRange &range) const noexcept;
47 bool cacheIsInside(const SqpRange &range) const noexcept;
48
48
49 QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &range);
49 QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &range);
50
51
52 public slots:
53 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
50 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
51 void mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
54
52
55 signals:
53 signals:
56 void updated();
54 void updated();
@@ -62,5 +60,6 private:
62
60
63 // Required for using shared_ptr in signals/slots
61 // Required for using shared_ptr in signals/slots
64 SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>)
62 SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>)
63 SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_VECTOR_REGISTRY, QVector<std::shared_ptr<Variable> >)
65
64
66 #endif // SCIQLOP_VARIABLE_H
65 #endif // SCIQLOP_VARIABLE_H
@@ -61,6 +61,26 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
61 return;
61 return;
62 }
62 }
63
63
64 impl->m_DataSeries = dataSeries->clone();
65
66 // // Inits the data series of the variable
note

removed later

67 // if (!impl->m_DataSeries) {
68 // impl->m_DataSeries = dataSeries->clone();
69 // }
70 // else {
71 // impl->m_DataSeries->merge(dataSeries.get());
72 // }
73 }
74
75 void Variable::mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
note

Probably. We have to check the API here and to optimize it to avoir unnecessary data dupplication

76 {
77 qCDebug(LOG_Variable()) << "Variable::setDataSeries" << QThread::currentThread()->objectName();
78 if (!dataSeries) {
79 /// @todo ALX : log
80 return;
81 }
82
83 // Add or merge the data
64 // Inits the data series of the variable
84 // Inits the data series of the variable
65 if (!impl->m_DataSeries) {
85 if (!impl->m_DataSeries) {
66 impl->m_DataSeries = dataSeries->clone();
86 impl->m_DataSeries = dataSeries->clone();
@@ -68,6 +88,13 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept
68 else {
88 else {
69 impl->m_DataSeries->merge(dataSeries.get());
89 impl->m_DataSeries->merge(dataSeries.get());
70 }
90 }
91
92 // sub the data
93 auto subData = this->dataSeries()->subData(this->cacheRange());
94 qCCritical(LOG_Variable()) << "TORM: Variable::mergeDataSeries sub" << subData->range();
95 this->setDataSeries(subData);
96 qCCritical(LOG_Variable()) << "TORM: Variable::mergeDataSeries set"
97 << this->dataSeries()->range();
71 }
98 }
72
99
73 IDataSeries *Variable::dataSeries() const noexcept
100 IDataSeries *Variable::dataSeries() const noexcept
@@ -127,10 +154,10 QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range)
127 else if (range.m_TStart < impl->m_CacheRange.m_TStart
154 else if (range.m_TStart < impl->m_CacheRange.m_TStart
128 && range.m_TEnd > impl->m_CacheRange.m_TEnd) {
155 && range.m_TEnd > impl->m_CacheRange.m_TEnd) {
129 notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart}
156 notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart}
130 << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart};
157 << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TEnd};
131 }
158 }
132 else if (range.m_TStart < impl->m_CacheRange.m_TEnd) {
159 else if (range.m_TStart < impl->m_CacheRange.m_TEnd) {
133 notInCache << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart};
160 notInCache << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TEnd};
134 }
161 }
135 else {
162 else {
136 qCCritical(LOG_Variable()) << tr("Detection of unknown case.")
163 qCCritical(LOG_Variable()) << tr("Detection of unknown case.")
General Comments 1
Under Review
author

Auto status change to "Under Review"

You need to be logged in to leave comments. Login now