Class EventsQueue

Inheritance Relationships

Derived Type

Class Documentation

class EventsQueue

This abstract class can be used to implement different types of queues where ExecutorEvent can be stored. The derived classes should choose which underlying container to use and the strategy for pushing and popping events. For example a queue implementation may be bounded or unbounded and have different pruning strategies. Implementations may or may not check the validity of events and decide how to handle the situation where an event is not valid anymore (e.g. a subscription history cache overruns)

Subclassed by rclcpp::experimental::executors::SimpleEventsQueue

Public Functions

EventsQueue() = default
virtual ~EventsQueue() = default

Destruct the object.

virtual void enqueue(const rclcpp::experimental::executors::ExecutorEvent &event) = 0

push event into the queue

Parameters:

event – The event to push into the queue

virtual 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.

Returns:

true if event has been found, false if timeout

virtual bool empty() const = 0

Test whether queue is empty.

Returns:

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

virtual size_t size() const = 0

Returns the number of elements in the queue.

Returns:

the number of elements in the queue.