Auto status change to "Under Review"
@@ -28,17 +28,26 public: | |||||
28 | const QVariantHash &metadata = {}); |
|
28 | const QVariantHash &metadata = {}); | |
29 |
|
29 | |||
30 | QString name() const noexcept; |
|
30 | QString name() const noexcept; | |
31 |
SqpRange |
|
31 | SqpRange range() const noexcept; | |
32 |
void set |
|
32 | void setRange(const SqpRange &range) noexcept; | |
|
33 | SqpRange cacheRange() const noexcept; | |||
|
34 | void setCacheRange(const SqpRange &cacheRange) noexcept; | |||
33 |
|
35 | |||
34 | /// @return the data of the variable, nullptr if there is no data |
|
36 | /// @return the data of the variable, nullptr if there is no data | |
35 | IDataSeries *dataSeries() const noexcept; |
|
37 | IDataSeries *dataSeries() const noexcept; | |
36 |
|
38 | |||
37 | QVariantHash metadata() const noexcept; |
|
39 | QVariantHash metadata() const noexcept; | |
38 |
|
40 | |||
39 |
bool contains(const SqpRange & |
|
41 | bool contains(const SqpRange &range) const noexcept; | |
40 |
bool intersect(const SqpRange & |
|
42 | bool intersect(const SqpRange &range) const noexcept; | |
41 |
bool isInside(const SqpRange & |
|
43 | bool isInside(const SqpRange &range) const noexcept; | |
|
44 | ||||
|
45 | bool cacheContains(const SqpRange &range) const noexcept; | |||
|
46 | bool cacheIntersect(const SqpRange &range) const noexcept; | |||
|
47 | bool cacheIsInside(const SqpRange &range) const noexcept; | |||
|
48 | ||||
|
49 | QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &range); | |||
|
50 | ||||
42 |
|
51 | |||
43 | public slots: |
|
52 | public slots: | |
44 | void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; |
|
53 | void setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; |
@@ -11,13 +11,14 Q_LOGGING_CATEGORY(LOG_Variable, "Variable") | |||||
11 | struct Variable::VariablePrivate { |
|
11 | struct Variable::VariablePrivate { | |
12 | explicit VariablePrivate(const QString &name, const SqpRange &dateTime, |
|
12 | explicit VariablePrivate(const QString &name, const SqpRange &dateTime, | |
13 | const QVariantHash &metadata) |
|
13 | const QVariantHash &metadata) | |
14 |
: m_Name{name}, m_ |
|
14 | : m_Name{name}, m_Range{dateTime}, m_Metadata{metadata}, m_DataSeries{nullptr} | |
15 | { |
|
15 | { | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | QString m_Name; |
|
18 | QString m_Name; | |
19 |
|
19 | |||
20 | SqpRange m_DateTime; // The dateTime available in the view and loaded. not the cache. |
|
20 | SqpRange m_Range; | |
|
21 | SqpRange m_CacheRange; | |||
21 | QVariantHash m_Metadata; |
|
22 | QVariantHash m_Metadata; | |
22 | std::unique_ptr<IDataSeries> m_DataSeries; |
|
23 | std::unique_ptr<IDataSeries> m_DataSeries; | |
23 | }; |
|
24 | }; | |
@@ -32,14 +33,24 QString Variable::name() const noexcept | |||||
32 | return impl->m_Name; |
|
33 | return impl->m_Name; | |
33 | } |
|
34 | } | |
34 |
|
35 | |||
35 |
SqpRange Variable:: |
|
36 | SqpRange Variable::range() const noexcept | |
36 | { |
|
37 | { | |
37 |
return impl->m_ |
|
38 | return impl->m_Range; | |
38 | } |
|
39 | } | |
39 |
|
40 | |||
40 |
void Variable::set |
|
41 | void Variable::setRange(const SqpRange &range) noexcept | |
41 | { |
|
42 | { | |
42 |
impl->m_ |
|
43 | impl->m_Range = range; | |
|
44 | } | |||
|
45 | ||||
|
46 | SqpRange Variable::cacheRange() const noexcept | |||
|
47 | { | |||
|
48 | return impl->m_CacheRange; | |||
|
49 | } | |||
|
50 | ||||
|
51 | void Variable::setCacheRange(const SqpRange &cacheRange) noexcept | |||
|
52 | { | |||
|
53 | impl->m_CacheRange = cacheRange; | |||
43 | } |
|
54 | } | |
44 |
|
55 | |||
45 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept |
|
56 | void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept | |
@@ -56,7 +67,6 void Variable::setDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept | |||||
56 | } |
|
67 | } | |
57 | else { |
|
68 | else { | |
58 | impl->m_DataSeries->merge(dataSeries.get()); |
|
69 | impl->m_DataSeries->merge(dataSeries.get()); | |
59 | // emit updated(); |
|
|||
60 | } |
|
70 | } | |
61 | } |
|
71 | } | |
62 |
|
72 | |||
@@ -70,17 +80,63 QVariantHash Variable::metadata() const noexcept | |||||
70 | return impl->m_Metadata; |
|
80 | return impl->m_Metadata; | |
71 | } |
|
81 | } | |
72 |
|
82 | |||
73 |
bool Variable::contains(const SqpRange & |
|
83 | bool Variable::contains(const SqpRange &range) const noexcept | |
74 | { |
|
84 | { | |
75 |
return impl->m_ |
|
85 | return impl->m_Range.contains(range); | |
76 | } |
|
86 | } | |
77 |
|
87 | |||
78 |
bool Variable::intersect(const SqpRange & |
|
88 | bool Variable::intersect(const SqpRange &range) const noexcept | |
79 | { |
|
89 | { | |
80 |
return impl->m_ |
|
90 | return impl->m_Range.intersect(range); | |
81 | } |
|
91 | } | |
82 |
|
92 | |||
83 |
bool Variable::isInside(const SqpRange & |
|
93 | bool Variable::isInside(const SqpRange &range) const noexcept | |
84 | { |
|
94 | { | |
85 |
return |
|
95 | return range.contains(SqpRange{impl->m_Range.m_TStart, impl->m_Range.m_TEnd}); | |
|
96 | } | |||
|
97 | ||||
|
98 | bool Variable::cacheContains(const SqpRange &range) const noexcept | |||
|
99 | { | |||
|
100 | return impl->m_CacheRange.contains(range); | |||
|
101 | } | |||
|
102 | ||||
|
103 | bool Variable::cacheIntersect(const SqpRange &range) const noexcept | |||
|
104 | { | |||
|
105 | return impl->m_CacheRange.intersect(range); | |||
|
106 | } | |||
|
107 | ||||
|
108 | bool Variable::cacheIsInside(const SqpRange &range) const noexcept | |||
|
109 | { | |||
|
110 | return range.contains(SqpRange{impl->m_CacheRange.m_TStart, impl->m_CacheRange.m_TEnd}); | |||
|
111 | } | |||
|
112 | ||||
|
113 | ||||
|
114 | QVector<SqpRange> Variable::provideNotInCacheRangeList(const SqpRange &range) | |||
|
115 | { | |||
|
116 | auto notInCache = QVector<SqpRange>{}; | |||
|
117 | ||||
|
118 | if (!this->cacheContains(range)) { | |||
|
119 | if (range.m_TEnd <= impl->m_CacheRange.m_TStart | |||
|
120 | || range.m_TStart >= impl->m_CacheRange.m_TEnd) { | |||
|
121 | notInCache << range; | |||
|
122 | } | |||
|
123 | else if (range.m_TStart < impl->m_CacheRange.m_TStart | |||
|
124 | && range.m_TEnd <= impl->m_CacheRange.m_TEnd) { | |||
|
125 | notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart}; | |||
|
126 | } | |||
|
127 | else if (range.m_TStart < impl->m_CacheRange.m_TStart | |||
|
128 | && range.m_TEnd > impl->m_CacheRange.m_TEnd) { | |||
|
129 | notInCache << SqpRange{range.m_TStart, impl->m_CacheRange.m_TStart} | |||
|
130 | << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart}; | |||
|
131 | } | |||
|
132 | else if (range.m_TStart < impl->m_CacheRange.m_TEnd) { | |||
|
133 | notInCache << SqpRange{impl->m_CacheRange.m_TEnd, range.m_TStart}; | |||
|
134 | } | |||
|
135 | else { | |||
|
136 | qCCritical(LOG_Variable()) << tr("Detection of unknown case.") | |||
|
137 | << QThread::currentThread(); | |||
|
138 | } | |||
|
139 | } | |||
|
140 | ||||
|
141 | return notInCache; | |||
86 | } |
|
142 | } |
General Comments 1
You need to be logged in to leave comments.
Login now