@@ -5,10 +5,15 | |||
|
5 | 5 | |
|
6 | 6 | #include <Data/SqpDateTime.h> |
|
7 | 7 | |
|
8 | #include <QLoggingCategory> | |
|
9 | ||
|
8 | 10 | #include <Common/spimpl.h> |
|
9 | 11 | |
|
10 | 12 | class Variable; |
|
11 | 13 | |
|
14 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableCacheController) | |
|
15 | ||
|
16 | ||
|
12 | 17 | /// This class aims to store in the cache all of the dateTime already requested to the variable. |
|
13 | 18 | class VariableCacheController : public QObject { |
|
14 | 19 | Q_OBJECT |
@@ -25,6 +30,8 public: | |||
|
25 | 30 | |
|
26 | 31 | QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept; |
|
27 | 32 | |
|
33 | void displayCache(std::shared_ptr<Variable> variable); | |
|
34 | ||
|
28 | 35 | private: |
|
29 | 36 | class VariableCacheControllerPrivate; |
|
30 | 37 | spimpl::unique_impl_ptr<VariableCacheControllerPrivate> impl; |
@@ -3,6 +3,8 | |||
|
3 | 3 | #include "Variable/Variable.h" |
|
4 | 4 | #include <unordered_map> |
|
5 | 5 | |
|
6 | Q_LOGGING_CATEGORY(LOG_VariableCacheController, "VariableCacheController") | |
|
7 | ||
|
6 | 8 | struct VariableCacheController::VariableCacheControllerPrivate { |
|
7 | 9 | |
|
8 | 10 | std::unordered_map<std::shared_ptr<Variable>, QVector<SqpDateTime> > |
@@ -156,15 +158,26 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataBySt | |||
|
156 | 158 | // ts localised between to interval: let's localized te |
|
157 | 159 | addInCacheDataByEnd(dateTime, dateTimeList, notInCache, cacheIndex, currentTStart); |
|
158 | 160 | } |
|
159 |
else if ( |
|
|
160 | // 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 | |
|
162 | // in the cache | |
|
163 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, | |
|
164 | currentDateTimeI.m_TEnd); | |
|
161 | else if (currentTStart < currentDateTimeI.m_TEnd) { | |
|
162 | if (dateTime.m_TEnd > currentDateTimeI.m_TEnd) { | |
|
163 | // ts not localised before the current interval: we need to look at the next interval | |
|
164 | // We can assume now current tstart is the last interval tend, because data between them | |
|
165 | // are | |
|
166 | // in the cache | |
|
167 | addInCacheDataByStart(dateTime, dateTimeList, notInCache, ++cacheIndex, | |
|
168 | currentDateTimeI.m_TEnd); | |
|
169 | } | |
|
165 | 170 | } |
|
166 | 171 | else { |
|
167 | 172 | // ts not localised before the current interval: we need to look at the next interval |
|
168 | 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