From ccd5b491861b461f0a53809b818ca6fa8d2d0c7c Mon Sep 17 00:00:00 2001 From: bpwilcox Date: Wed, 21 Aug 2019 17:02:37 -0700 Subject: [PATCH] add callback group as member variable and constructor arg (#811) Signed-off-by: bpwilcox remove callback group as member variable --- rclcpp/include/rclcpp/parameter_client.hpp | 9 +++++--- rclcpp/src/rclcpp/parameter_client.cpp | 27 +++++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/rclcpp/include/rclcpp/parameter_client.hpp b/rclcpp/include/rclcpp/parameter_client.hpp index 1ef02f87fe..77ae4d231e 100644 --- a/rclcpp/include/rclcpp/parameter_client.hpp +++ b/rclcpp/include/rclcpp/parameter_client.hpp @@ -53,19 +53,22 @@ class AsyncParametersClient const rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface, const std::string & remote_node_name = "", - const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters); + const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters, + rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr); RCLCPP_PUBLIC AsyncParametersClient( const rclcpp::Node::SharedPtr node, const std::string & remote_node_name = "", - const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters); + const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters, + rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr); RCLCPP_PUBLIC AsyncParametersClient( rclcpp::Node * node, const std::string & remote_node_name = "", - const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters); + const rmw_qos_profile_t & qos_profile = rmw_qos_profile_parameters, + rclcpp::callback_group::CallbackGroup::SharedPtr group = nullptr); RCLCPP_PUBLIC std::shared_future> diff --git a/rclcpp/src/rclcpp/parameter_client.cpp b/rclcpp/src/rclcpp/parameter_client.cpp index 689d7eaed3..8afbf43726 100644 --- a/rclcpp/src/rclcpp/parameter_client.cpp +++ b/rclcpp/src/rclcpp/parameter_client.cpp @@ -30,7 +30,8 @@ AsyncParametersClient::AsyncParametersClient( const rclcpp::node_interfaces::NodeGraphInterface::SharedPtr node_graph_interface, const rclcpp::node_interfaces::NodeServicesInterface::SharedPtr node_services_interface, const std::string & remote_node_name, - const rmw_qos_profile_t & qos_profile) + const rmw_qos_profile_t & qos_profile, + rclcpp::callback_group::CallbackGroup::SharedPtr group) : node_topics_interface_(node_topics_interface) { if (remote_node_name != "") { @@ -51,7 +52,7 @@ AsyncParametersClient::AsyncParametersClient( remote_node_name_ + "/" + parameter_service_names::get_parameters, options); auto get_parameters_base = std::dynamic_pointer_cast(get_parameters_client_); - node_services_interface->add_client(get_parameters_base, nullptr); + node_services_interface->add_client(get_parameters_base, group); get_parameter_types_client_ = Client::make_shared( node_base_interface.get(), @@ -60,7 +61,7 @@ AsyncParametersClient::AsyncParametersClient( options); auto get_parameter_types_base = std::dynamic_pointer_cast(get_parameter_types_client_); - node_services_interface->add_client(get_parameter_types_base, nullptr); + node_services_interface->add_client(get_parameter_types_base, group); set_parameters_client_ = Client::make_shared( node_base_interface.get(), @@ -68,7 +69,7 @@ AsyncParametersClient::AsyncParametersClient( remote_node_name_ + "/" + parameter_service_names::set_parameters, options); auto set_parameters_base = std::dynamic_pointer_cast(set_parameters_client_); - node_services_interface->add_client(set_parameters_base, nullptr); + node_services_interface->add_client(set_parameters_base, group); set_parameters_atomically_client_ = Client::make_shared( @@ -78,7 +79,7 @@ AsyncParametersClient::AsyncParametersClient( options); auto set_parameters_atomically_base = std::dynamic_pointer_cast( set_parameters_atomically_client_); - node_services_interface->add_client(set_parameters_atomically_base, nullptr); + node_services_interface->add_client(set_parameters_atomically_base, group); list_parameters_client_ = Client::make_shared( node_base_interface.get(), @@ -86,7 +87,7 @@ AsyncParametersClient::AsyncParametersClient( remote_node_name_ + "/" + parameter_service_names::list_parameters, options); auto list_parameters_base = std::dynamic_pointer_cast(list_parameters_client_); - node_services_interface->add_client(list_parameters_base, nullptr); + node_services_interface->add_client(list_parameters_base, group); describe_parameters_client_ = Client::make_shared( node_base_interface.get(), @@ -95,33 +96,37 @@ AsyncParametersClient::AsyncParametersClient( options); auto describe_parameters_base = std::dynamic_pointer_cast(describe_parameters_client_); - node_services_interface->add_client(describe_parameters_base, nullptr); + node_services_interface->add_client(describe_parameters_base, group); } AsyncParametersClient::AsyncParametersClient( const rclcpp::Node::SharedPtr node, const std::string & remote_node_name, - const rmw_qos_profile_t & qos_profile) + const rmw_qos_profile_t & qos_profile, + rclcpp::callback_group::CallbackGroup::SharedPtr group) : AsyncParametersClient( node->get_node_base_interface(), node->get_node_topics_interface(), node->get_node_graph_interface(), node->get_node_services_interface(), remote_node_name, - qos_profile) + qos_profile, + group) {} AsyncParametersClient::AsyncParametersClient( rclcpp::Node * node, const std::string & remote_node_name, - const rmw_qos_profile_t & qos_profile) + const rmw_qos_profile_t & qos_profile, + rclcpp::callback_group::CallbackGroup::SharedPtr group) : AsyncParametersClient( node->get_node_base_interface(), node->get_node_topics_interface(), node->get_node_graph_interface(), node->get_node_services_interface(), remote_node_name, - qos_profile) + qos_profile, + group) {} std::shared_future>