nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
rclcpp::Context Class Reference

#include <rclcpp.hpp>

Public Types

using SharedPtr = Context

Public Member Functions

Result add_on_shutdown_callback (ShutdownCallback callback, void *context, OnShutdownCallbackHandle *out=nullptr)
Result add_pre_shutdown_callback (ShutdownCallback callback, void *context, PreShutdownCallbackHandle *out=nullptr)
 The C-callback forms, on every target. See rclcpp::pre_shutdown.
 Context ()
 Context (void *executor)
void * executor_handle () const
 The executor handle this context names; null for an empty one.
bool is_valid () const
 Context::is_valid() — named, and not yet shut down.
Context * operator-> ()
const Context * operator-> () const
bool remove_on_shutdown_callback (const OnShutdownCallbackHandle &handle)
bool remove_pre_shutdown_callback (const PreShutdownCallbackHandle &handle)
 true when handle named a live callback.

Detailed Description

rclcpp::Context (phase-488) — a VIEW of one executor's lifetime: its pre- and on-shutdown hooks (issue 0790) and whether it is still running.

Upstream's context owns the rcl init state and is reached through a shared_ptr. nano-ros's executor owns that state, so this names one by its handle: SharedPtr is the view itself and -> reaches it, so rclcpp::Context::SharedPtr c = node->get_node_base_interface()->get_context(); c->add_pre_shutdown_callback(cb) spells as upstream's does. The hooks share the executor's fixed table (NROS_EXECUTOR_MAX_SHUTDOWN_CBS, default 2): a full table returns an INVALID handle on the std surface, where upstream would allocate.

Member Typedef Documentation

◆ SharedPtr

Constructor & Destructor Documentation

◆ Context() [1/2]

rclcpp::Context::Context ( )
inline

◆ Context() [2/2]

rclcpp::Context::Context ( void * executor)
inlineexplicit

Member Function Documentation

◆ add_on_shutdown_callback()

Result rclcpp::Context::add_on_shutdown_callback ( ShutdownCallback callback,
void * context,
OnShutdownCallbackHandle * out = nullptr )
inline

◆ add_pre_shutdown_callback()

Result rclcpp::Context::add_pre_shutdown_callback ( ShutdownCallback callback,
void * context,
PreShutdownCallbackHandle * out = nullptr )
inline

The C-callback forms, on every target. See rclcpp::pre_shutdown.

◆ executor_handle()

void * rclcpp::Context::executor_handle ( ) const
inline

The executor handle this context names; null for an empty one.

◆ is_valid()

bool rclcpp::Context::is_valid ( ) const
inline

Context::is_valid() — named, and not yet shut down.

◆ operator->() [1/2]

Context * rclcpp::Context::operator-> ( )
inline

◆ operator->() [2/2]

const Context * rclcpp::Context::operator-> ( ) const
inline

◆ remove_on_shutdown_callback()

bool rclcpp::Context::remove_on_shutdown_callback ( const OnShutdownCallbackHandle & handle)
inline

◆ remove_pre_shutdown_callback()

bool rclcpp::Context::remove_pre_shutdown_callback ( const PreShutdownCallbackHandle & handle)
inline

true when handle named a live callback.


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