nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
rclcpp::TimerHandle Class Reference

#include <timer.hpp>

Inheritance diagram for rclcpp::TimerHandle:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::TimerHandle:
Collaboration graph
[legend]

Public Types

using element_type = ::rclcpp::Timer
 

Public Member Functions

constexpr size_t handle_id () const
 The packed executor handle this refers to. For introspection and tests.
 
constexpr operator bool () const
 
TimerOps * operator-> ()
 timer_->cancel() and friends.
 
const TimerOps * operator-> () const
 Const overload of operator->.
 
void reset ()
 
constexpr TimerHandle ()
 
constexpr TimerHandle (decltype(nullptr))
 
constexpr TimerHandle (void *executor, size_t handle_id)
 

Friends

constexpr bool operator!= (const TimerHandle &a, const TimerHandle &b)
 
constexpr bool operator!= (const TimerHandle &a, decltype(nullptr))
 
constexpr bool operator!= (decltype(nullptr), const TimerHandle &a)
 
constexpr bool operator== (const TimerHandle &a, const TimerHandle &b)
 
constexpr bool operator== (const TimerHandle &a, decltype(nullptr))
 
constexpr bool operator== (decltype(nullptr), const TimerHandle &a)
 

Detailed Description

The handle create_wall_timer / rclcpp::create_timer return, and what Timer::SharedPtr names — phase-476 W2.

Two words, trivially copyable, no allocation, and present on every target: the timer's callable lives in the executor arena (phase-476 W2), so there is nothing on the C++ side for a std::shared_ptr to own. That is what freed timer.hpp from <memory> and <functional>.

timer_->cancel(), timer_->reset(), timer_->is_ready() and timer_->time_until_trigger() keep their rclcpp spelling through operator->, which reaches a [TimerOps].

WHAT DIFFERS FROM A shared_ptr, stated because a ported file cannot see it:

Member Typedef Documentation

◆ element_type

What this handle refers to, for generic code that spells a pointee type the way std::shared_ptr exposes one. A NAME only: operator-> reaches a [TimerOps], not a Timer object.

Constructor & Destructor Documentation

◆ TimerHandle() [1/3]

constexpr rclcpp::TimerHandle::TimerHandle ( )
inlineconstexpr

◆ TimerHandle() [2/3]

constexpr rclcpp::TimerHandle::TimerHandle ( decltype(nullptr)  )
inlineconstexpr

Null, spelled the way a ported file spells it (Timer::SharedPtr timer_ = nullptr;).

◆ TimerHandle() [3/3]

constexpr rclcpp::TimerHandle::TimerHandle ( void *  executor,
size_t  handle_id 
)
inlineconstexpr

Member Function Documentation

◆ handle_id()

constexpr size_t rclcpp::TimerHandle::handle_id ( ) const
inlineconstexpr

The packed executor handle this refers to. For introspection and tests.

◆ operator bool()

constexpr rclcpp::TimerHandle::operator bool ( ) const
inlineexplicitconstexpr

if (timer_). A default-constructed or reset() handle is empty; one from a successful registration is not (even once released elsewhere — the operations are what report that).

◆ operator->() [1/2]

TimerOps * rclcpp::TimerHandle::operator-> ( )
inline

timer_->cancel() and friends.

◆ operator->() [2/2]

const TimerOps * rclcpp::TimerHandle::operator-> ( ) const
inline

Const overload of operator->.

◆ reset()

void rclcpp::TimerHandle::reset ( )
inline

timer_.reset() — release the timer: it stops for good, its arena entry and captured callable are freed, and this handle becomes empty. Other copies become stale and fail safely. A no-op on an empty handle.

Friends And Related Symbol Documentation

◆ operator!= [1/3]

◆ operator!= [2/3]

◆ operator!= [3/3]

◆ operator== [1/3]

constexpr bool operator== ( const TimerHandle &  a,
const TimerHandle &  b 
)
friend

◆ operator== [2/3]

◆ operator== [3/3]


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