File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,11 @@ class Context : public std::enable_shared_from_this<Context>
139139 rclcpp::InitOptions
140140 get_init_options ();
141141
142+ // / Return actual domain id.
143+ RCLCPP_PUBLIC
144+ size_t
145+ get_domain_id () const ;
146+
142147 // / Return the shutdown reason, or empty string if not shutdown.
143148 /* *
144149 * This function is thread-safe.
Original file line number Diff line number Diff line change @@ -275,6 +275,17 @@ Context::get_init_options()
275275 return init_options_;
276276}
277277
278+ size_t
279+ Context::get_domain_id () const
280+ {
281+ size_t domain_id;
282+ rcl_ret_t ret = rcl_context_get_domain_id (rcl_context_.get (), &domain_id);
283+ if (RCL_RET_OK != ret) {
284+ rclcpp::exceptions::throw_from_rcl_error (ret, " failed to get domain id from context" );
285+ }
286+ return domain_id;
287+ }
288+
278289std::string
279290Context::shutdown_reason ()
280291{
You can’t perform that action at this time.
0 commit comments