Provides the ability for remote calls to be executed asynchronously. More...
#include <Future.hpp>
Public Member Functions | |
Future () | |
Constructs a new Future instance. More... | |
Future (const T &t) | |
Constructs a new Future instance, holding a copy of t. More... | |
T & | operator* () |
Dereferences this Future instance. If the remote call is still in progress, this function will block until the remote call completes. More... | |
bool | ready () |
Tests whether the result of an asynchronous call is ready. More... | |
void | wait (std::uint32_t timeoutMs=0) |
Waits for up to timeoutMs ms, for the result of an asynchronous call to become ready. More... | |
void | cancel () |
Cancels an asynchronous call. More... | |
void | clear () |
Clears this Future instance. More... | |
Provides the ability for remote calls to be executed asynchronously.
The Future class provides the user with a mechanism to access the return values of an asynchronous remote call. Future instances can be used as parameters or return values in a remote call. If any Future instances are used in a remote call invocation, the remote call is performed asynchronously. There are several ways of waiting for an asynchronous remote call to complete. You can poll a Future instance using ready(), or wait for a specified time interval using wait(). You can also cancel the call at any time using cancel(). Once a remote call completes, the result is accessed by dereferencing the Future instance using operator*(). The Future class is internally reference counted, and has shallow copy semantics.
RCF::Future< T >::Future | ( | ) |
Constructs a new Future instance.
RCF::Future< T >::Future | ( | const T & | t | ) |
Constructs a new Future instance, holding a copy of t.
T& RCF::Future< T >::operator* | ( | ) |
Dereferences this Future instance. If the remote call is still in progress, this function will block until the remote call completes.
bool RCF::Future< T >::ready | ( | ) |
Tests whether the result of an asynchronous call is ready.
void RCF::Future< T >::wait | ( | std::uint32_t | timeoutMs = 0 | ) |
Waits for up to timeoutMs ms, for the result of an asynchronous call to become ready.
void RCF::Future< T >::cancel | ( | ) |
Cancels an asynchronous call.
void RCF::Future< T >::clear | ( | ) |
Clears this Future instance.