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

Method sampleAt

pj_datastore/src/query.cpp:322–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322std::optional<SeriesSample> SeriesReader::sampleAt(std::size_t index) const {
323 std::size_t series_index = 0;
324 for (const TopicChunk& chunk : *chunks_) {
325 if (column_index_ >= chunk.columns.size() || chunk.stats.t_max < retention_floor_) {
326 continue;
327 }
328 for (std::size_t row = 0; row < chunk.stats.row_count; ++row) {
329 if (chunk.readTimestamp(row) < retention_floor_) {
330 continue; // logically evicted: not part of the virtual series
331 }
332 if (!readSeriesValue(chunk, column_index_, row).has_value()) {
333 continue;
334 }
335 if (series_index == index) {
336 return makeSeriesSample(chunk, column_index_, row);
337 }
338 ++series_index;
339 }
340 }
341 return std::nullopt;
342}
343
344std::optional<std::size_t> SeriesReader::indexAtOrBeforeTime(Timestamp t) const {
345 std::optional<std::size_t> latest;

Callers 5

ensureChunkIndexMethod · 0.45
readColumnFunction · 0.45
TEST_FFunction · 0.45
TESTFunction · 0.45
TEST_FFunction · 0.45

Calls 4

readSeriesValueFunction · 0.85
makeSeriesSampleFunction · 0.85
readTimestampMethod · 0.80
sizeMethod · 0.45

Tested by 4

readColumnFunction · 0.36
TEST_FFunction · 0.36
TESTFunction · 0.36
TEST_FFunction · 0.36