CatapultServer  v0.5.0.1 (Elephant)
catapult::thread::future< T > Class Template Reference

Provides a way to access the result of an asynchronous operation. More...

Inheritance diagram for catapult::thread::future< T >:
Collaboration diagram for catapult::thread::future< T >:

Public Member Functions

 future ()=default
 Creates a default future. More...
 
 future (const std::shared_ptr< detail::shared_state< T >> &pState)
 Constructs a future around a shared state (pState). More...
 
bool valid ()
 Returns true if this future is valid. More...
 
bool is_ready () const
 Returns true if this future has completed and get will not block. More...
 
get ()
 Returns the result of this future and blocks until the result is available. More...
 
template<typename TContinuation , typename TResultType = std::invoke_result_t<TContinuation, future<T>&&>>
auto then (TContinuation continuation)
 Configures continuation to run at the completion of this future. More...
 
- Public Member Functions inherited from catapult::utils::MoveOnly
constexpr MoveOnly ()=default
 Default constructor. More...
 
 ~MoveOnly ()=default
 Default destructor. More...
 
 MoveOnly (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
 MoveOnly (MoveOnly &&)=default
 Default move constructor. More...
 
MoveOnlyoperator= (const MoveOnly &)=delete
 Disabled assignment operator. More...
 
MoveOnlyoperator= (MoveOnly &&)=default
 Default move assignment operator. More...
 

Private Attributes

std::shared_ptr< detail::shared_state< T > > m_pState
 

Detailed Description

template<typename T>
class catapult::thread::future< T >

Provides a way to access the result of an asynchronous operation.

Constructor & Destructor Documentation

◆ future() [1/2]

template<typename T>
catapult::thread::future< T >::future ( )
default

Creates a default future.

◆ future() [2/2]

template<typename T>
catapult::thread::future< T >::future ( const std::shared_ptr< detail::shared_state< T >> &  pState)
inlineexplicit

Constructs a future around a shared state (pState).

Member Function Documentation

◆ get()

template<typename T>
T catapult::thread::future< T >::get ( )
inline

Returns the result of this future and blocks until the result is available.

Here is the caller graph for this function:

◆ is_ready()

template<typename T>
bool catapult::thread::future< T >::is_ready ( ) const
inline

Returns true if this future has completed and get will not block.

◆ then()

template<typename T>
template<typename TContinuation , typename TResultType = std::invoke_result_t<TContinuation, future<T>&&>>
auto catapult::thread::future< T >::then ( TContinuation  continuation)
inline

Configures continuation to run at the completion of this future.

Here is the caller graph for this function:

◆ valid()

template<typename T>
bool catapult::thread::future< T >::valid ( )
inline

Returns true if this future is valid.

Member Data Documentation

◆ m_pState

template<typename T>
std::shared_ptr<detail::shared_state<T> > catapult::thread::future< T >::m_pState
private

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