16 #include "rcl/error_handling.h"
18 #include "rcl/network_flow_endpoints.h"
23 #include "rcutils/allocator.h"
24 #include "rcutils/types.h"
26 #include "rmw/error_handling.h"
27 #include "rmw/get_network_flow_endpoints.h"
28 #include "rmw/network_flow_endpoint_array.h"
29 #include "rmw/ret_types.h"
35 __validate_network_flow_endpoint_array(
36 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
40 rmw_error_string_t error_string;
41 rmw_ret_t rmw_ret = rmw_network_flow_endpoint_array_check_zero(network_flow_endpoint_array);
42 if (rmw_ret != RMW_RET_OK) {
43 error_string = rmw_get_error_string();
45 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
46 "rcl_network_flow_endpoint_array_t must be zero initialized: %s,\n"
47 "Use rcl_get_zero_initialized_network_flow_endpoint_array",
51 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
55 rcl_publisher_get_network_flow_endpoints(
57 rcutils_allocator_t * allocator,
58 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
66 rcl_ret_t rcl_ret = __validate_network_flow_endpoint_array(
67 network_flow_endpoint_array);
72 rmw_error_string_t error_string;
73 rmw_ret_t rmw_ret = rmw_publisher_get_network_flow_endpoints(
76 network_flow_endpoint_array);
77 if (rmw_ret != RMW_RET_OK) {
78 error_string = rmw_get_error_string();
80 RCL_SET_ERROR_MSG(error_string.str);
82 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
86 rcl_subscription_get_network_flow_endpoints(
88 rcutils_allocator_t * allocator,
89 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
97 rcl_ret_t rcl_ret = __validate_network_flow_endpoint_array(
98 network_flow_endpoint_array);
103 rmw_error_string_t error_string;
104 rmw_ret_t rmw_ret = rmw_subscription_get_network_flow_endpoints(
107 network_flow_endpoint_array);
108 if (rmw_ret != RMW_RET_OK) {
109 error_string = rmw_get_error_string();
111 RCL_SET_ERROR_MSG(error_string.str);
113 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
#define RCL_CHECK_ALLOCATOR_WITH_MSG(allocator, msg, fail_statement)
Check that the given allocator is initialized, or fail with a message.
RCL_PUBLIC bool rcl_publisher_is_valid(const rcl_publisher_t *publisher)
Return true if the publisher is valid, otherwise false.
RCL_PUBLIC RCL_WARN_UNUSED rmw_publisher_t * rcl_publisher_get_rmw_handle(const rcl_publisher_t *publisher)
Return the rmw publisher handle.
Structure which encapsulates a ROS Publisher.
Structure which encapsulates a ROS Subscription.
RCL_PUBLIC RCL_WARN_UNUSED rmw_subscription_t * rcl_subscription_get_rmw_handle(const rcl_subscription_t *subscription)
Return the rmw subscription handle.
RCL_PUBLIC bool rcl_subscription_is_valid(const rcl_subscription_t *subscription)
Check that the subscription is valid.
#define RCL_RET_OK
Success return code.
#define RCL_RET_INVALID_ARGUMENT
Invalid argument return code.
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.