ROS 2 rclcpp + rcl - rolling  rolling-20536064
ROS 2 C++ Client Library with ROS Client Library
Classes | Public Member Functions | List of all members
rclcpp::executors::cbg_executor::TimerQueue Class Reference

A class for managing a queue of timers. More...

#include </home/runner/work/api.nav2.org/api.nav2.org/work/rclcpp-rolling/rclcpp/src/rclcpp/executors/events_cbg_executor/timer_manager.hpp>

Public Member Functions

 TimerQueue (rcl_clock_type_t timer_type, const rclcpp::Context::SharedPtr &context)
 
void stop ()
 
void remove_timer (const rclcpp::TimerBase::SharedPtr &timer)
 Removes a new timer from the queue. This function is thread safe. More...
 
void add_timer (const rclcpp::TimerBase::SharedPtr &timer, const std::function< void(const std::function< void()> executed_cb)> &timer_ready_callback)
 Adds a new timer to the queue. This function is thread safe. More...
 

Detailed Description

A class for managing a queue of timers.

This class holds a queue of timers of one type (RCL_ROS_TIME, RCL_SYSTEM_TIME or RCL_STEADY_TIME). The queue itself manages an internal map of the timers, orders by the next time a timer will be ready. Each time a timer is ready, a callback will be called from the internal thread.

Definition at line 121 of file timer_manager.hpp.

Member Function Documentation

◆ add_timer()

void rclcpp::executors::cbg_executor::TimerQueue::add_timer ( const rclcpp::TimerBase::SharedPtr &  timer,
const std::function< void(const std::function< void()> executed_cb)> &  timer_ready_callback 
)
inline

Adds a new timer to the queue. This function is thread safe.

This function will ignore any timer, that has not a matching type

Parameters
timerthe timer to add.
timer_ready_callbackcallback that should be called when the timer is ready.

Definition at line 234 of file timer_manager.hpp.

References RCL_RET_OK, and rcl_timer_clock().

Here is the call graph for this function:

◆ remove_timer()

void rclcpp::executors::cbg_executor::TimerQueue::remove_timer ( const rclcpp::TimerBase::SharedPtr &  timer)
inline

Removes a new timer from the queue. This function is thread safe.

Removes a timer, if it was added to this queue. Ignores timers that are not part of this queue

Parameters
timerthe timer to remove.

Definition at line 177 of file timer_manager.hpp.

References RCL_RET_OK, and rcl_timer_clock().

Here is the call graph for this function:

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