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

Stores the result of an asynchronous operation. More...

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

Public Member Functions

 promise ()
 Constructs a promise. More...
 
bool valid ()
 Returns true if this promise is valid. More...
 
future< T > get_future ()
 Returns a future associated with this promise. More...
 
void set_value (T &&value)
 Sets the result of this promise to value. More...
 
void set_exception (std::exception_ptr pException)
 Sets the result of this promise to pException. 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
 
std::unique_ptr< std::atomic_flag > m_pIsFutureCreated
 

Detailed Description

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

Stores the result of an asynchronous operation.

Constructor & Destructor Documentation

◆ promise()

template<typename T>
catapult::thread::promise< T >::promise ( )
inline

Constructs a promise.

Member Function Documentation

◆ get_future()

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

Returns a future associated with this promise.

◆ set_exception()

template<typename T>
void catapult::thread::promise< T >::set_exception ( std::exception_ptr  pException)
inline

Sets the result of this promise to pException.

Here is the caller graph for this function:

◆ set_value()

template<typename T>
void catapult::thread::promise< T >::set_value ( T &&  value)
inline

Sets the result of this promise to value.

Here is the caller graph for this function:

◆ valid()

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

Returns true if this promise is valid.

Member Data Documentation

◆ m_pIsFutureCreated

template<typename T>
std::unique_ptr<std::atomic_flag> catapult::thread::promise< T >::m_pIsFutureCreated
private

◆ m_pState

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

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