Lunchbox  1.12.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
lunchbox::Future< T > Class Template Reference

A future represents a asynchronous operation. More...

#include <future.h>

+ Inheritance diagram for lunchbox::Future< T >:
+ Collaboration diagram for lunchbox::Future< T >:

Public Types

typedef RefPtr< FutureImpl< T > > Impl
 The wait implementation.
 

Public Member Functions

 Future (Impl impl)
 Construct a new future. More...
 
 ~Future ()
 Destruct the future. More...
 
wait (const uint32_t timeout_=LB_TIMEOUT_INDEFINITE)
 Wait for the promise to be fullfilled. More...
 
bool isReady () const
 
Blocking comparison operators.
 operator bool_t ()
 
bool operator! ()
 
bool operator== (const T &rhs)
 
bool operator!= (const T &rhs)
 
bool operator< (const T &rhs)
 
bool operator> (const T &rhs)
 
bool operator<= (const T &rhs)
 
bool operator>= (const T &rhs)
 

Protected Attributes

Impl impl_
 

Detailed Description

template<class T>
class lunchbox::Future< T >

A future represents a asynchronous operation.

Do not subclass.

Definition at line 60 of file future.h.

Constructor & Destructor Documentation

template<class T>
lunchbox::Future< T >::Future ( Impl  impl)
inlineexplicit

Construct a new future.

Definition at line 70 of file future.h.

template<class T>
lunchbox::Future< T >::~Future ( )
inline

Destruct the future.

Definition at line 73 of file future.h.

Member Function Documentation

template<class T>
bool lunchbox::Future< T >::isReady ( ) const
inline
Returns
true if the future has been fulfilled, false if it is pending.

Definition at line 90 of file future.h.

template<class T>
lunchbox::Future< T >::operator bool_t ( )
inline
Returns
a bool conversion of the result.

Definition at line 95 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator! ( )
inline
Returns
true if the result does convert to false.

Definition at line 98 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator!= ( const T &  rhs)
inline
Returns
true if the result is not equal to the rhs.

Definition at line 104 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator< ( const T &  rhs)
inline
Returns
true if the result is smaller than the rhs.

Definition at line 107 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator<= ( const T &  rhs)
inline
Returns
true if the result is smaller or equal.

Definition at line 113 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator== ( const T &  rhs)
inline
Returns
true if the result is equal to the given value.

Definition at line 101 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator> ( const T &  rhs)
inline
Returns
true if the result is bigger than the rhs.

Definition at line 110 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
bool lunchbox::Future< T >::operator>= ( const T &  rhs)
inline
Returns
true if the result is bigger or equal.

Definition at line 116 of file future.h.

References lunchbox::Future< T >::wait().

+ Here is the call graph for this function:

template<class T>
T lunchbox::Future< T >::wait ( const uint32_t  timeout_ = LB_TIMEOUT_INDEFINITE)
inline

Wait for the promise to be fullfilled.

Parameters
timeout_optional timeout in milliseconds. If the future is not ready when the timer goes off a timeout exception is thrown.

Definition at line 82 of file future.h.

Referenced by lunchbox::Future< T >::operator bool_t(), lunchbox::Future< T >::operator!(), lunchbox::Future< T >::operator!=(), lunchbox::Future< T >::operator<(), lunchbox::Future< T >::operator<=(), lunchbox::Future< T >::operator==(), lunchbox::Future< T >::operator>(), and lunchbox::Future< T >::operator>=().

+ Here is the caller graph for this function:


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