OnixS C++ B3 BOE Binary Order Entry  1.2.0
API Documentation
FutureBase Class Reference

#include <OnixS/B3/BOE/threading/Future.h>

Classes

struct  moving_init_t
 

Public Types

enum  { InfiniteTimeout = -1 }
 

Public Member Functions

bool valid () const noexcept
 
bool is_ready () const
 
bool has_value () const
 
bool has_exception () const
 
std::exception_ptr get_exception_ptr () const
 
FutureStatus::Enum wait (int timeoutInMs) const
 

Protected Member Functions

 FutureBase ()
 
 FutureBase (const FutureBase &other) noexcept
 
FutureBaseoperator= (const FutureBase &other) noexcept
 
 FutureBase (FutureBase &&other) noexcept
 
FutureBaseoperator= (FutureBase &&other) noexcept
 
 FutureBase (const System::FutureSharedState *state) noexcept
 
 FutureBase (const System::FutureSharedState *state, moving_init_t) noexcept
 
 ~FutureBase () noexcept
 
void swap (FutureBase &other) noexcept
 
const void * getValuePtr () const
 
void getVoid () const
 

Friends

class FutureHelper
 

Detailed Description

Definition at line 57 of file Future.h.

Member Enumeration Documentation

anonymous enum
Enumerator
InfiniteTimeout 

Definition at line 101 of file Future.h.

Constructor & Destructor Documentation

FutureBase ( )
inlineprotected

Definition at line 112 of file Future.h.

FutureBase ( const FutureBase other)
protectednoexcept
FutureBase ( FutureBase &&  other)
protectednoexcept
FutureBase ( const System::FutureSharedState *  state)
protectednoexcept

Initializes the instance with shared state.

FutureBase ( const System::FutureSharedState *  state,
moving_init_t   
)
protectednoexcept

Initializes the instance with shared state.

~FutureBase ( )
protectednoexcept

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

std::exception_ptr get_exception_ptr ( ) const

Returns the stored exception.

Exceptions
std::logic_errorif this instance does not refer to a shared state.
std::logic_errorif the operation has not finished with an error.
const void* getValuePtr ( ) const
protected
void getVoid ( ) const
protected
bool has_exception ( ) const

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

Exceptions
std::logic_errorif this instance does not refer to a shared state.
bool has_value ( ) const

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

Exceptions
std::logic_errorif this instance does not refer to a shared state.
bool is_ready ( ) const

Returns true if the asynchronous result associated with this Future is ready (has a value or 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 cache efficiency.

Exceptions
std::logic_errorif this instance does not refer to a shared state.
FutureBase& operator= ( const FutureBase other)
protectednoexcept
FutureBase& operator= ( FutureBase &&  other)
protectednoexcept
void swap ( FutureBase other)
protectednoexcept
bool valid ( ) const
inlinenoexcept

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 63 of file Future.h.

FutureStatus::Enum wait ( int  timeoutInMs) 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
std::logic_errorif this instance does not refer to a shared state.

Friends And Related Function Documentation

friend class FutureHelper
friend

Definition at line 149 of file Future.h.


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