Honeycomb
0.1
Component-Model Framework
|
Container to hold a delayed function result. More...
#include <Promise.h>
Public Types | |
typedef future::priv::State< R > | State |
Public Member Functions | |
template<class Alloc = std::allocator<State>> | |
Promise (Alloc &&a=Alloc()) | |
Construct with allocator for shared state. More... | |
Promise (Promise &&rhs) noexcept | |
~Promise () | |
Promise & | operator= (Promise &&rhs) |
Future< R > | future () |
Get future from which delayed result can be retrieved. More... | |
template<class T > | |
mt::disable_if< mt::True< T >::value &&(mt::isRef< R >::value||std::is_void< R >::value)>::type | setValue (T &&val) |
Set stored result. Result is copy/move constructed from value. More... | |
template<class T > | |
std::enable_if< mt::True< T >::value &&mt::isRef< R >::value >::type | setValue (T &val) |
Set stored result for ref result type. More... | |
void | setValue () |
Set stored result for void result type. More... | |
void | setException (const Exception::ConstPtr &e) |
Set stored exception. More... | |
bool | valid () const |
Check if this instance has state and can be used. State can be transferred out to another instance through move-assignment. More... | |
State & | __state () const |
Get the shared state. More... | |
template<> | |
void | setValue () |
Friends | |
template<class R_ > | |
class | Future |
template<class Sig > | |
class | PackagedTask |
Container to hold a delayed function result.
A promise must be fulfilled before being destroyed, otherwise its future will return the exception future::Broken.
typedef future::priv::State<R> honey::Promise< R >::State |
|
inline |
Construct with allocator for shared state.
|
inlinenoexcept |
|
inline |
|
inline |
Get the shared state.
|
inline |
Get future from which delayed result can be retrieved.
future::FutureAlreadyRetrieved | if future() has been called more than once. |
future::NoState | if invalid |
|
inline |
|
inline |
Set stored exception.
future::AlreadySatisfied | if a result has already been set |
future::NoState | if invalid |
|
inline |
Set stored result. Result is copy/move constructed from value.
future::AlreadySatisfied | if a result has already been set |
future::NoState | if invalid |
|
inline |
Set stored result for ref result type.
|
inline |
Set stored result for void result type.
|
inline |
|
inline |
Check if this instance has state and can be used. State can be transferred out to another instance through move-assignment.