From d979439dd914a558ddee6c6ee69ba8baab70352d Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Thu, 7 Apr 2022 23:00:56 +0800 Subject: [PATCH 1/2] remove DEFINE_CONTENT_FILTER cmake option Signed-off-by: Chen Lihui --- rclcpp/CMakeLists.txt | 6 ++---- rclcpp/test/rclcpp/CMakeLists.txt | 34 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/rclcpp/CMakeLists.txt b/rclcpp/CMakeLists.txt index de424342ed..d2c0f1bbac 100644 --- a/rclcpp/CMakeLists.txt +++ b/rclcpp/CMakeLists.txt @@ -2,10 +2,8 @@ cmake_minimum_required(VERSION 3.12) project(rclcpp) -option(DEFINE_CONTENT_FILTER "Content filter feature support" ON) -if(DEFINE_CONTENT_FILTER) - add_definitions(-DCONTENT_FILTER_ENABLE) -endif() +# A macro to control the content filter feature support +add_definitions(-DCONTENT_FILTER_ENABLE) find_package(Threads REQUIRED) diff --git a/rclcpp/test/rclcpp/CMakeLists.txt b/rclcpp/test/rclcpp/CMakeLists.txt index 2d7e9a3001..6f915feef5 100644 --- a/rclcpp/test/rclcpp/CMakeLists.txt +++ b/rclcpp/test/rclcpp/CMakeLists.txt @@ -734,22 +734,20 @@ if(TARGET test_graph_listener) target_link_libraries(test_graph_listener ${PROJECT_NAME} mimick) endif() -if(DEFINE_CONTENT_FILTER) - function(test_subscription_content_filter_for_rmw_implementation) - set(rmw_implementation_env_var RMW_IMPLEMENTATION=${rmw_implementation}) - ament_add_gmock(test_subscription_content_filter${target_suffix} - test_subscription_content_filter.cpp - ENV ${rmw_implementation_env_var} - TIMEOUT 120 +function(test_subscription_content_filter_for_rmw_implementation) + set(rmw_implementation_env_var RMW_IMPLEMENTATION=${rmw_implementation}) + ament_add_gmock(test_subscription_content_filter${target_suffix} + test_subscription_content_filter.cpp + ENV ${rmw_implementation_env_var} + TIMEOUT 120 + ) + if(TARGET test_subscription_content_filter${target_suffix}) + target_link_libraries(test_subscription_content_filter${target_suffix} ${PROJECT_NAME} mimick) + ament_target_dependencies(test_subscription_content_filter${target_suffix} + "rcpputils" + "rosidl_typesupport_cpp" + "test_msgs" ) - if(TARGET test_subscription_content_filter${target_suffix}) - target_link_libraries(test_subscription_content_filter${target_suffix} ${PROJECT_NAME} mimick) - ament_target_dependencies(test_subscription_content_filter${target_suffix} - "rcpputils" - "rosidl_typesupport_cpp" - "test_msgs" - ) - endif() - endfunction() - call_for_each_rmw_implementation(test_subscription_content_filter_for_rmw_implementation) -endif() + endif() +endfunction() +call_for_each_rmw_implementation(test_subscription_content_filter_for_rmw_implementation) From 881fcfc6989fa997ebaa0e2fc866ad3702d5ebea Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Fri, 8 Apr 2022 09:15:43 +0800 Subject: [PATCH 2/2] remove the macro CONTENT_FILTER_ENABLE as well Signed-off-by: Chen Lihui --- rclcpp/CMakeLists.txt | 3 --- rclcpp/include/rclcpp/subscription_base.hpp | 2 -- rclcpp/include/rclcpp/subscription_options.hpp | 3 +-- rclcpp/src/rclcpp/subscription_base.cpp | 2 -- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/rclcpp/CMakeLists.txt b/rclcpp/CMakeLists.txt index d2c0f1bbac..9572f422a8 100644 --- a/rclcpp/CMakeLists.txt +++ b/rclcpp/CMakeLists.txt @@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.12) project(rclcpp) -# A macro to control the content filter feature support -add_definitions(-DCONTENT_FILTER_ENABLE) - find_package(Threads REQUIRED) find_package(ament_cmake_ros REQUIRED) diff --git a/rclcpp/include/rclcpp/subscription_base.hpp b/rclcpp/include/rclcpp/subscription_base.hpp index 0ad098b027..f21f27e864 100644 --- a/rclcpp/include/rclcpp/subscription_base.hpp +++ b/rclcpp/include/rclcpp/subscription_base.hpp @@ -492,7 +492,6 @@ class SubscriptionBase : public std::enable_shared_from_this event_handlers_[event_type]->clear_on_ready_callback(); } -#ifdef CONTENT_FILTER_ENABLE /// Check if content filtered topic feature of the subscription instance is enabled. /** * \return boolean flag indicating if the content filtered topic of this subscription is enabled. @@ -526,7 +525,6 @@ class SubscriptionBase : public std::enable_shared_from_this RCLCPP_PUBLIC rclcpp::ContentFilterOptions get_content_filter() const; -#endif // CONTENT_FILTER_ENABLE protected: template diff --git a/rclcpp/include/rclcpp/subscription_options.hpp b/rclcpp/include/rclcpp/subscription_options.hpp index da81b8ffb0..b6914ce4b2 100644 --- a/rclcpp/include/rclcpp/subscription_options.hpp +++ b/rclcpp/include/rclcpp/subscription_options.hpp @@ -126,7 +126,6 @@ struct SubscriptionOptionsWithAllocator : public SubscriptionOptionsBase rmw_implementation_payload->modify_rmw_subscription_options(result.rmw_subscription_options); } -#ifdef CONTENT_FILTER_ENABLE // Copy content_filter_options into rcl_subscription_options. if (!content_filter_options.filter_expression.empty()) { std::vector cstrings = @@ -141,7 +140,7 @@ struct SubscriptionOptionsWithAllocator : public SubscriptionOptionsBase ret, "failed to set content_filter_options"); } } -#endif // CONTENT_FILTER_ENABLE + return result; } diff --git a/rclcpp/src/rclcpp/subscription_base.cpp b/rclcpp/src/rclcpp/subscription_base.cpp index dfe3c30ead..300f465a41 100644 --- a/rclcpp/src/rclcpp/subscription_base.cpp +++ b/rclcpp/src/rclcpp/subscription_base.cpp @@ -357,7 +357,6 @@ SubscriptionBase::set_on_new_message_callback( } } -#ifdef CONTENT_FILTER_ENABLE bool SubscriptionBase::is_cft_enabled() const { @@ -445,4 +444,3 @@ SubscriptionBase::get_content_filter() const return ret_options; } -#endif // CONTENT_FILTER_ENABLE