15 #include "rcl/error_handling.h"
17 #include "rcl/network_flow_endpoints.h"
21 #include "rcutils/allocator.h"
22 #include "rcutils/macros.h"
23 #include "rcutils/types.h"
25 #include "rmw/error_handling.h"
26 #include "rmw/get_network_flow_endpoints.h"
27 #include "rmw/network_flow_endpoint_array.h"
28 #include "rmw/types.h"
33 __validate_network_flow_endpoint_array(
34 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
38 rmw_error_string_t error_string;
39 rmw_ret_t rmw_ret = rmw_network_flow_endpoint_array_check_zero(network_flow_endpoint_array);
40 if (rmw_ret != RMW_RET_OK) {
41 error_string = rmw_get_error_string();
43 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
44 "rcl_network_flow_endpoint_array_t must be zero initialized: %s,\n"
45 "Use rcl_get_zero_initialized_network_flow_endpoint_array",
49 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
53 rcl_publisher_get_network_flow_endpoints(
55 rcutils_allocator_t * allocator,
56 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
64 rcl_ret_t rcl_ret = __validate_network_flow_endpoint_array(
65 network_flow_endpoint_array);
70 rmw_error_string_t error_string;
71 rmw_ret_t rmw_ret = rmw_publisher_get_network_flow_endpoints(
74 network_flow_endpoint_array);
75 if (rmw_ret != RMW_RET_OK) {
76 error_string = rmw_get_error_string();
78 RCL_SET_ERROR_MSG(error_string.str);
80 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
84 rcl_subscription_get_network_flow_endpoints(
86 rcutils_allocator_t * allocator,
87 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
95 rcl_ret_t rcl_ret = __validate_network_flow_endpoint_array(
96 network_flow_endpoint_array);
101 rmw_error_string_t error_string;
102 rmw_ret_t rmw_ret = rmw_subscription_get_network_flow_endpoints(
105 network_flow_endpoint_array);
106 if (rmw_ret != RMW_RET_OK) {
107 error_string = rmw_get_error_string();
109 RCL_SET_ERROR_MSG(error_string.str);
111 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.