Grappa  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Grappa::delegate::Promise< R > Class Template Reference

A 'Promise' is a wrapper around a FullEmpty for async delegates with return values. More...

#include <AsyncDelegate.hpp>

Public Member Functions

 Promise ()
 
void fill (const R &r)
 
constget ()
 Block on result being returned. More...
 
template<typename F >
void call_async (Core dest, F func)
 Call func on remote node, returning immediately. More...
 

Detailed Description

template<typename R>
class Grappa::delegate::Promise< R >

A 'Promise' is a wrapper around a FullEmpty for async delegates with return values.

The idea is to allocate storage for the result, issue the delegate request, and then block on waiting for the value when it's needed.

Example:

delegate::Promise<int> x;
x.call_async(1, []()->int { return value; });
// other work
myvalue += x.get();

Definition at line 60 of file AsyncDelegate.hpp.

Constructor & Destructor Documentation

template<typename R >
Grappa::delegate::Promise< R >::Promise ( )
inline

Definition at line 68 of file AsyncDelegate.hpp.

Member Function Documentation

template<typename R >
template<typename F >
void Grappa::delegate::Promise< R >::call_async ( Core  dest,
func 
)
inline

Call func on remote node, returning immediately.

Definition at line 84 of file AsyncDelegate.hpp.

template<typename R >
void Grappa::delegate::Promise< R >::fill ( const R &  r)
inline

Definition at line 70 of file AsyncDelegate.hpp.

template<typename R >
const R Grappa::delegate::Promise< R >::get ( )
inline

Block on result being returned.

Definition at line 75 of file AsyncDelegate.hpp.


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