|
MADNESS 0.10.1
|
A future of a future is forbidden (by deleted constructor). More...
#include <future.h>
Public Types | |
| typedef RemoteReference< FutureImpl< T > > | remote_refT |
Public Member Functions | |
| ~Future () | |
| Destructor. | |
| T & | get (bool dowork=true) & |
| Gets the value, waiting if necessary. | |
| bool | is_default_initialized () const |
| Check if the future is default initialized. | |
| bool | is_local () const |
| Checks the future remoteness trait. | |
| bool | is_remote () const |
| Checks the future remoteness trait. | |
| operator const T & () const & | |
| Same as get() const&. | |
| operator T () && | |
An rvalue analog of get(). | |
| operator T& () & | |
Same as get()&. | |
| Future< T > & | operator= (const Future< T > &other) |
| Shallow assignment operator. | |
| bool | probe () const |
| Check whether this future has been assigned. | |
| void | register_callback (CallbackInterface *callback) |
| Registers an object to be called when future is assigned. | |
| remote_refT | remote_ref (World &world) const |
| Returns a structure used to pass references to another process. | |
| void | set (const Future< T > &other) |
| A.set(B), where A and B are futures ensures A has/will have the same value as B. | |
Static Public Member Functions | |
| static const Future< T > | default_initializer () |
| See "Gotchas" on Futures about why this exists and how to use it. | |
Private Member Functions | |
| Future ()=delete | |
Private Attributes | |
| char | buffer [sizeof(T)] |
Buffer to hold a single T object. | |
| atomic_shared_ptr< FutureImpl< T > > | f |
| Pointer to the implementation object. | |
| T *const | value |
Pointer to buffer when it holds a T object. | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Future< T > &f) |
Human readable printing of a Future to a stream. | |
A future of a future is forbidden (by deleted constructor).
| T | The type of future. |
| typedef RemoteReference< FutureImpl<T> > madness::Future< T >::remote_refT |
|
privatedelete |
|
inline |
Destructor.
|
inlinestatic |
|
inline |
Gets the value, waiting if necessary.
| dowork | If true (default) and the future is not ready this thread will execute other tasks while waiting |
|
inline |
Check if the future is default initialized.
default_initializer(); false otherwise.
|
inline |
Checks the future remoteness trait.
|
inline |
Checks the future remoteness trait.
|
inline |
Same as get() const&.
|
inline |
An rvalue analog of get().
|
inline |
Same as get()&.
|
inline |
Shallow assignment operator.
| [in] | other | The future to copy. |
|
inline |
Check whether this future has been assigned.
|
inline |
Registers an object to be called when future is assigned.
Callbacks are invoked in the order registered. If the future is already assigned, the callback is immediately invoked.
| [in] | callback | The callback to be invoked. |
|
inline |
Returns a structure used to pass references to another process.
This is used for passing pointers/references to another process. To make remote references completely safe, the RemoteReference increments the internal reference count of the Future. The counter is decremented by either assigning to the remote Future or its destructor if it is never assigned. The remote Future is only useful for setting the future. It will not be notified if the value is set elsewhere.
If this is already a reference to a remote future, the actual remote reference is returned; that is, not a a reference to the local future. Therefore, the local future will not be notified when the result is set (i.e., the communication is short circuited).
| [in,out] | world | The communication world. |
|
inline |
A.set(B), where A and B are futures ensures A has/will have the same value as B.
An exception is thrown if A is already assigned since a Future is a single assignment variable. We don't yet track multiple assignments from unassigned futures.
If B is already assigned, this is the same as A.set(B.get()), which sets A to the value of B.
If B has not yet been assigned, the behavior is to ensure that, when B is assigned, both A and B will be assigned and have the same value (though they may/may not refer to the same underlying copy of the data and indeed may even be in different processes).
|
friend |
Human readable printing of a Future to a stream.
Stream output operator for a future.
| T | The type of future. |
| [in,out] | out | The output stream. |
| [in] | f | The future. |
| T | Description needed. |
| [in,out] | The | output stream. |
| [in] | f | The future to be output. |
|
private |
Buffer to hold a single T object.
|
private |
Pointer to the implementation object.
|
private |
Pointer to buffer when it holds a T object.