Function rmw_service_endpoint_info_set_service_type

Function Documentation

rmw_ret_t rmw_service_endpoint_info_set_service_type(rmw_service_endpoint_info_t *service_endpoint_info, const char *service_type, rcutils_allocator_t *allocator)

Set the service type in the given service endpoint info data structure.

Allocates memory and copies the value of the service_type argument to set the data structure’s service_type member.

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 service endpoint info data structure is not synchronized. It is not safe to read or write the service_type member of the given service_endpoint while setting it.

  • Access to C-style string arguments is read-only but it is not synchronized. Concurrent service_type reads are safe, but concurrent reads and writes are not.

  • The default allocators are thread-safe objects, but any custom allocator may not be. Check your allocator documentation for further reference.

Parameters:
  • service_endpoint_info[inout] Data structure to be populated.

  • service_type[in] Type name to be set.

  • allocator[in] Allocator to be used.

Pre:

Given service_type is a valid C-style string i.e. NULL terminated.

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if service_endpoint_info is NULL, or

Returns:

RMW_RET_INVALID_ARGUMENT if service_type is NULL, or

Returns:

RMW_RET_INVALID_ARGUMENT if allocator is NULL, or

Returns:

RMW_RET_BAD_ALLOC if memory allocation fails, or

Returns:

RMW_RET_ERROR when an unspecified error occurs.