Skip to content

Commit 48df81b

Browse files
authored
Dynamic Subscription (BONUS: Allocators): rmw (#353)
* Refactor serialization support to use allocators and refs Signed-off-by: methylDragon <[email protected]> * Use rmw_serialization_support_init Signed-off-by: methylDragon <[email protected]> --------- Signed-off-by: methylDragon <[email protected]>
1 parent 91b1dc7 commit 48df81b

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

rmw/include/rmw/dynamic_message_type_support.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ extern "C"
2020
{
2121
#endif
2222

23+
#include <rcutils/allocator.h>
24+
2325
#include <rosidl_dynamic_typesupport/api/serialization_support.h>
2426
#include <rosidl_dynamic_typesupport/dynamic_message_type_support_struct.h>
2527
#include <rosidl_dynamic_typesupport/identifier.h>
@@ -57,9 +59,10 @@ rmw_take_dynamic_message_with_info(
5759
RMW_PUBLIC
5860
RMW_WARN_UNUSED
5961
rmw_ret_t
60-
rmw_get_serialization_support(
62+
rmw_serialization_support_init(
6163
const char * serialization_lib_name,
62-
rosidl_dynamic_typesupport_serialization_support_t ** serialization_support); // OUT
64+
rcutils_allocator_t * allocator,
65+
rosidl_dynamic_typesupport_serialization_support_t * serialization_support); // OUT
6366

6467
// TODO(methylDragon): Nice to have only
6568
// RMW_PUBLIC

rmw/include/rmw/error_handling.h

+23
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,29 @@ typedef rcutils_error_state_t rmw_error_state_t;
175175
/// Reset the error state by clearing any previously set error state.
176176
#define rmw_reset_error rcutils_reset_error
177177

178+
/// Set the error message using RCUTILS_SET_ERROR_MSG and append the previous error.
179+
/**
180+
* If there is no previous error, has same behavior as RCUTILS_SET_ERROR_MSG.
181+
* \param[in] msg The error message to be set.
182+
*/
183+
#define RMW_SET_ERROR_MSG_AND_APPEND_PREV_ERROR(msg) \
184+
RCUTILS_SET_ERROR_MSG_AND_APPEND_PREV_ERROR(msg)
185+
186+
/// Set the error message with RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING and append the previous
187+
/// error.
188+
/**
189+
* This function sets the error message using the given format string, and appends and resets the
190+
* latest error string.
191+
* The resulting formatted string is silently truncated at RCUTILS_ERROR_MESSAGE_MAX_LENGTH.
192+
*
193+
* If there is no previous error, has same behavior as RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING.
194+
*
195+
* \param[in] format_string The string to be used as the format of the error message.
196+
* \param[in] ... Arguments for the format string.
197+
*/
198+
#define RMW_SET_ERROR_MSG_WITH_FORMAT_STRING_AND_APPEND_PREV_ERROR(format_string, ...) \
199+
RCUTILS_SET_ERROR_MSG_WITH_FORMAT_STRING_AND_APPEND_PREV_ERROR(format_string, __VA_ARGS__)
200+
178201
#ifdef __cplusplus
179202
}
180203
#endif

0 commit comments

Comments
 (0)