ROS 2 rclcpp + rcl - rolling  rolling-a919a6e5
ROS 2 C++ Client Library with ROS Client Library
events_queue.hpp
1 // Copyright 2023 iRobot Corporation.
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__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__EVENTS_QUEUE_HPP_
16 #define RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__EVENTS_QUEUE_HPP_
17 
18 #include <queue>
19 
20 #include "rclcpp/macros.hpp"
21 #include "rclcpp/visibility_control.hpp"
22 
23 #include "rclcpp/experimental/executors/events_executor/events_executor_event_types.hpp"
24 
25 namespace rclcpp
26 {
27 namespace experimental
28 {
29 namespace executors
30 {
31 
43 {
44 public:
45  RCLCPP_SMART_PTR_ALIASES_ONLY(EventsQueue)
46 
47  RCLCPP_PUBLIC
48  EventsQueue() = default;
49 
53  RCLCPP_PUBLIC
54  virtual ~EventsQueue() = default;
55 
60  RCLCPP_PUBLIC
61  virtual
62  void
64 
70  RCLCPP_PUBLIC
71  virtual
72  bool
75  std::chrono::nanoseconds timeout = std::chrono::nanoseconds::max()) = 0;
76 
81  RCLCPP_PUBLIC
82  virtual
83  bool
84  empty() const = 0;
85 
90  RCLCPP_PUBLIC
91  virtual
92  size_t
93  size() const = 0;
94 };
95 
96 } // namespace executors
97 } // namespace experimental
98 } // namespace rclcpp
99 
100 #endif // RCLCPP__EXPERIMENTAL__EXECUTORS__EVENTS_EXECUTOR__EVENTS_QUEUE_HPP_
This abstract class can be used to implement different types of queues where ExecutorEvent can be sto...
virtual RCLCPP_PUBLIC bool dequeue(rclcpp::experimental::executors::ExecutorEvent &event, std::chrono::nanoseconds timeout=std::chrono::nanoseconds::max())=0
Extracts an event from the queue, eventually waiting until timeout if none is available.
virtual RCLCPP_PUBLIC size_t size() const =0
Returns the number of elements in the queue.
virtual RCLCPP_PUBLIC ~EventsQueue()=default
Destruct the object.
virtual RCLCPP_PUBLIC bool empty() const =0
Test whether queue is empty.
virtual RCLCPP_PUBLIC void enqueue(const rclcpp::experimental::executors::ExecutorEvent &event)=0
push event into the queue
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.