QuantumLibrary
Bloomberg::quantum::IPromiseBase Interface Referenceabstract

Exposes methods to manipulate and access a promise. More...

#include <quantum_ipromise_base.h>

Inheritance diagram for Bloomberg::quantum::IPromiseBase:
Bloomberg::quantum::ITerminate Bloomberg::quantum::Promise< T >

Public Types

using Ptr = std::shared_ptr< IPromiseBase >
 

Public Member Functions

virtual bool valid () const =0
 Determines if this promise still has a shared state with the corresponding future object. More...
 
virtual int setException (std::exception_ptr ex)=0
 Set an exception in this promise. More...
 
virtual IThreadFutureBase::Ptr getIThreadFutureBase () const =0
 Get a thread-compatible interface used to access the associated future. More...
 
virtual ICoroFutureBase::Ptr getICoroFutureBase () const =0
 Get a coroutine-compatible interface used to access the associated future. More...
 
- Public Member Functions inherited from Bloomberg::quantum::ITerminate
virtual ~ITerminate ()=default
 Virtual destructor. This function is explicitly left empty. More...
 
virtual void terminate ()=0
 Terminates the object. More...
 

Detailed Description

Exposes methods to manipulate and access a promise.

Member Typedef Documentation

◆ Ptr

Member Function Documentation

◆ getICoroFutureBase()

virtual ICoroFutureBase::Ptr Bloomberg::quantum::IPromiseBase::getICoroFutureBase ( ) const
pure virtual

Get a coroutine-compatible interface used to access the associated future.

Returns
An interface to the associated future.

Implemented in Bloomberg::quantum::Promise< T >.

◆ getIThreadFutureBase()

virtual IThreadFutureBase::Ptr Bloomberg::quantum::IPromiseBase::getIThreadFutureBase ( ) const
pure virtual

Get a thread-compatible interface used to access the associated future.

Returns
An interface to the associated future.

Implemented in Bloomberg::quantum::Promise< T >.

◆ setException()

virtual int Bloomberg::quantum::IPromiseBase::setException ( std::exception_ptr  ex)
pure virtual

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.

Parameters
[in]exAn exception pointer which has been caught via std::current_exception.
Returns
0 on success

Implemented in Bloomberg::quantum::Promise< T >.

◆ valid()

virtual bool Bloomberg::quantum::IPromiseBase::valid ( ) const
pure virtual

Determines if this promise still has a shared state with the corresponding future object.

Returns
True if valid, false otherwise.

Implemented in Bloomberg::quantum::Promise< T >.