OnixS C++ CME MDP Premium Market Data Handler 5.10.3
Users' manual and API documentation
Loading...
Searching...
No Matches
FutureBase Class Reference

#include <OnixS/CME/MDH/threading/Future.h>

Classes

struct  moving_init_t

Public Types

enum  

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
std::future_status wait (int timeoutInMs=InfiniteTimeout) const

Protected Member Functions

 FutureBase () noexcept=default
 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 45 of file Future.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
InfiniteTimeout -1 

Definition at line 78 of file Future.h.

Constructor & Destructor Documentation

◆ FutureBase() [1/5]

FutureBase ( )
protecteddefaultnoexcept

◆ FutureBase() [2/5]

FutureBase ( const FutureBase & other)
protectednoexcept

◆ FutureBase() [3/5]

FutureBase ( FutureBase && other)
protectednoexcept

◆ FutureBase() [4/5]

FutureBase ( const System::FutureSharedState * state)
protectednoexcept

Initializes the instance and adds a reference to the shared state.

◆ FutureBase() [5/5]

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

Initializes the instance from a detached shared state reference.

◆ ~FutureBase()

~FutureBase ( )
protectednoexcept

Destroys a future object.

If this is the last reference to the asynchronous result associated with *this, destroys that asynchronous result.

Member Function Documentation

◆ get_exception_ptr()

std::exception_ptr get_exception_ptr ( ) const

Returns the stored exception pointer.

Exceptions
std::logic_errorif this instance does not refer to a shared state.
std::logic_errorif the operation has not finished with an error.

◆ getValuePtr()

const void * getValuePtr ( ) const
protected

◆ getVoid()

void getVoid ( ) const
protected

◆ has_exception()

bool has_exception ( ) const

Checks whether the asynchronous result associated with this future stores an exception.

Exceptions
std::logic_errorif this instance does not refer to a shared state.

◆ has_value()

bool has_value ( ) const

Checks whether the asynchronous result associated with this future stores a value.

Exceptions
std::logic_errorif this instance does not refer to a shared state.

◆ is_ready()

bool is_ready ( ) const

Checks whether the asynchronous result associated with this future is ready (has a value or exception stored in the shared state), false otherwise.

Exceptions
std::logic_errorif this instance does not refer to a shared state.

◆ operator=() [1/2]

FutureBase & operator= ( const FutureBase & other)
protectednoexcept

◆ operator=() [2/2]

FutureBase & operator= ( FutureBase && other)
protectednoexcept

◆ swap()

void swap ( FutureBase & other)
protectednoexcept

◆ valid()

bool valid ( ) const
inlinenoexcept

Checks whether this instance is associated with a shared asynchronous result.

Returns
true if this instance has an associated shared state, false otherwise.

Definition at line 51 of file Future.h.

◆ wait()

std::future_status wait ( int timeoutInMs = InfiniteTimeout) const

Waits for the result to become available.

Parameters
timeoutInMsMaximum wait time in milliseconds. Use InfiniteTimeout to wait without a timeout.
Returns
std::future_status::ready when the shared state has a value or exception, or std::future_status::timeout when the timeout expires first.
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.

◆ FutureHelper

friend class FutureHelper
friend

Definition at line 130 of file Future.h.