OnixS C++ FIX Engine  4.2.0
API Documentation
Promise Class Reference

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

Public Member Functions

 Promise ()
 Promise (const Promise &other)
 ~Promise ()
SharedFuture getFuture () const
void set ()
template<typename ValueType >
void set (const ValueType &value)
template<typename ExceptionType >
void setException (const ExceptionType &exception)

Detailed Description

Each Promise object is associated with a shared state, which contains 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 171 of file Future.h.

Constructor & Destructor Documentation

Promise ( )

Initializes the instance.

Promise ( const Promise other)

Copy constructor.

Share the internal state with other Promise object.

~Promise ( )

Cleans up internal resources.

Member Function Documentation

SharedFuture getFuture ( ) const

Returns a SharedFuture object associated with this Promise object.

void set ( )

Sets the successful result to the given shared state.

void set ( const ValueType &  value)

Sets the successful result value to the given shared state.

The stored value type ('ValueType') should correspond to the requested, by the SharedFuture::getValue(), value type.

Definition at line 195 of file Future.h.

void setException ( const ExceptionType &  exception)

Sets the result to indicate an exception.

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

Definition at line 204 of file Future.h.

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