libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::async::AsyncAlgorithm< T > Class Template Reference

Minimal coroutine wrapper that stores the last yielded value and supports manual stepping. More...

#include <algorithm.hpp>

Classes

struct  promise_type
 Coroutine promise storing the most recent yielded or returned value. More...

Public Types

using handle_type = std::coroutine_handle<promise_type>

Public Member Functions

 AsyncAlgorithm (handle_type h)
 AsyncAlgorithm (const AsyncAlgorithm &)=delete
 AsyncAlgorithm (AsyncAlgorithm &&other) noexcept
 ~AsyncAlgorithm ()
bool advance ()
 Resume the coroutine once. Returns false when the coroutine is finished.
T current () const
 Return the last yielded or returned value from the coroutine.
bool await_ready () const noexcept
 Awaiter API: reports ready only once the wrapped coroutine is done.
void await_suspend (std::coroutine_handle<> awaiting_coro) noexcept
 Awaiter API: resume the wrapped coroutine, then resume the awaiting coroutine.
T await_resume () noexcept
 Awaiter API: return the current value after suspension completes.

Detailed Description

template<typename T>
class libstp::async::AsyncAlgorithm< T >

Minimal coroutine wrapper that stores the last yielded value and supports manual stepping.

Definition at line 9 of file algorithm.hpp.

Member Typedef Documentation

◆ handle_type

template<typename T>
using libstp::async::AsyncAlgorithm< T >::handle_type = std::coroutine_handle<promise_type>

Definition at line 32 of file algorithm.hpp.

Constructor & Destructor Documentation

◆ AsyncAlgorithm() [1/3]

template<typename T>
libstp::async::AsyncAlgorithm< T >::AsyncAlgorithm ( handle_type h)
explicit

◆ AsyncAlgorithm() [2/3]

template<typename T>
libstp::async::AsyncAlgorithm< T >::AsyncAlgorithm ( const AsyncAlgorithm< T > & )
delete

◆ AsyncAlgorithm() [3/3]

template<typename T>
libstp::async::AsyncAlgorithm< T >::AsyncAlgorithm ( AsyncAlgorithm< T > && other)
noexcept

◆ ~AsyncAlgorithm()

template<typename T>
libstp::async::AsyncAlgorithm< T >::~AsyncAlgorithm ( )

Member Function Documentation

◆ advance()

template<typename T>
bool libstp::async::AsyncAlgorithm< T >::advance ( )

Resume the coroutine once. Returns false when the coroutine is finished.

◆ await_ready()

template<typename T>
bool libstp::async::AsyncAlgorithm< T >::await_ready ( ) const
nodiscardnoexcept

Awaiter API: reports ready only once the wrapped coroutine is done.

◆ await_resume()

template<typename T>
T libstp::async::AsyncAlgorithm< T >::await_resume ( )
noexcept

Awaiter API: return the current value after suspension completes.

◆ await_suspend()

template<typename T>
void libstp::async::AsyncAlgorithm< T >::await_suspend ( std::coroutine_handle<> awaiting_coro)
noexcept

Awaiter API: resume the wrapped coroutine, then resume the awaiting coroutine.

◆ current()

template<typename T>
T libstp::async::AsyncAlgorithm< T >::current ( ) const

Return the last yielded or returned value from the coroutine.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-async/include/async/algorithm.hpp