Function rmw_topic_endpoint_info_array_init_with_size
Defined in File topic_endpoint_info_array.h
Function Documentation
-
rmw_ret_t rmw_topic_endpoint_info_array_init_with_size(rmw_topic_endpoint_info_array_t *topic_endpoint_info_array, size_t size, rcutils_allocator_t *allocator)
Initialize an array of topic endpoint information.
This function allocates space to hold
size
topic endpoint information elements. Bothinfo_array
andsize
members are updated accordingly.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 the array of topic endpoint information is not synchronized. It is not safe to read or write
topic_endpoint_info_array
during initialization.The default allocators are thread-safe objects, but any custom
allocator
may not be. Check your allocator documentation for further reference.
- Parameters:
topic_endpoint_info_array – [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
iftopic_endpoint_info_array
is NULL, or- Returns:
RMW_RET_INVALID_ARGUMENT
iftopic_endpoint_info_array
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.