15 #include "rclcpp/init_options.hpp"
17 #include "rclcpp/exceptions.hpp"
18 #include "rclcpp/logging.hpp"
29 rclcpp::exceptions::throw_from_rcl_error(ret,
"failed to initialize rcl init options");
39 rclcpp::exceptions::throw_from_rcl_error(ret,
"failed to copy rcl init options");
47 initialize_logging_ = other.initialize_logging_;
53 return initialize_logging_;
59 initialize_logging_ = initialize_logging;
67 std::lock_guard<std::mutex> init_options_lock(init_options_mutex_);
68 this->finalize_init_options_impl();
71 rclcpp::exceptions::throw_from_rcl_error(ret,
"failed to copy rcl init options");
74 this->initialize_logging_ = other.initialize_logging_;
79 InitOptions::~InitOptions()
81 this->finalize_init_options();
85 InitOptions::finalize_init_options()
87 std::lock_guard<std::mutex> init_options_lock(init_options_mutex_);
88 this->finalize_init_options_impl();
92 InitOptions::finalize_init_options_impl()
99 "failed to finalize rcl init options: %s", rcl_get_error_string().str);
109 return init_options_.get();
118 rclcpp::exceptions::throw_from_rcl_error(ret,
"failed to get default domain id");
126 std::lock_guard<std::mutex> init_options_lock(init_options_mutex_);
129 rclcpp::exceptions::throw_from_rcl_error(ret,
"failed to set domain id to rcl init options");
136 std::lock_guard<std::mutex> init_options_lock(init_options_mutex_);
140 rclcpp::exceptions::throw_from_rcl_error(ret,
"failed to get domain id from rcl init options");
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Encapsulation of options for initializing rclcpp.
RCLCPP_PUBLIC const rcl_init_options_t * get_rcl_init_options() const
Return the rcl init options.
RCLCPP_PUBLIC bool auto_initialize_logging() const
Return true if logging should be initialized when rclcpp::Context::init is called.
RCLCPP_PUBLIC InitOptions & operator=(const InitOptions &other)
Assignment operator.
RCLCPP_PUBLIC void use_default_domain_id()
Retrieve default domain id and set.
RCLCPP_PUBLIC size_t get_domain_id() const
Return domain id.
bool shutdown_on_signal
If true, the context will be shutdown on SIGINT by the signal handler (if it was installed).
RCLCPP_PUBLIC InitOptions(rcl_allocator_t allocator=rcl_get_default_allocator())
Constructor.
RCLCPP_PUBLIC void set_domain_id(size_t domain_id)
Set the domain id.
RCL_PUBLIC rcl_ret_t rcl_get_default_domain_id(size_t *domain_id)
Determine the default domain ID, based on the environment.
#define RCL_DEFAULT_DOMAIN_ID
The default domain ID used by RCL.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_init_options_init(rcl_init_options_t *init_options, rcl_allocator_t allocator)
Initialize given init_options with the default values and implementation specific values.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_init_options_set_domain_id(rcl_init_options_t *init_options, size_t domain_id)
Set a domain id in the init options provided.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_init_options_copy(const rcl_init_options_t *src, rcl_init_options_t *dst)
Copy the given source init_options to the destination init_options.
RCL_PUBLIC RCL_WARN_UNUSED rcl_init_options_t rcl_get_zero_initialized_init_options(void)
Return a zero initialized rcl_init_options_t struct.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_init_options_get_domain_id(const rcl_init_options_t *init_options, size_t *domain_id)
Return the domain_id stored in the init options.
RCL_PUBLIC RCL_WARN_UNUSED rcl_ret_t rcl_init_options_fini(rcl_init_options_t *init_options)
Finalize the given init_options.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
RCLCPP_PUBLIC Logger get_logger(const std::string &name)
Return a named logger.
Encapsulation of init options and implementation defined init options.
#define RCL_RET_OK
Success return code.
rmw_ret_t rcl_ret_t
The type that holds an rcl return code.