OnixS C++ FIX Engine  4.12.0
API Documentation
Promise< T > Class Template Reference

#include <OnixS/FIXEngine/Threading/Future.h>

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 ( )
inline

Definition at line 383 of file Future.h.

Promise ( const Promise< T > &  other)
inline

The copy constructor.

Definition at line 387 of file Future.h.

Member Function Documentation

SharedFuture<T> getFuture ( ) const
inline

Definition at line 416 of file Future.h.

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

The copy assignment.

Definition at line 391 of file Future.h.

void set ( const T &  value)
inline

Sets the successful result value to the given shared state.

Definition at line 422 of file Future.h.

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.

void swap ( Promise< T > &  other)
inline

Swaps two Promise objects.

Definition at line 411 of file Future.h.


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