OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
Promise< T > Class Template Reference

Public Member Functions

 Promise () ONIXS_FIXENGINE_NOTHROW
 Promise (const Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
Promise< T > & operator= (const Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
void swap (Promise< T > &other) ONIXS_FIXENGINE_NOTHROW
SharedFuture< T > getFuture () const
void set (const T &value)
template<typename ExceptionType>
void setException (const ExceptionType &exception)
Public Member Functions inherited from PromiseBase
bool valid ()
ONIXS_FIXENGINE_API void setExceptionImpl ()

Additional Inherited Members

Protected Member Functions inherited from PromiseBase
ONIXS_FIXENGINE_API PromiseBase () ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API PromiseBase (const PromiseBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API PromiseBaseoperator= (const PromiseBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API ~PromiseBase () ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API void swap (PromiseBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API void setValue (ValueBase *value)
ONIXS_FIXENGINE_API void setVoid ()
ONIXS_FIXENGINE_API SharedFuture< FutureValuegetFutureImpl () const
template<typename T>
SharedFuture< T > getTypedFuture () const

Detailed Description

template<typename T>
class OnixS::Threading::Promise< T >

Each Promise object is associated with a shared state, which contains a some state information and a result which may be not yet evaluated, evaluated to a value or evaluated to an exception. The promise stores the result or the exception in the shared state. Marks the state ready and unblocks any thread waiting on a future associated with the shared state.

Definition at line 379 of file Future.h.

Constructor & Destructor Documentation

◆ Promise() [1/2]

template<typename T>
Promise ( )
inline

Definition at line 383 of file Future.h.

◆ Promise() [2/2]

template<typename T>
Promise ( const Promise< T > & other)
inline

The copy constructor.

Definition at line 387 of file Future.h.

Member Function Documentation

◆ getFuture()

template<typename T>
SharedFuture< T > getFuture ( ) const
inline

Definition at line 416 of file Future.h.

◆ operator=()

template<typename T>
Promise< T > & operator= ( const Promise< T > & other)
inline

The copy assignment.

Definition at line 391 of file Future.h.

◆ set()

template<typename T>
void set ( const T & value)
inline

Sets the successful result value to the given shared state.

Definition at line 422 of file Future.h.

◆ setException()

template<typename T>
template<typename ExceptionType>
void setException ( const ExceptionType & exception)
inline

Sets the result to indicate an exception.

Note
Does nothing if the shared state already stores a value or exception.

Definition at line 431 of file Future.h.

◆ swap()

template<typename T>
void swap ( Promise< T > & other)
inline

Swaps two Promise objects.

Definition at line 411 of file Future.h.