From d688eb1d3035eefe5bbd6518d1cc6fa0857a9f70 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Thu, 29 May 2025 07:10:42 +0000 Subject: [PATCH 1/3] Retrieve HistoryQoS in discovery when available Signed-off-by: Mario Dominguez --- .../include/rmw_fastrtps_shared_cpp/qos.hpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp index 76edddad50..6b959a0079 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp @@ -175,6 +175,27 @@ rtps_qos_to_rmw_qos( break; } qos->liveliness_lease_duration = dds_duration_to_rmw(rtps_qos.liveliness.lease_duration); + + if (rtps_qos.history.has_value()) + { + if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS) + { + qos->history = RMW_QOS_POLICY_HISTORY_KEEP_LAST; + } + else if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS) + { + qos->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL; + } + else + { + qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; + } + qos->depth = static_cast(rtps_qos.history->depth); + } + else + { + qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; + } } extern template RMW_FASTRTPS_SHARED_CPP_PUBLIC From 5c6f53c96f8bbfdc1ad4c6723d91cc78cb5df22d Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Fri, 30 May 2025 11:11:31 +0000 Subject: [PATCH 2/3] Linter Signed-off-by: Mario Dominguez --- .../include/rmw_fastrtps_shared_cpp/qos.hpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp index 6b959a0079..52422b361b 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp @@ -176,24 +176,16 @@ rtps_qos_to_rmw_qos( } qos->liveliness_lease_duration = dds_duration_to_rmw(rtps_qos.liveliness.lease_duration); - if (rtps_qos.history.has_value()) - { - if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS) - { + if (rtps_qos.history.has_value()) { + if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS) { qos->history = RMW_QOS_POLICY_HISTORY_KEEP_LAST; - } - else if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS) - { + } else if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS) { qos->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL; - } - else - { + } else { qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; } qos->depth = static_cast(rtps_qos.history->depth); - } - else - { + } else { qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; } } From 5346e28e1bceb7c86a89f3ebcf38859e4e59d56e Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Mon, 2 Jun 2025 07:19:21 +0000 Subject: [PATCH 3/3] Change if-else to switch Signed-off-by: Mario Dominguez --- .../include/rmw_fastrtps_shared_cpp/qos.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp index 52422b361b..aa1c0f4841 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos.hpp @@ -177,12 +177,16 @@ rtps_qos_to_rmw_qos( qos->liveliness_lease_duration = dds_duration_to_rmw(rtps_qos.liveliness.lease_duration); if (rtps_qos.history.has_value()) { - if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS) { - qos->history = RMW_QOS_POLICY_HISTORY_KEEP_LAST; - } else if (rtps_qos.history->kind == eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS) { - qos->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL; - } else { - qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; + switch (rtps_qos.history->kind) { + case eprosima::fastdds::dds::KEEP_LAST_HISTORY_QOS: + qos->history = RMW_QOS_POLICY_HISTORY_KEEP_LAST; + break; + case eprosima::fastdds::dds::KEEP_ALL_HISTORY_QOS: + qos->history = RMW_QOS_POLICY_HISTORY_KEEP_ALL; + break; + default: + qos->history = RMW_QOS_POLICY_HISTORY_UNKNOWN; + break; } qos->depth = static_cast(rtps_qos.history->depth); } else {