##// END OF EJS Templates
Add code of ProvideNotInCacheRange in VC controller
perrinel -
r500:22771cedba86
parent child
Show More
@@ -26,6 +26,9 struct VariableController::VariableControllerPrivate {
26 {
26 {
27 }
27 }
28
28
29 QVector<SqpDateTime> provideNotInCacheDateTimeList(std::shared_ptr<Variable> variable,
30 const SqpDateTime &dateTime);
31
29 QMutex m_WorkingMutex;
32 QMutex m_WorkingMutex;
30 /// Variable model. The VariableController has the ownership
33 /// Variable model. The VariableController has the ownership
31 VariableModel *m_VariableModel;
34 VariableModel *m_VariableModel;
@@ -241,3 +244,33 void VariableController::waitForFinish()
241 {
244 {
242 QMutexLocker locker{&impl->m_WorkingMutex};
245 QMutexLocker locker{&impl->m_WorkingMutex};
243 }
246 }
247
248
249 QVector<SqpDateTime> VariableController::VariableControllerPrivate::provideNotInCacheDateTimeList(
250 std::shared_ptr<Variable> variable, const SqpDateTime &dateTime)
251 {
252 auto notInCache = QVector<SqpDateTime>{};
253
254 if (!variable->contains(dateTime)) {
255 auto vDateTime = variable->dateTime();
256 if (dateTime.m_TEnd <= vDateTime.m_TStart || dateTime.m_TStart >= vDateTime.m_TEnd) {
257 notInCache << dateTime;
258 }
259 else if (dateTime.m_TStart < vDateTime.m_TStart && dateTime.m_TEnd <= vDateTime.m_TEnd) {
260 notInCache << SqpDateTime{dateTime.m_TStart, vDateTime.m_TStart};
261 }
262 else if (dateTime.m_TStart < vDateTime.m_TStart && dateTime.m_TEnd > vDateTime.m_TEnd) {
263 notInCache << SqpDateTime{dateTime.m_TStart, vDateTime.m_TStart}
264 << SqpDateTime{vDateTime.m_TEnd, dateTime.m_TStart};
265 }
266 else if (dateTime.m_TStart < vDateTime.m_TEnd) {
267 notInCache << SqpDateTime{vDateTime.m_TEnd, dateTime.m_TStart};
268 }
269 else {
270 qCCritical(LOG_VariableController()) << tr("Detection of unknown case.")
271 << QThread::currentThread();
272 }
273 }
274
275 return notInCache;
276 }
General Comments 1
Under Review
author

Auto status change to "Under Review"

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