OnixS C++ FIX Engine 4.14.0
Users' manual and API documentation
Loading...
Searching...
No Matches
Promise< T > Class Template Reference

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

Public Member Functions

 Promise () noexcept
 Promise (const Promise< T > &other) noexcept
Promise< T > & operator= (const Promise< T > &other) noexcept
 Promise (Promise< T > &&other) noexcept
Promise & operator= (Promise< T > &&other) noexcept
void swap (Promise< T > &other) noexcept
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 () noexcept
ONIXS_FIXENGINE_API PromiseBase (const PromiseBase &other) noexcept
ONIXS_FIXENGINE_API PromiseBase & operator= (const PromiseBase &other) noexcept
ONIXS_FIXENGINE_API PromiseBase (PromiseBase &&other) noexcept
ONIXS_FIXENGINE_API PromiseBase & operator= (PromiseBase &&other) noexcept
ONIXS_FIXENGINE_API ~PromiseBase () noexcept
ONIXS_FIXENGINE_API void swap (PromiseBase &other) noexcept
ONIXS_FIXENGINE_API void setValue (ValueBase *value)
ONIXS_FIXENGINE_API void setVoid ()
ONIXS_FIXENGINE_API SharedFuture< FutureValue > getFutureImpl () const
template<typename T>
SharedFuture< T > getTypedFuture () const

Detailed Description

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

Provides a facility to store a value or an exception that can be acquired asynchronously via a SharedFuture object created by the Promise object. 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 361 of file Future.h.

Constructor & Destructor Documentation

◆ Promise() [1/3]

template<typename T>
Promise ( )
inlinenoexcept

Definition at line 365 of file Future.h.

◆ Promise() [2/3]

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

The copy constructor.

Definition at line 369 of file Future.h.

◆ Promise() [3/3]

template<typename T>
Promise ( Promise< T > && other)
inlinenoexcept

Definition at line 379 of file Future.h.

Member Function Documentation

◆ getFuture()

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

Definition at line 394 of file Future.h.

◆ operator=() [1/2]

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

The copy assignment.

Definition at line 373 of file Future.h.

◆ operator=() [2/2]

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

Definition at line 382 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 400 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 409 of file Future.h.

◆ swap()

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

Swaps two Promise objects.

Definition at line 389 of file Future.h.