Grappa  r3821, hash 22cd626d567a91ead5b23302066d1e9469f45c66
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)
 
const R get ()
 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 71 of file AsyncDelegate.hpp.

Constructor & Destructor Documentation

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

Definition at line 79 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 95 of file AsyncDelegate.hpp.

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

Definition at line 81 of file AsyncDelegate.hpp.

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

Block on result being returned.

Definition at line 86 of file AsyncDelegate.hpp.


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