rclcpp  master
C++ ROS Client Library API
init_options.hpp
Go to the documentation of this file.
1 // Copyright 2018 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCLCPP__INIT_OPTIONS_HPP_
16 #define RCLCPP__INIT_OPTIONS_HPP_
17 
18 #include <memory>
19 #include <mutex>
20 
21 #include "rcl/init_options.h"
23 
24 namespace rclcpp
25 {
26 
29 {
30 public:
32  bool shutdown_on_sigint = true;
33 
35 
42 
44 
50  explicit InitOptions(const rcl_init_options_t & init_options);
51 
54  InitOptions(const InitOptions & other);
55 
58  bool
60 
63  InitOptions &
64  auto_initialize_logging(bool initialize_logging);
65 
68  InitOptions &
69  operator=(const InitOptions & other);
70 
72  virtual
73  ~InitOptions();
74 
76 
81  const rcl_init_options_t *
82  get_rcl_init_options() const;
83 
86  void
88 
91  void
92  set_domain_id(size_t domain_id);
93 
96  size_t
97  get_domain_id() const;
98 
99 protected:
100  void
102 
103 private:
104  void
105  finalize_init_options_impl();
106 
107  mutable std::mutex init_options_mutex_;
109  bool initialize_logging_{true};
110 };
111 
112 } // namespace rclcpp
113 
114 #endif // RCLCPP__INIT_OPTIONS_HPP_
rcl_get_default_allocator
#define rcl_get_default_allocator
rclcpp::InitOptions::use_default_domain_id
void use_default_domain_id()
Retrieve default domain id and set.
rclcpp::InitOptions::~InitOptions
virtual ~InitOptions()
rclcpp::InitOptions::operator=
InitOptions & operator=(const InitOptions &other)
Assignment operator.
rclcpp::InitOptions::InitOptions
InitOptions(rcl_allocator_t allocator=rcl_get_default_allocator())
Constructor.
rclcpp
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
rclcpp::InitOptions::get_rcl_init_options
const rcl_init_options_t * get_rcl_init_options() const
Return the rcl init options.
RCLCPP_PUBLIC
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
rcl_init_options_t
rclcpp::InitOptions::shutdown_on_sigint
bool shutdown_on_sigint
If true, the context will be shutdown on SIGINT by the signal handler (if it was installed).
Definition: init_options.hpp:32
rclcpp::InitOptions::auto_initialize_logging
bool auto_initialize_logging() const
Return true if logging should be initialized when rclcpp::Context::init is called.
init_options.h
rclcpp::InitOptions::finalize_init_options
void finalize_init_options()
rclcpp::InitOptions
Encapsulation of options for initializing rclcpp.
Definition: init_options.hpp:28
rcutils_allocator_t
visibility_control.hpp
std::mutex
rclcpp::InitOptions::get_domain_id
size_t get_domain_id() const
Return domain id.
std::unique_ptr< rcl_init_options_t >
rclcpp::InitOptions::set_domain_id
void set_domain_id(size_t domain_id)
Set the domain id.