Template Class WaitResult

Class Documentation

template<class WaitSetT>
class WaitResult

Interface for introspecting a wait set after waiting on it.

This class:

  • provides the result of waiting, i.e. ready, timeout, or empty, and

  • holds the ownership of the entities of the wait set, if needed, and

  • provides the necessary information for iterating over the wait set.

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.

Template Parameters:

WaitSetT – The wait set type which created this class.

Public Functions

inline WaitResultKind kind() const

Return the kind of the WaitResult.

inline const WaitSetT &get_wait_set() const

Return the rcl wait set.

Throws:

std::runtime_error – if the class cannot access wait set when the result was not ready

Returns:

const rcl wait set.

inline WaitSetT &get_wait_set()

Return the rcl wait set.

Throws:

std::runtime_error – if the class cannot access wait set when the result was not ready

Returns:

rcl wait set.

inline WaitResult(WaitResult &&other) noexcept
inline ~WaitResult()

Public Static Functions

static inline WaitResult from_ready_wait_result_kind(WaitSetT &wait_set)

Create WaitResult from a “ready” result.

Parameters:

wait_set[in] A reference to the wait set, which this class will keep for the duration of its lifetime.

Returns:

a WaitResult from a “ready” result.

static inline WaitResult from_timeout_wait_result_kind()

Create WaitResult from a “timeout” result.

static inline WaitResult from_empty_wait_result_kind()

Create WaitResult from a “empty” result.