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

Function toolboxObjectLookupTopic

pj_datastore/src/plugin_data_host.cpp:1745–1758  ·  view source on GitHub ↗

PJ_object_bytes_handle_t is a heap-allocated sdk::PayloadView: its anchor keeps the buffer alive until the plugin calls release_bytes. No wrapper struct needed — PayloadView already carries the Span + anchor.

Source from the content-addressed store, hash-verified

1743// keeps the buffer alive until the plugin calls release_bytes. No wrapper
1744// struct needed — PayloadView already carries the Span + anchor.
1745PJ_object_topic_handle_t toolboxObjectLookupTopic(void* ctx, PJ_string_view_t topic_name) noexcept {
1746 auto* impl = static_cast<DatastoreToolboxObjectReadHostState*>(ctx);
1747 try {
1748 const auto needle = toStringView(topic_name);
1749 for (const auto id : impl->store.listTopics()) {
1750 if (impl->store.descriptor(id).topic_name == needle) {
1751 return PJ_object_topic_handle_t{id.id};
1752 }
1753 }
1754 } catch (...) {
1755 // Fall through to invalid handle.
1756 }
1757 return PJ_object_topic_handle_t{0};
1758}
1759
1760bool toolboxObjectListTopics(
1761 void* ctx, PJ_object_topic_handle_t* out_buffer, uint64_t buffer_capacity, uint64_t* out_count,

Callers

nothing calls this directly

Calls 3

descriptorMethod · 0.80
toStringViewFunction · 0.70
listTopicsMethod · 0.45

Tested by

no test coverage detected