Function rmw_names_and_types_init
Defined in File names_and_types.h
Function Documentation
-
rmw_ret_t rmw_names_and_types_init(rmw_names_and_types_t *names_and_types, size_t size, rcutils_allocator_t *allocator)
Initialize an array of names and types.
This function initializes the string array for the names and allocates space for all the string arrays for the types according to the given size, but it does not initialize the string array for each setup of types. However, the string arrays for each set of types is zero initialized.
Attribute
Adherence
Allocates Memory
Yes
Thread-Safe
No
Uses Atomics
No
Lock-Free
Yes
Remark
This function sets the RMW error state on failure.
- Thread-safety
Initialization is a reentrant procedure, but:
Access to arrays of names and types is not synchronized. It is not safe to read or write
names_and_types
during initialization.The default allocators are thread-safe objects, but any custom
allocator
may not be. Check your allocator documentation for further reference.
- Parameters:
names_and_types – [inout] Array to be initialized on success, but left unchanged on failure.
size – [in] Size of the array.
allocator – [in] Allocator to be used to populate
names_and_types
.
- Returns:
RMW_RET_OK
if successful, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifnames_and_types
is NULL, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifnames_and_types
is not a zero initialized array, or- Returns:
RMW_RET_INVALID_ARGUMENT
ifallocator
is invalid, by rcutils_allocator_is_valid() definition, or- Returns:
RMW_BAD_ALLOC
if memory allocation fails, or- Returns:
RMW_RET_ERROR
when an unspecified error occurs.