|
rmw
beta1
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
|
#include <stdbool.h>#include <stddef.h>#include "rmw/macros.h"#include "rmw/visibility_control.h"Go to the source code of this file.
Classes | |
| struct | rmw_error_state_t |
| Struct which encapsulates the error state set by RMW_SET_ERROR_MSG(). More... | |
Macros | |
| #define | RMW_SET_ERROR_MSG(msg) rmw_set_error_state(msg, __FILE__, __LINE__); |
| Set the error message, as well as append the current file and line number. More... | |
Typedefs | |
| typedef struct rmw_error_state_t | rmw_error_state_t |
| Struct which encapsulates the error state set by RMW_SET_ERROR_MSG(). More... | |
Functions | |
| void | rmw_set_error_state (const char *error_msg, const char *file, size_t line_number) |
| Set the error message, as well as the file and line on which it occurred. More... | |
| bool | rmw_error_is_set (void) |
Return true if the error is set, otherwise false. More... | |
| const rmw_error_state_t * | rmw_get_error_state (void) |
| Return an rmw_error_state_t which was set with rmw_set_error_state(). More... | |
| const char * | rmw_get_error_string (void) |
Return the error message followed by , at <file>:<line>, or NULL. More... | |
| const char * | rmw_get_error_string_safe (void) |
Return the error message followed by , at <file>:<line> if set, else "error not set". More... | |
| void | rmw_reset_error (void) |
| Resets the error state by clearing any previously set error state. More... | |
| #define RMW_SET_ERROR_MSG | ( | msg | ) | rmw_set_error_state(msg, __FILE__, __LINE__); |
Set the error message, as well as append the current file and line number.
If an error message was previously set, and rmw_reset_error() was not called afterwards, and this library was built with RMW_REPORT_ERROR_HANDLING_ERRORS turned on, then the previously set error message will be printed to stderr. Error state storage is thread local and so all error related functions are also thread local.
| msg | The error message to be set. |
| typedef struct rmw_error_state_t rmw_error_state_t |
Struct which encapsulates the error state set by RMW_SET_ERROR_MSG().
| void rmw_set_error_state | ( | const char * | error_msg, |
| const char * | file, | ||
| size_t | line_number | ||
| ) |
Set the error message, as well as the file and line on which it occurred.
This is not meant to be used directly, but instead via the RMW_SET_ERROR_MSG(msg) macro.
The error_msg parameter is copied into the internal error storage and must be null terminated. The file parameter is not copied, but instead is assumed to be a global as it should be set to the FILE preprocessor literal when used with the RMW_SET_ERROR_MSG() macro. It should also be null terminated.
| error_msg | The error message to set. |
| file | The path to the file in which the error occurred. |
| line_number | The line number on which the error occurred. |
| bool rmw_error_is_set | ( | void | ) |
Return true if the error is set, otherwise false.
| const rmw_error_state_t* rmw_get_error_state | ( | void | ) |
Return an rmw_error_state_t which was set with rmw_set_error_state().
The returned pointer will be NULL if no error has been set in this thread.
The returned pointer is valid until RMW_SET_ERROR_MSG, rmw_set_error_state, or rmw_reset_error are called in the same thread.
| const char* rmw_get_error_string | ( | void | ) |
Return the error message followed by , at <file>:<line>, or NULL.
The returned pointer is valid until RMW_SET_ERROR_MSG(), rmw_set_error_state(), or rmw_reset_error() are called from the same thread.
| const char* rmw_get_error_string_safe | ( | void | ) |
Return the error message followed by , at <file>:<line> if set, else "error not set".
This function is guaranteed to return a valid c-string.
The returned pointer is valid until RMW_SET_ERROR_MSG, rmw_set_error_state, or rmw_reset_error are called in the same thread.
| void rmw_reset_error | ( | void | ) |
Resets the error state by clearing any previously set error state.
1.8.12