rclcpp  master
C++ ROS Client Library API
waitable.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__WAITABLE_HPP_
16 #define RCLCPP__WAITABLE_HPP_
17 
18 #include "rclcpp/macros.hpp"
20 
21 #include "rcl/wait.h"
22 
23 namespace rclcpp
24 {
25 
26 class Waitable
27 {
28 public:
30 
31 
32 
38  virtual
39  size_t
41 
43 
49  virtual
50  size_t
52 
54 
60  virtual
61  size_t
63 
65 
71  virtual
72  size_t
74 
76 
82  virtual
83  size_t
85 
86  // TODO(jacobperron): smart pointer?
88 
93  virtual
94  bool
95  add_to_wait_set(rcl_wait_set_t * wait_set) = 0;
96 
98 
108  virtual
109  bool
110  is_ready(rcl_wait_set_t *) = 0;
111 
113 
134  virtual
135  void
136  execute() = 0;
137 }; // class Waitable
138 
139 } // namespace rclcpp
140 
141 #endif // RCLCPP__WAITABLE_HPP_
virtual size_t get_number_of_ready_timers()
Get the number of ready timers.
Definition: allocator_common.hpp:24
virtual size_t get_number_of_ready_guard_conditions()
Get the number of ready guard_conditions.
virtual size_t get_number_of_ready_subscriptions()
Get the number of ready subscriptions.
virtual size_t get_number_of_ready_clients()
Get the number of ready clients.
virtual bool is_ready(rcl_wait_set_t *)=0
Check if the Waitable is ready.
virtual bool add_to_wait_set(rcl_wait_set_t *wait_set)=0
Add the Waitable to a wait set.
virtual void execute()=0
Execute any entities of the Waitable that are ready.
#define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(...)
Definition: macros.hpp:51
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Definition: waitable.hpp:26
virtual size_t get_number_of_ready_services()
Get the number of ready services.