|
nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
|
#include <future.hpp>
Public Member Functions | |
| void | cancel () |
| Cancel the pending operation (idempotent). | |
| Future () | |
| Default constructor – creates an empty/consumed future. | |
| Future (Future &&other) noexcept | |
| bool | is_consumed () const |
| Check if the future has been consumed or cancelled. | |
| bool | is_ready () |
| Check if the result has arrived (non-blocking). | |
| Future & | operator= (Future &&other) noexcept |
| Result | try_take (T &out) |
| Result | wait (void *executor_handle, uint32_t timeout_ms, T &out, uint32_t poll_ms=10) |
| ~Future () | |
Friends | |
| template<typename A > | |
| class | ActionClient |
| template<typename S > | |
| class | Client |
Single-shot deferred result for request/response operations.
Returned by Client<S>::send_request. The future is consumed when the result is taken – move-only, single-shot.
Usage:
|
inline |
|
inline |
Default constructor – creates an empty/consumed future.
|
inline |
Cancel the pending operation (idempotent).
|
inline |
Check if the future has been consumed or cancelled.
|
inline |
Check if the result has arrived (non-blocking).
|
inlinenoexcept |
Take the result if ready, consuming the future.
| out | Output object (filled on success). |
|
inline |
Block until the result arrives, spinning the executor.
| executor_handle | Raw executor handle (Executor::handle() or global). |
| timeout_ms | Maximum wait time in milliseconds. |
| out | Output object (filled on success). |
| poll_ms | Per-iteration spin_once timeout in ms (default 10). Smaller values give lower latency when the reply arrives mid-step but wake the executor more often; larger values reduce wakeups for long waits. |