ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
Public Member Functions | List of all members
rclcpp::experimental::executors::SimpleEventsQueue Class Reference

This class implements an EventsQueue as a simple wrapper around a std::queue. It does not perform any checks about the size of queue, which can grow unbounded without being pruned. The simplicity of this implementation makes it suitable for optimizing CPU usage. More...

#include <rclcpp/experimental/executors/events_executor/simple_events_queue.hpp>

Inheritance diagram for rclcpp::experimental::executors::SimpleEventsQueue:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::experimental::executors::SimpleEventsQueue:
Collaboration graph
[legend]

Public Member Functions

RCLCPP_PUBLIC void enqueue (const rclcpp::experimental::executors::ExecutorEvent &event) override
 enqueue event into the queue Thread safe More...
 
RCLCPP_PUBLIC bool dequeue (rclcpp::experimental::executors::ExecutorEvent &event, std::chrono::nanoseconds timeout=std::chrono::nanoseconds::max()) override
 waits for an event until timeout, gets a single event Thread safe More...
 
RCLCPP_PUBLIC bool empty () const override
 Test whether queue is empty Thread safe. More...
 
RCLCPP_PUBLIC size_t size () const override
 Returns the number of elements in the queue. Thread safe. More...
 
- Public Member Functions inherited from rclcpp::experimental::executors::EventsQueue
virtual RCLCPP_PUBLIC ~EventsQueue ()=default
 Destruct the object.
 

Detailed Description

This class implements an EventsQueue as a simple wrapper around a std::queue. It does not perform any checks about the size of queue, which can grow unbounded without being pruned. The simplicity of this implementation makes it suitable for optimizing CPU usage.

Definition at line 38 of file simple_events_queue.hpp.

Member Function Documentation

◆ dequeue()

RCLCPP_PUBLIC bool rclcpp::experimental::executors::SimpleEventsQueue::dequeue ( rclcpp::experimental::executors::ExecutorEvent event,
std::chrono::nanoseconds  timeout = std::chrono::nanoseconds::max() 
)
inlineoverridevirtual

waits for an event until timeout, gets a single event Thread safe

Returns
true if event, false if timeout

Implements rclcpp::experimental::executors::EventsQueue.

Definition at line 71 of file simple_events_queue.hpp.

◆ empty()

RCLCPP_PUBLIC bool rclcpp::experimental::executors::SimpleEventsQueue::empty ( ) const
inlineoverridevirtual

Test whether queue is empty Thread safe.

Returns
true if the queue's size is 0, false otherwise.

Implements rclcpp::experimental::executors::EventsQueue.

Definition at line 102 of file simple_events_queue.hpp.

◆ enqueue()

RCLCPP_PUBLIC void rclcpp::experimental::executors::SimpleEventsQueue::enqueue ( const rclcpp::experimental::executors::ExecutorEvent event)
inlineoverridevirtual

enqueue event into the queue Thread safe

Parameters
eventThe event to enqueue into the queue

Implements rclcpp::experimental::executors::EventsQueue.

Definition at line 51 of file simple_events_queue.hpp.

◆ size()

RCLCPP_PUBLIC size_t rclcpp::experimental::executors::SimpleEventsQueue::size ( ) const
inlineoverridevirtual

Returns the number of elements in the queue. Thread safe.

Returns
the number of elements in the queue.

Implements rclcpp::experimental::executors::EventsQueue.

Definition at line 115 of file simple_events_queue.hpp.


The documentation for this class was generated from the following file: