rclcpp  beta1
C++ ROS Client Library API
single_threaded_executor.hpp
Go to the documentation of this file.
1 // Copyright 2014 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__EXECUTORS__SINGLE_THREADED_EXECUTOR_HPP_
16 #define RCLCPP__EXECUTORS__SINGLE_THREADED_EXECUTOR_HPP_
17 
18 #include <rmw/rmw.h>
19 
20 #include <cassert>
21 #include <cstdlib>
22 #include <memory>
23 #include <vector>
24 
25 #include "rclcpp/executor.hpp"
26 #include "rclcpp/macros.hpp"
28 #include "rclcpp/node.hpp"
29 #include "rclcpp/utilities.hpp"
30 #include "rclcpp/rate.hpp"
32 
33 namespace rclcpp
34 {
35 namespace executors
36 {
37 namespace single_threaded_executor
38 {
39 
41 // This is the default executor created by rclcpp::spin.
43 {
44 public:
46 
47 
50  const executor::ExecutorArgs & args = rclcpp::executor::create_default_executor_arguments());
51 
54  virtual ~SingleThreadedExecutor();
55 
57  // This function will block until work comes in, execute it, and keep blocking.
58  // It will only be interrupt by a CTRL-C (managed by the global signal handler).
60  void
61  spin();
62 
63 private:
64  RCLCPP_DISABLE_COPY(SingleThreadedExecutor)
65 };
66 
67 } // namespace single_threaded_executor
68 } // namespace executors
69 } // namespace rclcpp
70 
71 #endif // RCLCPP__EXECUTORS__SINGLE_THREADED_EXECUTOR_HPP_
Definition: executor.hpp:69
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
Definition: allocator_common.hpp:24
Single-threaded executor implementation.
Definition: single_threaded_executor.hpp:42
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
Coordinate the order and timing of available communication tasks.
Definition: executor.hpp:93
SingleThreadedExecutor(const executor::ExecutorArgs &args=rclcpp::executor::create_default_executor_arguments())
Default constructor. See the default constructor for Executor.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
void spin()
Single-threaded implementation of spin.