Program Listing for File init_options.hpp

Return to documentation for file (include/rclcpp/init_options.hpp)

// Copyright 2018 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RCLCPP__INIT_OPTIONS_HPP_
#define RCLCPP__INIT_OPTIONS_HPP_

#include <memory>
#include <mutex>

#include "rcl/init_options.h"
#include "rclcpp/visibility_control.hpp"

namespace rclcpp
{

class InitOptions
{
public:
  bool shutdown_on_signal = true;


  RCLCPP_PUBLIC
  explicit InitOptions(rcl_allocator_t allocator = rcl_get_default_allocator());


  RCLCPP_PUBLIC
  explicit InitOptions(const rcl_init_options_t & init_options);

  RCLCPP_PUBLIC
  InitOptions(const InitOptions & other);

  RCLCPP_PUBLIC
  bool
  auto_initialize_logging() const;

  RCLCPP_PUBLIC
  InitOptions &
  auto_initialize_logging(bool initialize_logging);

  RCLCPP_PUBLIC
  InitOptions &
  operator=(const InitOptions & other);

  RCLCPP_PUBLIC
  virtual
  ~InitOptions();


  RCLCPP_PUBLIC
  const rcl_init_options_t *
  get_rcl_init_options() const;

  RCLCPP_PUBLIC
  void
  use_default_domain_id();

  RCLCPP_PUBLIC
  void
  set_domain_id(size_t domain_id);

  RCLCPP_PUBLIC
  size_t
  get_domain_id() const;

protected:
  void
  finalize_init_options();

private:
  void
  finalize_init_options_impl();

  mutable std::mutex init_options_mutex_;
  std::unique_ptr<rcl_init_options_t> init_options_;
  bool initialize_logging_{true};
};

}  // namespace rclcpp

#endif  // RCLCPP__INIT_OPTIONS_HPP_