Function rosidl_runtime_c__String__init

Function Documentation

bool rosidl_runtime_c__String__init(rosidl_runtime_c__String *str)

Initialize a rosidl_runtime_c__String structure.

The contents of rosidl_runtime_c__String are initialized to a single null character (‘\0’). The string initially has size 0 and capacity 1. Size represents the size of the contents of the string, while capacity represents the overall storage of the string (counting the null terminator). All strings must be null-terminated. The rosidl_runtime_c__String structure should be deallocated using the given function rosidl_runtime_c__String__fini() when it is no longer needed. Calling this function with an already initialized U16 string sequence structure will leak memory.

Parameters:

str[inout] a pointer to a rosidl_runtime_c__String structure

Returns:

true if successful, false if the passed string pointer is null or the memory allocation failed