ROS 2 rclcpp + rcl - humble  humble
ROS 2 C++ Client Library with ROS Client Library
common.c
1 // Copyright 2015 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifdef __cplusplus
16 extern "C"
17 {
18 #endif
19 
20 #include "./common.h" // NOLINT
21 
22 #include <stdlib.h>
23 
24 #include "rcl/allocator.h"
25 #include "rcl/error_handling.h"
26 
28 rcl_convert_rmw_ret_to_rcl_ret(rmw_ret_t rmw_ret)
29 {
30  switch (rmw_ret) {
31  case RMW_RET_OK:
32  return RCL_RET_OK;
33  case RMW_RET_INVALID_ARGUMENT:
35  case RMW_RET_BAD_ALLOC:
36  return RCL_RET_BAD_ALLOC;
37  case RMW_RET_UNSUPPORTED:
38  return RCL_RET_UNSUPPORTED;
39  case RMW_RET_NODE_NAME_NON_EXISTENT:
41  default:
42  return RCL_RET_ERROR;
43  }
44 }
45 
46 #ifdef __cplusplus
47 }
48 #endif
#define RCL_RET_UNSUPPORTED
Unsupported return code.
Definition: types.h:36
#define RCL_RET_NODE_NAME_NON_EXISTENT
Failed to find node name.
Definition: types.h:62
#define RCL_RET_OK
Success return code.
Definition: types.h:26
#define RCL_RET_BAD_ALLOC
Failed to allocate memory return code.
Definition: types.h:32
#define RCL_RET_INVALID_ARGUMENT
Invalid argument return code.
Definition: types.h:34
#define RCL_RET_ERROR
Unspecified error return code.
Definition: types.h:28
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.
Definition: types.h:23