From 0343380fd82153bbfa252371b5d48ff2dd7d2d38 Mon Sep 17 00:00:00 2001 From: Thomas Debrunner Date: Mon, 25 Sep 2023 11:26:39 +0200 Subject: [PATCH] data-container: Only return names of multi-id topics once, add getter for subscription message-id map --- ulog_cpp/data_container.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ulog_cpp/data_container.hpp b/ulog_cpp/data_container.hpp index 965be06..54a6e1c 100644 --- a/ulog_cpp/data_container.hpp +++ b/ulog_cpp/data_container.hpp @@ -6,6 +6,7 @@ #include #include +#include #include #include "data_handler_interface.hpp" @@ -87,13 +88,18 @@ class DataContainer : public DataHandlerInterface { return _subscriptions_by_name_and_multi_id; } + const std::map>& subscriptionsByMessageId() + { + return _subscriptions_by_message_id; + } + std::vector subscriptionNames() const { - std::vector names; + std::unordered_set names; for (const auto& kv : _subscriptions_by_name_and_multi_id) { - names.push_back(kv.first.name); + names.insert(kv.first.name); } - return names; + return std::vector(names.begin(), names.end()); } std::shared_ptr subscription(const std::string& name, int multi_id) const