ROS 2 rclcpp + rcl - jazzy
jazzy
ROS 2 C++ Client Library with ROS Client Library
|
Interface for introspecting a wait set after waiting on it. More...
#include <rclcpp/wait_result.hpp>
Public Member Functions | |
WaitResultKind | kind () const |
Return the kind of the WaitResult. | |
const WaitSetT & | get_wait_set () const |
Return the rcl wait set. More... | |
WaitSetT & | get_wait_set () |
Return the rcl wait set. More... | |
WaitResult (WaitResult &&other) noexcept | |
std::pair< std::shared_ptr< rclcpp::TimerBase >, size_t > | peek_next_ready_timer (size_t start_index=0) |
Get the next ready timer and its index in the wait result, but do not clear it. More... | |
void | clear_timer_with_index (size_t index) |
Clear the timer at the given index. More... | |
std::shared_ptr< rclcpp::SubscriptionBase > | next_ready_subscription () |
Get the next ready subscription, clearing it from the wait result. | |
std::shared_ptr< rclcpp::ServiceBase > | next_ready_service () |
Get the next ready service, clearing it from the wait result. | |
std::shared_ptr< rclcpp::ClientBase > | next_ready_client () |
Get the next ready client, clearing it from the wait result. | |
std::shared_ptr< rclcpp::Waitable > | next_ready_waitable () |
Get the next ready waitable, clearing it from the wait result. | |
Static Public Member Functions | |
static WaitResult | from_ready_wait_result_kind (WaitSetT &wait_set) |
Create WaitResult from a "ready" result. More... | |
static WaitResult | from_timeout_wait_result_kind () |
Create WaitResult from a "timeout" result. | |
static WaitResult | from_empty_wait_result_kind () |
Create WaitResult from a "empty" result. | |
Interface for introspecting a wait set after waiting on it.
This class:
This class is only valid as long as the wait set which created it is valid, and it must be deleted before the wait set is deleted, as it contains a back reference to the wait set.
An instance of this, which is returned from rclcpp::WaitSetTemplate::wait(), will cause the wait set to keep ownership of the entities because it only holds a reference to the sequences of them, rather than taking a copy. Also, in the thread-safe case, an instance of this will cause the wait set, to block calls which modify the sequences of the entities, e.g. add/remove guard condition or subscription methods.
WaitSetT | The wait set type which created this class. |
Definition at line 62 of file wait_result.hpp.
|
inline |
Clear the timer at the given index.
Clearing a timer from the wait result prevents it from being returned by the peek_next_ready_timer() on subsequent calls.
The index should come from the peek_next_ready_timer() function, and should only be used with this function if the timer pointer was valid.
std::out_of_range | if the given index is out of range |
Definition at line 199 of file wait_result.hpp.
References rclcpp::WaitResult< WaitSetT >::get_wait_set().
Referenced by rclcpp::executors::StaticSingleThreadedExecutor::execute_ready_executables().
|
inlinestatic |
Create WaitResult from a "ready" result.
[in] | wait_set | A reference to the wait set, which this class will keep for the duration of its lifetime. |
Definition at line 73 of file wait_result.hpp.
|
inline |
Return the rcl wait set.
std::runtime_error | if the class cannot access wait set when the result was not ready |
Definition at line 123 of file wait_result.hpp.
References rclcpp::WaitResult< WaitSetT >::kind().
|
inline |
Return the rcl wait set.
std::runtime_error | if the class cannot access wait set when the result was not ready |
Definition at line 107 of file wait_result.hpp.
References rclcpp::WaitResult< WaitSetT >::kind().
Referenced by rclcpp::WaitResult< WaitSetT >::clear_timer_with_index(), rclcpp::WaitResult< WaitSetT >::next_ready_client(), rclcpp::WaitResult< WaitSetT >::next_ready_service(), rclcpp::WaitResult< WaitSetT >::next_ready_subscription(), rclcpp::WaitResult< WaitSetT >::next_ready_waitable(), and rclcpp::WaitResult< WaitSetT >::peek_next_ready_timer().
|
inline |
Get the next ready timer and its index in the wait result, but do not clear it.
The returned timer is not cleared automatically, as it the case with the other next_ready_*()-like functions. Instead, this function returns the timer and the index that identifies it in the wait result, so that it can be cleared (marked as taken or used) in a separate step with clear_timer_with_index(). This is necessary in some multi-threaded executor implementations.
If the timer is not cleared using the index, subsequent calls to this function will return the same timer.
If there is no ready timer, then nullptr will be returned and the index will be invalid and should not be used.
[in] | start_index | index at which to start searching for the next ready timer in the wait result. If the start_index is out of bounds for the list of timers in the wait result, then {nullptr, start_index} will be returned. Defaults to 0. |
Definition at line 168 of file wait_result.hpp.
References rclcpp::WaitResult< WaitSetT >::get_wait_set(), and rclcpp::WaitResult< WaitSetT >::kind().
Referenced by rclcpp::executors::StaticSingleThreadedExecutor::execute_ready_executables().