Function rmw_discovery_options_init

Function Documentation

rmw_ret_t rmw_discovery_options_init(rmw_discovery_options_t *discovery_options, size_t size, rcutils_allocator_t *allocator)

Initialize a discovery options structure with a set number of static peers.

This function initializes rmw_discovery_options_t with space for a set number of static peers.

Remark

This function sets the RMW error state on failure.

Parameters:
  • discovery_options[in] Pointer to a zero initialized option structure to be initialized on success, but left unchanged on failure.

  • size[in] Number of static peers to allocate space for.

  • allocator[in] Allocator to be used to allocate memory.

Returns:

RMW_RET_OK if successful, or

Returns:

RMW_RET_INVALID_ARGUMENT if discovery_options is NULL, or

Returns:

RMW_RET_INVALID_ARGUMENT if discovery_options is not zero initialized, or

Returns:

RMW_RET_INVALID_ARGUMENT if allocator 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.