Go to the source code of this file.
◆ rcutils_uint8_array_t
The structure holding the metadata for a uint8 array.
◆ 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
-
[in,out] | uint8_array | a pointer to the to be initialized uint8 array struct |
[in] | buffer_capacity | the size of the memory to allocate for the byte stream |
[in] | allocator | the allocator to use for the memory allocation |
- Returns
- RCUTILS_RET_OK if successful, or
-
RCUTILS_RET_INVALID_ARGUMENT if any arguments are invalid, or
-
'RCUTILS_RET_BAD_ALLOC` if no memory could be allocated correctly
-
RCUTILS_RET_ERROR if an unexpected error occurs.
◆ rcutils_uint8_array_fini()
◆ 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
-
[in,out] | uint8_array | pointer to the instance of rcutils_uint8_array_t which is being resized |
[in] | 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.