Remote Call Framework 3.0
RCF::Future< T > Class Template Reference

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...
 

Detailed Description

template<typename T>
class RCF::Future< T >

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.

Constructor & Destructor Documentation

◆ Future() [1/2]

template<typename T>
RCF::Future< T >::Future ( )

Constructs a new Future instance.

◆ Future() [2/2]

template<typename T>
RCF::Future< T >::Future ( const T &  t)

Constructs a new Future instance, holding a copy of t.

Member Function Documentation

◆ operator*()

template<typename 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.

◆ ready()

template<typename T>
bool RCF::Future< T >::ready ( )

Tests whether the result of an asynchronous call is ready.

◆ wait()

template<typename T>
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.

◆ cancel()

template<typename T>
void RCF::Future< T >::cancel ( )

Cancels an asynchronous call.

◆ clear()

template<typename T>
void RCF::Future< T >::clear ( )

Clears this Future instance.


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