diff --git a/rmw_fastrtps_cpp/src/rmw_get_topic_endpoint_info.cpp b/rmw_fastrtps_cpp/src/rmw_get_topic_endpoint_info.cpp index 9982d73a7..dbb0397cc 100644 --- a/rmw_fastrtps_cpp/src/rmw_get_topic_endpoint_info.cpp +++ b/rmw_fastrtps_cpp/src/rmw_get_topic_endpoint_info.cpp @@ -43,4 +43,28 @@ rmw_get_subscriptions_info_by_topic( return rmw_fastrtps_shared_cpp::__rmw_get_subscriptions_info_by_topic( eprosima_fastrtps_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); } + +rmw_ret_t +rmw_get_clients_info_by_service( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * clients_info) +{ + return rmw_fastrtps_shared_cpp::__rmw_get_clients_info_by_service( + eprosima_fastrtps_identifier, node, allocator, service_name, no_mangle, clients_info); +} + +rmw_ret_t +rmw_get_servers_info_by_service( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * servers_info) +{ + return rmw_fastrtps_shared_cpp::__rmw_get_servers_info_by_service( + eprosima_fastrtps_identifier, node, allocator, service_name, no_mangle, servers_info); +} } // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_get_topic_endpoint_info.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_get_topic_endpoint_info.cpp index d19492e45..819d3aaa3 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_get_topic_endpoint_info.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_get_topic_endpoint_info.cpp @@ -43,4 +43,28 @@ rmw_get_subscriptions_info_by_topic( return rmw_fastrtps_shared_cpp::__rmw_get_subscriptions_info_by_topic( eprosima_fastrtps_identifier, node, allocator, topic_name, no_mangle, subscriptions_info); } + +rmw_ret_t +rmw_get_clients_info_by_service( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * clients_info) +{ + return rmw_fastrtps_shared_cpp::__rmw_get_clients_info_by_service( + eprosima_fastrtps_identifier, node, allocator, service_name, no_mangle, clients_info); +} + +rmw_ret_t +rmw_get_servers_info_by_service( + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * servers_info) +{ + return rmw_fastrtps_shared_cpp::__rmw_get_servers_info_by_service( + eprosima_fastrtps_identifier, node, allocator, service_name, no_mangle, servers_info); +} } // extern "C" diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp index 1b4f73bc3..1c1587508 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp @@ -523,6 +523,26 @@ __rmw_get_subscriptions_info_by_topic( bool no_mangle, rmw_topic_endpoint_info_array_t * subscriptions_info); +RMW_FASTRTPS_SHARED_CPP_PUBLIC +rmw_ret_t +__rmw_get_clients_info_by_service( + const char * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * clients_info); + +RMW_FASTRTPS_SHARED_CPP_PUBLIC +rmw_ret_t +__rmw_get_servers_info_by_service( + const char * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * servers_info); + RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t __rmw_qos_profile_check_compatible( diff --git a/rmw_fastrtps_shared_cpp/src/rmw_get_topic_endpoint_info.cpp b/rmw_fastrtps_shared_cpp/src/rmw_get_topic_endpoint_info.cpp index 45d4b8e61..e899873fc 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_get_topic_endpoint_info.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_get_topic_endpoint_info.cpp @@ -123,4 +123,71 @@ __rmw_get_subscriptions_info_by_topic( allocator, subscriptions_info); } + +rmw_ret_t +__rmw_get_clients_info_by_service( + const char * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * clients_info) +{ + rmw_ret_t ret = __validate_arguments( + identifier, + node, + allocator, + service_name, + clients_info); + if (ret != RMW_RET_OK) { + return ret; + } + auto common_context = static_cast(node->context->impl->common); + std::string mangled_rp_topic_name = service_name; + DemangleFunction demangle_type = _identity_demangle; + if (!no_mangle) { + mangled_rp_topic_name = \ + _mangle_topic_name(ros_service_response_prefix, service_name, "Reply").to_string(); + demangle_type = _demangle_if_ros_type; + } + return common_context->graph_cache.get_readers_info_by_topic( + mangled_rp_topic_name, + demangle_type, + allocator, + clients_info); +} + +rmw_ret_t +__rmw_get_servers_info_by_service( + const char * identifier, + const rmw_node_t * node, + rcutils_allocator_t * allocator, + const char * service_name, + bool no_mangle, + rmw_topic_endpoint_info_array_t * servers_info) +{ + rmw_ret_t ret = __validate_arguments( + identifier, + node, + allocator, + service_name, + servers_info); + if (ret != RMW_RET_OK) { + return ret; + } + auto common_context = static_cast(node->context->impl->common); + std::string mangled_rp_topic_name = service_name; + DemangleFunction demangle_type = _identity_demangle; + if (!no_mangle) { + mangled_rp_topic_name = \ + _mangle_topic_name(ros_service_response_prefix, service_name, "Reply").to_string(); + demangle_type = _demangle_if_ros_type; + } + + return common_context->graph_cache.get_writers_info_by_topic( + mangled_rp_topic_name, + demangle_type, + allocator, + servers_info); +} } // namespace rmw_fastrtps_shared_cpp