##// END OF EJS Templates
Add method to get range in cacheRange
perrinel -
r570:b812e9112359
parent child
Show More
@@ -47,6 +47,7 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) const noexcept;
49 QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &range) const noexcept;
50 QVector<SqpRange> provideInCacheRangeList(const SqpRange &range) const noexcept;
50 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
51 void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
51 void mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
52 void mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept;
52
53
@@ -182,6 +182,8 bool Variable::cacheIsInside(const SqpRange &range) const noexcept
182
182
183 QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range) const noexcept
183 QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range) const noexcept
184 {
184 {
185 // This code assume that cach in contigue. Can return 0, 1 or 2 SqpRange
186
185 auto notInCache = QVector<SqpRange>{};
187 auto notInCache = QVector<SqpRange>{};
186
188
187 if (!this->cacheContains(range)) {
189 if (!this->cacheContains(range)) {
@@ -209,3 +211,33 QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range) co
209
211
210 return notInCache;
212 return notInCache;
211 }
213 }
214
215 QVector<SqpRange> Variable::provideInCacheRangeList(const SqpRange &range) const noexcept
216 {
217 // This code assume that cach in contigue. Can return 0 or 1 SqpRange
218
219 auto inCache = QVector<SqpRange>{};
220
221
222 if (this->cacheContains(range)) {
223 if (range.m_TStart <= impl->m_CacheRange.m_TEnd
224 && range.m_TEnd >= impl->m_CacheRange.m_TEnd) {
225 inCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TEnd};
226 }
227
228 else if (range.m_TStart >= impl->m_CacheRange.m_TStart
229 && range.m_TEnd < impl->m_CacheRange.m_TEnd) {
230 inCache << range;
231 }
232 else if (range.m_TStart < impl->m_CacheRange.m_TStart
233 && range.m_TEnd >= impl->m_CacheRange.m_TStart) {
234 inCache << SqpRange{impl->m_CacheRange.m_TStart, range.m_TEnd};
235 }
236 else {
237 qCCritical(LOG_Variable()) << tr("Detection of unknown case.")
238 << QThread::currentThread();
239 }
240 }
241
242 return inCache;
243 }
General Comments 0
You need to be logged in to leave comments. Login now