MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / forEachChunk

Method forEachChunk

pj_datastore/src/query.cpp:126–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void RangeCursor::forEachChunk(std::function<void(const ChunkRowRange&)> callback) {
127 for (const TopicChunk& chunk : *chunks_) {
128 // No early break: chunk ranges may overlap, so a later chunk can still
129 // intersect the query range even after one that lies past it.
130 if (chunk.stats.row_count == 0 || chunk.stats.t_max < t_min_ || chunk.stats.t_min > t_max_) {
131 continue;
132 }
133 const auto ts_begin = chunk.timestamps.begin();
134 const auto ts_end = ts_begin + static_cast<std::ptrdiff_t>(chunk.stats.row_count);
135 const auto first_it = std::lower_bound(ts_begin, ts_end, t_min_);
136 const auto end_it = std::upper_bound(first_it, ts_end, t_max_);
137 if (first_it != end_it) {
138 callback(
139 ChunkRowRange{
140 &chunk, static_cast<std::size_t>(first_it - ts_begin), static_cast<std::size_t>(end_it - ts_begin)});
141 }
142 }
143 // Mark cursor exhausted
144 frontiers_.clear();
145}
146
147void RangeCursor::initFrontiers() {
148 const auto& chunks = *chunks_;

Callers 3

TESTFunction · 0.80

Calls 2

beginMethod · 0.45
clearMethod · 0.45

Tested by 1

TESTFunction · 0.64