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

Method lookup

pj_scene2D/core/src/entry_thumbnail_cache.cpp:40–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40std::optional<DecodedFrame> EntryThumbnailCache::lookup(Timestamp ts_ns) const {
41 std::lock_guard<std::mutex> lock(mutex_);
42 if (tiles_.empty()) {
43 return std::nullopt;
44 }
45 // Nearest at-or-before: first tile with ts > ts_ns, then step back one.
46 auto it =
47 std::upper_bound(tiles_.begin(), tiles_.end(), ts_ns, [](Timestamp t, const Tile& tile) { return t < tile.ts; });
48 if (it == tiles_.begin()) {
49 return std::nullopt;
50 }
51 --it;
52 return decodeThumbnailJpeg(it->jpeg.data(), it->jpeg.size(), it->width, it->height);
53}
54
55void EntryThumbnailCache::prune(Timestamp before_ns) {
56 std::lock_guard<std::mutex> lock(mutex_);

Callers 1

decodeRequestMethod · 0.45

Calls 6

decodeThumbnailJpegFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected