From 8e8432dbc10a121d98bbe8855191b487077f0a7a Mon Sep 17 00:00:00 2001 From: Carlosespicur Date: Fri, 9 Aug 2024 10:22:39 +0200 Subject: [PATCH] Refs #21458: Add IDL getter for Monitor controller communication Signed-off-by: Carlosespicur --- .../StatisticsBackend.hpp | 10 ++++++++++ src/cpp/StatisticsBackend.cpp | 13 +++++++++++++ src/cpp/database/database.cpp | 3 +-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/include/fastdds_statistics_backend/StatisticsBackend.hpp b/include/fastdds_statistics_backend/StatisticsBackend.hpp index 873876f84..236cd5630 100644 --- a/include/fastdds_statistics_backend/StatisticsBackend.hpp +++ b/include/fastdds_statistics_backend/StatisticsBackend.hpp @@ -263,6 +263,16 @@ class StatisticsBackend static Info get_info( EntityId entity_id); + /** + * @brief Get the IDL representation of a data type in string format for a given topic entity + * + * @param entity_id The entity for which the data type IDL is retrieved. + * @return String object describing the entity's data type IDL. + */ + FASTDDS_STATISTICS_BACKEND_DllAPI + static std::string get_type_idl( + EntityId entity_id); + /** * @brief Provides access to the data measured during the monitoring. * diff --git a/src/cpp/StatisticsBackend.cpp b/src/cpp/StatisticsBackend.cpp index a05858a3f..83b8a3c46 100644 --- a/src/cpp/StatisticsBackend.cpp +++ b/src/cpp/StatisticsBackend.cpp @@ -537,6 +537,19 @@ Info StatisticsBackend::get_info( return StatisticsBackendData::get_instance()->database_->get_info(entity_id); } +std::string StatisticsBackend::get_type_idl( + EntityId entity_id) +{ + // Check if the entity is a topic + if (EntityKind::TOPIC != get_type(entity_id)) + { + throw BadParameter("EntityId received does not match with a valid topic entity"); + } + Info topic_info = StatisticsBackend::get_info(entity_id); + return StatisticsBackendData::get_instance()->database_->get_type_idl(topic_info[DATA_TYPE_TAG]); + +} + std::vector StatisticsBackend::get_data( DataKind data_type, const std::vector& entity_ids_source, diff --git a/src/cpp/database/database.cpp b/src/cpp/database/database.cpp index ef5eb8730..44774b764 100644 --- a/src/cpp/database/database.cpp +++ b/src/cpp/database/database.cpp @@ -5352,8 +5352,7 @@ Info Database::get_info( break; } } - // __FLAG__ - std::cout << "Info:" << info << std::endl; + return info; }