GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
graphlab::request_future< T > Struct Template Reference

#include <graphlab/rpc/request_future.hpp>

List of all members.

Public Types

typedef
dc_impl::function_ret_type< T >
::type 
result_type

Public Member Functions

 request_future ()
 default constructor
 request_future (const T &val)
 request_future (const request_future< T > &val)
 copy constructor
request_futureoperator= (const request_future< T > &val)
 operator=
void wait ()
 explicit call to wait(). Will wait only if the future has no value yet
bool is_ready ()
result_type & operator() ()

Public Attributes

std::auto_ptr
< dc_impl::reply_ret_type > 
reply
result_type result
bool hasval

Detailed Description

template<typename T>
struct graphlab::request_future< T >

The result of a future_remote_request call. This class represents the outcome of a remote request sent to another machine via the future_remote_request_call. The future_remote_request call returns immediately with this object. Only when operator() is called on this object, then it waits for a result from the remote machine.

example:

// this function returns immediately
rmi.future_remote_request(SOME_OTHER_MACHINE,
function_which_returns_an_integer, ...);
... we can do other stuff ...
// read the result, or wait for the result if it is not done yet.
int actual_result = res();

The future object holds a copy of the result of the request, and the operator() call returns a reference to this result (once it is available).

Definition at line 36 of file request_future.hpp.


Constructor & Destructor Documentation

template<typename T>
graphlab::request_future< T >::request_future ( const T &  val)
inline

We can assign return values directly to the future in the case where no remote calls are necessary. Thus allowing the following to be written easily:

request_future<int> a_function(int arg) {
if (arg == 0) return rmi.future_remote_request(... somewhere else ...) ;
else return 10;
}

Definition at line 57 of file request_future.hpp.


Member Function Documentation

template<typename T>
result_type& graphlab::request_future< T >::operator() ( )
inline

Waits for the request if it has not yet been received. Otherwise, returns a reference to the received value.

Definition at line 96 of file request_future.hpp.


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