Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions rcl/include/rcl/init_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,50 @@ RCL_WARN_UNUSED
rcl_ret_t
rcl_init_options_fini(rcl_init_options_t * init_options);

/// Return domain_id which is stored in rmw_init_options.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
/**
* Get the domain id from specifid rcl_init_options_t object.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
*
* <hr>
* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | No
* Thread-Safe | Yes
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] init_options rcl_init_options_t object to get domain id.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
* \param[inout] domain_id domain id to be copied from rcl_init_options_t object.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
* \return `RCL_RET_OK` if successful, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid.
*/
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_init_options_get_domain_id(rcl_init_options_t * init_options, size_t * domain_id);

/// Set domain_id to rmw_init_options.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
/**
* Store the domain id to specified rcl_init_options_t object.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
*
* <hr>
* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | No
* Thread-Safe | Yes
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] init_options rcl_init_options_t object to be set domain id.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
* \param[in] domain_id domain id to be set into rcl_init_options_t object.
Comment thread
fujitatomoya marked this conversation as resolved.
Outdated
* \return `RCL_RET_OK` if successful, or
* \return `RCL_RET_INVALID_ARGUMENT` if any arguments are invalid.
*/
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_init_options_set_domain_id(rcl_init_options_t * init_options, size_t domain_id);

/// Return the rmw init options which are stored internally.
/**
* This function can fail and return `NULL` if:
Expand Down
19 changes: 19 additions & 0 deletions rcl/src/rcl/init_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,25 @@ rcl_init_options_fini(rcl_init_options_t * init_options)
return RCL_RET_OK;
}

rcl_ret_t
rcl_init_options_get_domain_id(rcl_init_options_t * init_options, size_t * domain_id)
{
RCL_CHECK_ARGUMENT_FOR_NULL(init_options, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(init_options->impl, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(domain_id, RCL_RET_INVALID_ARGUMENT);
*domain_id = init_options->impl->rmw_init_options.domain_id;
return RCL_RET_OK;
}

rcl_ret_t
rcl_init_options_set_domain_id(rcl_init_options_t * init_options, size_t domain_id)
{
RCL_CHECK_ARGUMENT_FOR_NULL(init_options, RCL_RET_INVALID_ARGUMENT);
RCL_CHECK_ARGUMENT_FOR_NULL(init_options->impl, RCL_RET_INVALID_ARGUMENT);
init_options->impl->rmw_init_options.domain_id = domain_id;
return RCL_RET_OK;
}

rmw_init_options_t *
rcl_init_options_get_rmw_init_options(rcl_init_options_t * init_options)
{
Expand Down