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

Function toolboxObjectListTopics

pj_datastore/src/plugin_data_host.cpp:1760–1789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1758}
1759
1760bool toolboxObjectListTopics(
1761 void* ctx, PJ_object_topic_handle_t* out_buffer, uint64_t buffer_capacity, uint64_t* out_count,
1762 PJ_error_t* out_error) noexcept {
1763 auto* impl = static_cast<DatastoreToolboxObjectReadHostState*>(ctx);
1764 if (out_count == nullptr) {
1765 propagateError(out_error, "out_count must not be null");
1766 return false;
1767 }
1768 try {
1769 const auto ids = impl->store.listTopics();
1770 *out_count = ids.size();
1771 if (out_buffer != nullptr) {
1772 // buffer_capacity is uint64_t (ABI); ids.size() is size_t. Compare in
1773 // uint64_t, then index with size_t (n <= ids.size(), so it fits).
1774 const std::size_t n = static_cast<std::size_t>(std::min<uint64_t>(buffer_capacity, ids.size()));
1775 for (std::size_t i = 0; i < n; ++i) {
1776 out_buffer[i] = PJ_object_topic_handle_t{ids[i].id};
1777 }
1778 }
1779 return true;
1780 } catch (const std::exception& e) {
1781 impl->setError(e.what());
1782 propagateError(out_error, impl->last_error.c_str());
1783 return false;
1784 } catch (...) {
1785 impl->setError("listTopics: unknown exception");
1786 propagateError(out_error, impl->last_error.c_str());
1787 return false;
1788 }
1789}
1790
1791const char* toolboxObjectTopicMetadata(void* ctx, PJ_object_topic_handle_t topic) noexcept {
1792 auto* impl = static_cast<DatastoreToolboxObjectReadHostState*>(ctx);

Callers

nothing calls this directly

Calls 4

propagateErrorFunction · 0.85
listTopicsMethod · 0.45
sizeMethod · 0.45
setErrorMethod · 0.45

Tested by

no test coverage detected