20 #include "rcl/error_handling.h"
22 #include "rcl/network_flow_endpoints.h"
26 #include "rcutils/allocator.h"
27 #include "rcutils/macros.h"
28 #include "rcutils/types.h"
30 #include "rmw/error_handling.h"
31 #include "rmw/get_network_flow_endpoints.h"
32 #include "rmw/network_flow_endpoint_array.h"
33 #include "rmw/types.h"
38 __validate_network_flow_endpoint_array(
39 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
43 rmw_error_string_t error_string;
44 rmw_ret_t rmw_ret = rmw_network_flow_endpoint_array_check_zero(network_flow_endpoint_array);
45 if (rmw_ret != RMW_RET_OK) {
46 error_string = rmw_get_error_string();
48 RCL_SET_ERROR_MSG_WITH_FORMAT_STRING(
49 "rcl_network_flow_endpoint_array_t must be zero initialized: %s,\n"
50 "Use rcl_get_zero_initialized_network_flow_endpoint_array",
54 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
58 rcl_publisher_get_network_flow_endpoints(
60 rcutils_allocator_t * allocator,
61 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
69 rcl_ret_t rcl_ret = __validate_network_flow_endpoint_array(
70 network_flow_endpoint_array);
75 rmw_error_string_t error_string;
76 rmw_ret_t rmw_ret = rmw_publisher_get_network_flow_endpoints(
79 network_flow_endpoint_array);
80 if (rmw_ret != RMW_RET_OK) {
81 error_string = rmw_get_error_string();
83 RCL_SET_ERROR_MSG(error_string.str);
85 return rcl_convert_rmw_ret_to_rcl_ret(rmw_ret);
89 rcl_subscription_get_network_flow_endpoints(
91 rcutils_allocator_t * allocator,
92 rcl_network_flow_endpoint_array_t * network_flow_endpoint_array)
100 rcl_ret_t rcl_ret = __validate_network_flow_endpoint_array(
101 network_flow_endpoint_array);
106 rmw_error_string_t error_string;
107 rmw_ret_t rmw_ret = rmw_subscription_get_network_flow_endpoints(
110 network_flow_endpoint_array);
111 if (rmw_ret != RMW_RET_OK) {
112 error_string = rmw_get_error_string();
114 RCL_SET_ERROR_MSG(error_string.str);
116 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.