Function rmw_topic_endpoint_info_set_topic_type
Defined in File topic_endpoint_info.h
Function Documentation
-
rmw_ret_t rmw_topic_endpoint_info_set_topic_type(rmw_topic_endpoint_info_t *topic_endpoint_info, const char *topic_type, rcutils_allocator_t *allocator)
Set the topic type in the given topic endpoint info data structure.
Allocates memory and copies the value of the
topic_typeargument to set the data structure’stopic_typemember.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
Setting a member is a reentrant procedure, but:
Access to the topic endpoint info data structure is not synchronized. It is not safe to read or write the
topic_typemember of the giventopic_endpointwhile setting it.Access to C-style string arguments is read-only but it is not synchronized. Concurrent
topic_typereads are safe, but concurrent reads and writes are not.The default allocators are thread-safe objects, but any custom
allocatormay not be. Check your allocator documentation for further reference.
- Parameters:
topic_endpoint_info – [inout] Data structure to be populated.
topic_type – [in] Type name to be set.
allocator – [in] Allocator to be used.
- Pre:
Given
topic_typeis a valid C-style string i.e. NULL terminated.- Returns:
RMW_RET_OKif successful, or- Returns:
RMW_RET_INVALID_ARGUMENTiftopic_endpoint_infois NULL, or- Returns:
RMW_RET_INVALID_ARGUMENTiftopic_typeis NULL, or- Returns:
RMW_RET_BAD_ALLOCif memory allocation fails, or- Returns:
RMW_RET_ERRORwhen an unspecified error occurs.