Lunchbox  1.17.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 62 of file future.h.

Constructor & Destructor Documentation

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

Construct a new future.

Definition at line 71 of file future.h.

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

Destruct the future.

Definition at line 77 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 93 of file future.h.

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

Definition at line 97 of file future.h.

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

Definition at line 99 of file future.h.

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 103 of file future.h.

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 105 of file future.h.

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

Definition at line 109 of file future.h.

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.

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 107 of file future.h.

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

Definition at line 111 of file future.h.

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 85 of file future.h.

Referenced by lunchbox::Request< T >::~Request().

+ Here is the caller graph for this function:


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