Go to the source code of this file.
◆ rcutils_uint8_array_t
◆ rcutils_get_zero_initialized_uint8_array()
Return a zero initialized uint8 array struct.
- Returns
- rcutils_uint8_array_t a zero initialized uint8 array struct
◆ rcutils_uint8_array_init()
Initialize a zero initialized uint8 array struct.
This function may leak if the uint8 array struct is already initialized. If the capacity is set to 0, no memory is allocated and the internal buffer is still NULL.
- Parameters
-
uint8_array | a pointer to the to be initialized uint8 array struct |
buffer_capacity | the size of the memory to allocate for the byte stream |
allocator | the allocator to use for the memory allocation |
- Returns
RCUTILS_RET_OK
if successful, or
-
RCUTILS_RET_INVALID_ARGUMENTS
if any arguments are invalid, or
-
'RCUTILS_RET_BAD_ALLOC
if no memory could be allocated correctly \return
RCUTILS_RET_ERROR` if an unexpected error occurs
◆ rcutils_uint8_array_fini()
Finalize a uint8 array struct.
Cleans up and deallocates any resources used in a rcutils_uint8_array_t. The array passed to this function needs to have been initialized by rcutils_uint8_array_init(). Passing an uninitialized instance to this function leads to undefined behavior.
- Parameters
-
- Returns
RCUTILS_RET_OK
if successful, or
-
RCUTILS_RET_INVALID_ARGUMENTS
if the uint8_array argument is invalid
-
RCUTILS_RET_ERROR
if an unexpected error occurs
◆ rcutils_uint8_array_resize()
Resize the internal buffer of the uint8 array.
The internal buffer of the uint8 array can be resized dynamically if needed. If the new size is smaller than the current capacity, then the memory is truncated. Be aware, that this might deallocate the memory and therefore invalidates any pointers to this storage.
- Parameters
-
uint8_array | pointer to the instance of rcutils_uint8_array_t which is being resized |
new_size | the new size of the internal buffer |
- Returns
RCUTILS_RET_OK
if successful, or
-
RCUTILS_RET_INVALID_ARGUMENT
if new_size is set to zero
-
RCUTILS_RET_BAD_ALLOC
if memory allocation failed, or
-
RCUTILS_RET_ERROR
if an unexpected error occurs