rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
error_handling.h
Go to the documentation of this file.
1 // Copyright 2014 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 #ifndef RMW__ERROR_HANDLING_H_
16 #define RMW__ERROR_HANDLING_H_
17 
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include <stdbool.h>
24 #include <stddef.h>
25 
26 #include <rcutils/error_handling.h>
27 
28 #include "rmw/visibility_control.h"
29 
31 
32 #define rmw_error_state_copy rcutils_error_state_copy
33 
34 #define rmw_error_state_fini rcutils_error_state_fini
35 
36 // TODO(wjwwood): replace this completely with rcutils_set_error_state()
37 // once the rmw APIs take an allocator that can be passed
38 // by the rmw implementations on to the error functions
40 
45 void
46 rmw_set_error_state(const char * error_msg, const char * file, size_t line_number);
47 
49 
52 #define RMW_SET_ERROR_MSG(msg) rmw_set_error_state(msg, __FILE__, __LINE__);
53 
54 #define RMW_SET_ERROR_MSG_ALLOC(msg, allocator) \
55  rcutils_set_error_state(msg, __FILE__, __LINE__, allocator);
56 
57 #define rmw_error_is_set rcutils_error_is_set
58 
59 #define rmw_get_error_state rcutils_get_error_state
60 
61 #define rmw_get_error_string rcutils_get_error_string
62 
63 #define rmw_get_error_string_safe rcutils_get_error_string_safe
64 
65 #define rmw_reset_error rcutils_reset_error
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif // RMW__ERROR_HANDLING_H_
#define RMW_PUBLIC
Definition: visibility_control.h:48
rcutils_error_state_t rmw_error_state_t
Definition: error_handling.h:30
void rmw_set_error_state(const char *error_msg, const char *file, size_t line_number)
Set the error state, implicitly uses rcutils_get_default_allocator().