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

Method forEachVisibleRawRange

pj_runtime/src/AppSession.cpp:65–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void AppSession::forEachVisibleRawRange(
66 const std::function<void(DatasetId dataset_id, Timestamp raw_min, Timestamp raw_max)>& visit) const {
67 const DataReader reader = session_manager_->createReader();
68 const ObjectStore& object_store = session_manager_->objectStore();
69
70 // Bounds come from the CATALOG-VISIBLE items at per-topic granularity: the
71 // engine retains removed/trashed topics' data (append-only tombstones), and
72 // a hidden topic must not stretch the timeline even while sibling topics
73 // keep its dataset visible.
74 //
75 // Multi-field topics surface one catalog item per field; bound each
76 // underlying topic once.
77 std::unordered_set<TopicId> seen_topics;
78 std::unordered_set<uint32_t> seen_object_topics;
79 for (const CatalogItem& item : catalog_model_->items()) {
80 Timestamp raw_min = 0;
81 Timestamp raw_max = 0;
82 if (const ScalarFieldPayload* scalar = asScalarField(item)) {
83 if (!seen_topics.insert(scalar->topic_id).second) {
84 continue;
85 }
86 const auto metadata = reader.getMetadata(scalar->topic_id);
87 if (!metadata.has_value() || metadata->total_row_count == 0) {
88 continue;
89 }
90 raw_min = metadata->time_range_min;
91 raw_max = metadata->time_range_max;
92 } else if (const ObjectTopicPayload* object = asObjectTopic(item)) {
93 if (!seen_object_topics.insert(object->object_topic_id.id).second) {
94 continue;
95 }
96 if (object_store.entryCount(object->object_topic_id) == 0) {
97 continue;
98 }
99 std::tie(raw_min, raw_max) = object_store.timeRange(object->object_topic_id);
100 } else {
101 continue;
102 }
103 visit(item.dataset_id, raw_min, raw_max);
104 }
105}
106
107std::optional<PJ::Range<PJ::Timestamp>> AppSession::datasetRawTimeRange(DatasetId dataset_id) const {
108 // RAW (pre-offset) union over THIS dataset's catalog-visible topics. The

Callers

nothing calls this directly

Calls 9

asScalarFieldFunction · 0.85
asObjectTopicFunction · 0.85
objectStoreMethod · 0.80
itemsMethod · 0.80
getMetadataMethod · 0.80
entryCountMethod · 0.80
createReaderMethod · 0.45
insertMethod · 0.45
timeRangeMethod · 0.45

Tested by

no test coverage detected