RADLib
RADical C++ application framework
RADCore::RADFutureT< T > Class Template Reference

Typed shared future with optional continuation support. More...

#include <RADCore.h>

Public Member Functions

 RADFutureT ()=default
 Creates an invalid future. More...
 
 RADFutureT (std::shared_ptr< std::shared_future< T >> future)
 Wraps an existing shared future. More...
 
bool isValid () const
 Returns true when a future is present. More...
 
bool isFinished () const
 Returns true when the result is ready. More...
 
void wait () const
 Blocks until the result is ready. More...
 
result () const
 Returns the result, rethrowing any task exception. More...
 
resultOr (T defaultValue) const
 Returns result or defaultValue if not ready or failed. More...
 
template<typename F >
void then (EventLoop &loop, F &&continuation) const
 Posts continuation to loop after this future completes. More...
 

Detailed Description

template<typename T>
class RADCore::RADFutureT< T >

Typed shared future with optional continuation support.

Constructor & Destructor Documentation

◆ RADFutureT() [1/2]

template<typename T >
RADCore::RADFutureT< T >::RADFutureT ( )
default

Creates an invalid future.

◆ RADFutureT() [2/2]

template<typename T >
RADCore::RADFutureT< T >::RADFutureT ( std::shared_ptr< std::shared_future< T >>  future)
inlineexplicit

Wraps an existing shared future.

Member Function Documentation

◆ isFinished()

template<typename T >
bool RADCore::RADFutureT< T >::isFinished ( ) const
inline

Returns true when the result is ready.

◆ isValid()

template<typename T >
bool RADCore::RADFutureT< T >::isValid ( ) const
inline

Returns true when a future is present.

◆ result()

template<typename T >
T RADCore::RADFutureT< T >::result ( ) const
inline

Returns the result, rethrowing any task exception.

◆ resultOr()

template<typename T >
T RADCore::RADFutureT< T >::resultOr ( defaultValue) const
inline

Returns result or defaultValue if not ready or failed.

◆ then()

template<typename T >
template<typename F >
void RADCore::RADFutureT< T >::then ( EventLoop loop,
F &&  continuation 
) const
inline

Posts continuation to loop after this future completes.

◆ wait()

template<typename T >
void RADCore::RADFutureT< T >::wait ( ) const
inline

Blocks until the result is ready.


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