|
QuantumLibrary
|
Class representing a promised value. More...
#include <quantum_icoro_promise.h>
Public Types | |
| using | Ptr = std::shared_ptr< Promise< T > > |
Public Types inherited from Bloomberg::quantum::IPromiseBase | |
| using | Ptr = std::shared_ptr< IPromiseBase > |
Public Types inherited from Bloomberg::quantum::IThreadPromise< Promise, T > | |
| using | ContextTag = ThreadContextTag |
| using | Ptr = std::shared_ptr< IThreadPromise< Promise, T > > |
| using | Impl = Promise< T > |
Public Types inherited from Bloomberg::quantum::ICoroPromise< Promise, T > | |
| using | ContextTag = CoroContextTag |
| using | Ptr = std::shared_ptr< ICoroPromise< Promise, T > > |
| using | Impl = Promise< T > |
Public Member Functions | |
| Promise () | |
| ~Promise () | |
| IThreadFutureBase::Ptr | getIThreadFutureBase () const final |
| Get a thread-compatible interface used to access the associated future. More... | |
| ICoroFutureBase::Ptr | getICoroFutureBase () const final |
| Get a coroutine-compatible interface used to access the associated future. More... | |
| ThreadFuturePtr< T > | getIThreadFuture () const |
| Get the associated thread future. More... | |
| CoroFuturePtr< T > | getICoroFuture () const |
| Get the associated coroutine future. More... | |
| void | terminate () final |
| Terminates the object. More... | |
| bool | valid () const final |
| Determines if this promise still has a shared state with the corresponding future object. More... | |
| int | setException (std::exception_ptr ex) final |
| Set an exception in this promise. More... | |
| template<class V , class = NonBufferType<T,V>> | |
| int | set (V &&value) |
| template<class V , class = BufferType<T,V>> | |
| void | push (V &&value) |
| template<class V , class = NonBufferType<T,V>> | |
| int | set (ICoroSync::Ptr sync, V &&value) |
| template<class V , class = BufferType<T,V>> | |
| void | push (ICoroSync::Ptr sync, V &&value) |
| template<class V = T, class = BufferRetType<V>> | |
| int | closeBuffer () |
Public Member Functions inherited from Bloomberg::quantum::ITerminate | |
| virtual | ~ITerminate ()=default |
| Virtual destructor. This function is explicitly left empty. More... | |
Public Member Functions inherited from Bloomberg::quantum::IThreadPromise< Promise, T > | |
| IThreadPromise (Impl *derived) | |
| Constructor. More... | |
| int | set (V &&value) |
| Set the promised value. More... | |
| void | push (V &&value) |
| Push a single value into the promise buffer. More... | |
| int | closeBuffer () |
| Close a promise buffer. More... | |
Public Member Functions inherited from Bloomberg::quantum::Traits::DerivedFrom< Promise< T >, IThreadPromise< Promise, T >, IPromiseBase > | |
| virtual | ~DerivedFrom ()=default |
| operator IPromiseBase * () | |
| operator IPromiseBase & () | |
Public Member Functions inherited from Bloomberg::quantum::ICoroPromise< Promise, T > | |
| ICoroPromise (Impl *derived) | |
| Constructor. More... | |
| int | set (ICoroSync::Ptr sync, V &&value) |
| Set the promised value. More... | |
| void | push (ICoroSync::Ptr sync, V &&value) |
| Push a single value into the promise buffer. More... | |
| int | closeBuffer () |
| Close a promise buffer. More... | |
Public Member Functions inherited from Bloomberg::quantum::Traits::DerivedFrom< Promise< T >, ICoroPromise< Promise, T >, IPromiseBase > | |
| virtual | ~DerivedFrom ()=default |
| operator IPromiseBase * () | |
| operator IPromiseBase & () | |
Static Public Member Functions | |
| static void * | operator new (size_t size) |
| static void | operator delete (void *p) |
| static void | deleter (Promise< T > *p) |
Class representing a promised value.
| T | Type of value returned by the promise. |
| using Bloomberg::quantum::Promise< T >::Ptr = std::shared_ptr<Promise<T> > |
| Bloomberg::quantum::Promise< T >::Promise | ( | ) |
| Bloomberg::quantum::Promise< T >::~Promise | ( | ) |
|
static |
|
virtual |
Get the associated coroutine future.
Implements Bloomberg::quantum::ICoroPromise< Promise, T >.
|
finalvirtual |
Get a coroutine-compatible interface used to access the associated future.
Implements Bloomberg::quantum::IPromiseBase.
|
virtual |
Get the associated thread future.
Implements Bloomberg::quantum::IThreadPromise< Promise, T >.
|
finalvirtual |
Get a thread-compatible interface used to access the associated future.
Implements Bloomberg::quantum::IPromiseBase.
|
static |
|
static |
| void Bloomberg::quantum::Promise< T >::push | ( | V && | value | ) |
| void Bloomberg::quantum::Promise< T >::push | ( | ICoroSync::Ptr | sync, |
| V && | value | ||
| ) |
| int Bloomberg::quantum::Promise< T >::set | ( | V && | value | ) |
| int Bloomberg::quantum::Promise< T >::set | ( | ICoroSync::Ptr | sync, |
| V && | value | ||
| ) |
|
finalvirtual |
Set an exception in this promise.
When setting an exception inside a promise, any attempt to read a value from the associated future will re-throw this exception. Any threads or coroutines already blocked on this future will immediately unblock and re-throw.
| [in] | ex | An exception pointer which has been caught via std::current_exception. |
Implements Bloomberg::quantum::IPromiseBase.
|
finalvirtual |
Terminates the object.
Implements Bloomberg::quantum::ITerminate.
|
finalvirtual |
Determines if this promise still has a shared state with the corresponding future object.
Implements Bloomberg::quantum::IPromiseBase.