Define rmw_serialized_message_resize

Define Documentation

rmw_serialized_message_resize(serialized_message, new_size)

Resize the internal buffer of the serialized message.

The internal buffer of the serialized message can be resized dynamically if needed. If the new size is smaller than the current capacity, then the memory is truncated.

Remark

If serialized message is zero initialized, then RMW_RET_INVALID_ARGUMENT is returned.

Warning

Be aware that this might deallocate the memory and therefore invalidate any pointers to the internal buffer.

Parameters:
  • serialized_message[inout] pointer to the serialized message to be resized

  • new_size[in] the new size of the internal buffer

Pre:

Given serialized message must have been initialized with rmw_serialized_message_init().

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if serialized_message is invalid or new_size is set to zero, or

Returns:

RMW_RET_BAD_ALLOC if memory allocation failed, or

Returns:

RMW_RET_ERROR if an unexpected error occurs