rmw  master
C API providing a middleware abstraction layer which is used to implement the rest of ROS.
Macros | Typedefs
serialized_message.h File Reference
#include "rcutils/types/uint8_array.h"
Include dependency graph for serialized_message.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define rmw_get_zero_initialized_serialized_message   rcutils_get_zero_initialized_uint8_array
 Return a zero initialized serialized message struct. More...
 
#define rmw_serialized_message_init(serialized_message, message_capacity, allocator)   rcutils_uint8_array_init(serialized_message, message_capacity, allocator)
 Initialize a serialized message, zero initializing its contents. More...
 
#define rmw_serialized_message_fini(serialized_message)   rcutils_uint8_array_fini(serialized_message)
 Finalize a serialized message. More...
 
#define rmw_serialized_message_resize(serialized_message, new_size)   rcutils_uint8_array_resize(serialized_message, new_size)
 Resize the internal buffer of the serialized message. More...
 

Typedefs

typedef rcutils_uint8_array_t rmw_serialized_message_t
 

Macro Definition Documentation

◆ rmw_get_zero_initialized_serialized_message

#define rmw_get_zero_initialized_serialized_message   rcutils_get_zero_initialized_uint8_array

Return a zero initialized serialized message struct.

◆ rmw_serialized_message_init

#define rmw_serialized_message_init (   serialized_message,
  message_capacity,
  allocator 
)    rcutils_uint8_array_init(serialized_message, message_capacity, allocator)

Initialize a serialized message, zero initializing its contents.

Precondition
Given serialized message must have been zero initialized.
Parameters
[in,out]serialized_messagea pointer to the serialized message to initialize
[in]message_capacitythe size of the memory to allocate
[in]allocatorthe allocator to use for the memory allocation
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if any arguments are invalid, or
'RMW_RET_BAD_ALLOCif no memory could be allocated correctly, or \returnRMW_RET_ERROR` if an unexpected error occurs

◆ rmw_serialized_message_fini

#define rmw_serialized_message_fini (   serialized_message)    rcutils_uint8_array_fini(serialized_message)

Finalize a serialized message.

Precondition
Given serialized message must have been initialized with rmw_serialized_message_init().
Remarks
If serialized message is zero initialized, then RMW_RET_INVALID_ARGUMENT is returned.
Parameters
[in]serialized_messagepointer to the serialized message to be cleaned up
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if serialized_message is invalid, or
RMW_RET_ERROR if an unexpected error occurs

◆ rmw_serialized_message_resize

#define rmw_serialized_message_resize (   serialized_message,
  new_size 
)    rcutils_uint8_array_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.

Precondition
Given serialized message must have been initialized with rmw_serialized_message_init().
Remarks
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
[in,out]serialized_messagepointer to the serialized message to be resized
[in]new_sizethe new size of the internal buffer
Returns
RMW_RET_OK if successful, or
RMW_RET_INVALID_ARGUMENT if serialized_message is invalid or new_size is set to zero, or
RMW_RET_BAD_ALLOC if memory allocation failed, or
RMW_RET_ERROR if an unexpected error occurs

Typedef Documentation

◆ rmw_serialized_message_t