@@ -30,7 +30,7 public: | |||
|
30 | 30 | |
|
31 | 31 | QVector<SqpDateTime> dateCacheList(std::shared_ptr<Variable> variable) const noexcept; |
|
32 | 32 | |
|
33 | void displayCache(std::shared_ptr<Variable> variable); | |
|
33 | void displayCache(std::shared_ptr<Variable> variable) const; | |
|
34 | 34 | |
|
35 | 35 | private: |
|
36 | 36 | class VariableCacheControllerPrivate; |
@@ -50,8 +50,13 void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, | |||
|
50 | 50 | // will be compared to the next interval. The old one is remove from the list |
|
51 | 51 | // C: if it is superior, we do the same with the next interval of the list |
|
52 | 52 | |
|
53 | impl->addDateTimeRecurse(dateTime, impl->m_VariableToSqpDateTimeListMap.at(variable), | |
|
54 | 0); | |
|
53 | try { | |
|
54 | impl->addDateTimeRecurse(dateTime, | |
|
55 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); | |
|
56 | } | |
|
57 | catch (const std::out_of_range &e) { | |
|
58 | qCInfo(LOG_VariableCacheController()) << e.what(); | |
|
59 | } | |
|
55 | 60 | } |
|
56 | 61 | } |
|
57 | 62 | } |
@@ -67,8 +72,13 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> | |||
|
67 | 72 | // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b |
|
68 | 73 | // (with a & b of type SqpDateTime) means ts(b) > te(a) |
|
69 | 74 | |
|
75 | try { | |
|
70 | 76 | impl->addInCacheDataByStart(dateTime, impl->m_VariableToSqpDateTimeListMap.at(variable), |
|
71 | 77 | notInCache, 0, dateTime.m_TStart); |
|
78 | } | |
|
79 | catch (const std::out_of_range &e) { | |
|
80 | qCInfo(LOG_VariableCacheController()) << e.what(); | |
|
81 | } | |
|
72 | 82 | |
|
73 | 83 | return notInCache; |
|
74 | 84 | } |
@@ -76,8 +86,14 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> | |||
|
76 | 86 | QVector<SqpDateTime> |
|
77 | 87 | VariableCacheController::dateCacheList(std::shared_ptr<Variable> variable) const noexcept |
|
78 | 88 | { |
|
89 | try { | |
|
79 | 90 | return impl->m_VariableToSqpDateTimeListMap.at(variable); |
|
80 | 91 | } |
|
92 | catch (const std::out_of_range &e) { | |
|
93 | qCInfo(LOG_VariableCacheController()) << e.what(); | |
|
94 | return QVector<SqpDateTime>{}; | |
|
95 | } | |
|
96 | } | |
|
81 | 97 | |
|
82 | 98 | void VariableCacheController::VariableCacheControllerPrivate::addDateTimeRecurse( |
|
83 | 99 | const SqpDateTime &dateTime, QVector<SqpDateTime> &dateTimeList, int cacheIndex) |
@@ -175,9 +191,15 void VariableCacheController::VariableCacheControllerPrivate::addInCacheDataBySt | |||
|
175 | 191 | } |
|
176 | 192 | |
|
177 | 193 | |
|
178 | void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) | |
|
194 | void VariableCacheController::displayCache(std::shared_ptr<Variable> variable) const | |
|
179 | 195 | { |
|
180 |
auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap. |
|
|
196 | auto variableDateTimeList = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
|
197 | if (variableDateTimeList != impl->m_VariableToSqpDateTimeListMap.end()) { | |
|
181 | 198 | qCInfo(LOG_VariableCacheController()) << tr("VariableCacheController::displayCache") |
|
182 | << variableDateTimeList; | |
|
199 | << variableDateTimeList->second; | |
|
200 | } | |
|
201 | else { | |
|
202 | qCWarning(LOG_VariableCacheController()) | |
|
203 | << tr("Cannot display a variable that is not in the cache"); | |
|
204 | } | |
|
183 | 205 | } |
General Comments 0
You need to be logged in to leave comments.
Login now