DASH
0.3.0
|
Implementation of a future used to wait for an operation to complete and access the value returned by that operation. More...
#include <Future.h>
Public Types | |
typedef Future< ResultT > | self_t |
typedef std::function< ResultT(void)> | get_func_t |
Callback function returning the result value. More... | |
typedef std::function< bool(ResultT *)> | test_func_t |
Callback function to test for the availability of the result value. More... | |
typedef std::function< void(void)> | destroy_func_t |
Callback function called upon destruction. More... | |
Public Member Functions | |
Future () noexcept(std::is_nothrow_constructible< ResultT >::value)=default | |
Default constructor, creates a future that invalid. More... | |
Future (ResultT result) noexcept(std::is_nothrow_move_constructible< ResultT >::value) | |
Create a future from an already available value. More... | |
Future (get_func_t get_func) noexcept | |
Create a future using a function that returns the value. More... | |
Future (get_func_t get_func, test_func_t test_func) noexcept | |
Create a future using a function that returns the value and a function to test whether the value returned by get_func is ready. More... | |
Future (get_func_t get_func, test_func_t test_func, destroy_func_t destroy_func) noexcept | |
Create a future using a function that returns the value and a function to test whether the value returned by get_func is ready, plus a function to be called upon destruction of the future. More... | |
Future (const self_t &other)=delete | |
Copy construction is not permited. More... | |
Future (self_t &&other) noexcept(std::is_nothrow_move_assignable< Future >::value) | |
Move constructor. More... | |
~Future () | |
Destructor. More... | |
self_t & | operator= (const self_t &other)=delete |
Copy assignment is not permited. More... | |
self_t & | operator= (self_t &&other) noexcept(std::is_nothrow_move_assignable< ResultT >::value) |
Move assignment. More... | |
void | wait () |
Wait for the value to become available. More... | |
bool | test () |
Test whether the value is available. More... | |
ResultT | get () |
Return the value after making sure that the value is available. More... | |
bool | valid () noexcept |
Check whether the future is valid, i.e., whether either a value or a function to access the valid has been provided. More... | |
Friends | |
template<typename ResultT_ > | |
std::ostream & | operator<< (std::ostream &os, const Future< ResultT_ > &future) |
Implementation of a future used to wait for an operation to complete and access the value returned by that operation.
typedef std::function<void (void)> dash::Future< ResultT >::destroy_func_t |
typedef std::function<ResultT (void)> dash::Future< ResultT >::get_func_t |
typedef std::function<bool (ResultT*)> dash::Future< ResultT >::test_func_t |
|
defaultnoexcept |
Default constructor, creates a future that invalid.
Referenced by dash::Future< ResultT >::Future(), and dash::Future< void >::Future().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Create a future using a function that returns the value and a function to test whether the value returned by get_func
is ready.
get_func | Function returning the result value. |
test_func | Function returning true and assigning the result value to the pointer passed to it if the value is available. |
|
inlinenoexcept |
Create a future using a function that returns the value and a function to test whether the value returned by get_func
is ready, plus a function to be called upon destruction of the future.
get_func | Function returning the result value. |
test_func | Function returning true and assigning the result value to the pointer passed to it if the value is available. |
destroy_func | Function called upon destruction of the future. |
Definition at line 110 of file Future.h.
References dash::Future< ResultT >::Future().
|
delete |
Copy construction is not permited.
|
inlinenoexcept |
|
inline |
Destructor.
Calls the destroy_func
passed to the constructor, if available.
Definition at line 136 of file Future.h.
References dash::Future< ResultT >::operator=().
|
inline |
Return the value after making sure that the value is available.
Definition at line 209 of file Future.h.
References dash::Future< ResultT >::wait().
|
delete |
Copy assignment is not permited.
Referenced by dash::Future< ResultT >::~Future(), and dash::Future< void >::~Future().
|
inlinenoexcept |
|
inline |
Test whether the value is available.
It is safe to call get after this call returned true
. This function will block if no test-function has been provided.
true
if the value is available, false
otherwise. Definition at line 189 of file Future.h.
|
inlinenoexcept |
|
inline |
Wait for the value to become available.
It is safe to call get after this call returned.
Definition at line 165 of file Future.h.
Referenced by dash::Future< ResultT >::get(), dash::Future< void >::get(), and dash::summa().