##// END OF EJS Templates
Add method to display cache....
perrinel -
r293:64d757eeae79
parent child
Show More
@@ -5,10 +5,15
5
5
6 #include <Data/SqpDateTime.h>
6 #include <Data/SqpDateTime.h>
7
7
8 #include <QLoggingCategory>
9
8 #include <Common/spimpl.h>
10 #include <Common/spimpl.h>
9
11
10 class Variable;
12 class Variable;
11
13
14 Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController)
15
16
12 /// This class aims to store in the cache all of the dateTime already requested to the variable.
17 /// This class aims to store in the cache all of the dateTime already requested to the variable.
13 class VariableCacheController : public QObject {
18 class VariableCacheController : public QObject {
14 Q_OBJECT
19 Q_OBJECT
@@ -25,6 +30,8 public:
25
30
26 QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept;
31 QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept;
27
32
33 void displayCache(std::shared_ptr<Variable> variable);
34
28 private:
35 private:
29 class VariableCacheControllerPrivate;
36 class VariableCacheControllerPrivate;
30 spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl;
37 spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl;
@@ -3,6 +3,8
3 #include "Variable/Variable.h"
3 #include "Variable/Variable.h"
4 #include <unordered_map>
4 #include <unordered_map>
5
5
6 Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController")
7
6 struct VariableCacheController::VariableCacheControllerPrivate {
8 struct VariableCacheController::VariableCacheControllerPrivate {
7
9
8 std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> >
10 std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> >
@@ -156,15 +158,26 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataBySt
156 // ts localised between to interval: let's localized te
158 // ts localised between to interval: let's localized te
157 addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart);
159 addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart);
158 }
160 }
159 else if (dateTime.m_TStart < currentDateTimeI.m_TEnd) {
161 else if (currentTStart < currentDateTimeI.m_TEnd) {
162 if (dateTime.m_TEnd > currentDateTimeI.m_TEnd) {
160 // ts not localised before the current interval: we need to look at the next interval
163 // ts not localised before the current interval: we need to look at the next interval
161 // We can assume now current tstart is the last interval tend, because data between them are
164 // We can assume now current tstart is the last interval tend, because data between them
165 // are
162 // in the cache
166 // in the cache
163 addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex,
167 addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex,
164 currentDateTimeI.m_TEnd);
168 currentDateTimeI.m_TEnd);
165 }
169 }
170 }
166 else {
171 else {
167 // ts not localised before the current interval: we need to look at the next interval
172 // ts not localised before the current interval: we need to look at the next interval
168 addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, currentTStart);
173 addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, currentTStart);
169 }
174 }
170 }
175 }
176
177
178 void VariableCacheController::displayCache(std::shared_ptr<Variable> variable)
179 {
180 auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.at(variable);
181 qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache")
182 << variableDateTimeList;
183 }
General Comments 0
You need to be logged in to leave comments. Login now