OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
FutureBase Class Reference

Classes

struct  moving_init_t

Public Types

enum  

Public Member Functions

bool valid () const ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API bool isReady () const
ONIXS_FIXENGINE_API bool hasValue () const
ONIXS_FIXENGINE_API bool hasException () const
ONIXS_FIXENGINE_API FutureStatus::Enum wait (int timeoutInMs=InfiniteTimeout) const

Protected Member Functions

 FutureBase ()
ONIXS_FIXENGINE_API FutureBase (const FutureBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API FutureBaseoperator= (const FutureBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API FutureBase (const System::FutureSharedState *state) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API FutureBase (const System::FutureSharedState *state, moving_init_t) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API ~FutureBase () ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API void swap (FutureBase &other) ONIXS_FIXENGINE_NOTHROW
ONIXS_FIXENGINE_API const FutureValuegetValue () const
ONIXS_FIXENGINE_API void getVoid () const

Friends

class FutureHelper
class PromiseBase

Detailed Description

Definition at line 117 of file Future.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InfiniteTimeout -1 

Definition at line 162 of file Future.h.

Constructor & Destructor Documentation

◆ FutureBase() [1/4]

FutureBase ( )
inlineprotected

Definition at line 173 of file Future.h.

◆ FutureBase() [2/4]

ONIXS_FIXENGINE_API FutureBase ( const FutureBase & other)
protected

◆ FutureBase() [3/4]

ONIXS_FIXENGINE_API FutureBase ( const System::FutureSharedState * state)
protected

Initializes the instance with shared state.

◆ FutureBase() [4/4]

ONIXS_FIXENGINE_API FutureBase ( const System::FutureSharedState * state,
moving_init_t  )
protected

Initializes the instance with shared state.

◆ ~FutureBase()

Destroys a future object.

If this is the last reference to the asynchronous result associated with *this (if any), then destroy that asynchronous result.

Member Function Documentation

◆ getValue()

ONIXS_FIXENGINE_API const FutureValue & getValue ( ) const
protected

◆ getVoid()

ONIXS_FIXENGINE_API void getVoid ( ) const
protected

◆ hasException()

ONIXS_FIXENGINE_API bool hasException ( ) const

Returns true if the asynchronous result associated with this Future has a stored exception, false otherwise.

Exceptions
Thestd::logic_error if this instance does not refer to a shared state.

◆ hasValue()

ONIXS_FIXENGINE_API bool hasValue ( ) const

Returns true if the asynchronous result associated with this Future has a stored value, false otherwise.

Exceptions
Thestd::logic_error if this instance does not refer to a shared state.

◆ isReady()

ONIXS_FIXENGINE_API bool isReady ( ) const

Returns true if the asynchronous result associated with this Future is ready (has a value or an exception stored in the shared state), false otherwise.

There are often situations where a get() call on a Future may not be a blocking call, or is only a blocking call under certain circumstances. This method gives the ability to test for early completion and allows us to avoid associating a continuation, which needs to be scheduled with some non-trivial overhead and near-certain loss of the cache efficiency.

Exceptions
Thestd::logic_error if this instance does not refer to a shared state.

◆ operator=()

ONIXS_FIXENGINE_API FutureBase & operator= ( const FutureBase & other)
protected

◆ swap()

ONIXS_FIXENGINE_API void swap ( FutureBase & other)
protected

◆ valid()

bool valid ( ) const
inline

Check if a future instance is associated with an asynchronous result.

Returns true if the *this has an associated asynchronous result, false otherwise.

Definition at line 123 of file Future.h.

◆ wait()

ONIXS_FIXENGINE_API FutureStatus::Enum wait ( int timeoutInMs = InfiniteTimeout) const

Waits for the result to become available during the timeout.

Note
Calling wait on the same Future from multiple threads is not safe; the intended use is for each thread that waits on the same shared state to have a copy of a Future.
Exceptions
Thestd::logic_error if this instance does not refer to a shared state.

◆ FutureHelper

friend class FutureHelper
friend

Definition at line 210 of file Future.h.

◆ PromiseBase

friend class PromiseBase
friend

Definition at line 211 of file Future.h.