16 #ifndef BLOOMBERG_QUANTUM_PROMISE_H 17 #define BLOOMBERG_QUANTUM_PROMISE_H 19 #include <quantum/quantum_future.h> 20 #include <quantum/interface/quantum_ipromise.h> 33 class Promise :
public IPromiseBase,
34 public IThreadPromise<Promise, T>,
35 public ICoroPromise<Promise, T>
38 using Ptr = std::shared_ptr<Promise<T>>;
56 bool valid() const final;
79 static
void* operator new(
size_t size);
80 static
void operator delete(
void* p);
85 std::atomic_flag _terminated;
93 #include <quantum/impl/quantum_promise_impl.h> 95 #endif //BLOOMBERG_QUANTUM_PROMISE_H Exposes methods to access a coroutine-compatible future.
Definition: quantum_icoro_future_base.h:32
Definition: quantum_buffer_impl.h:22
std::enable_if_t< Traits::IsBuffer< T >::value &&!std::is_same< std::decay_t< V >, T >::value &&std::is_convertible< std::decay_t< V >, typename Traits::IsBuffer< T >::Type >::value > BufferType
Definition: quantum_traits.h:89
typename ICoroFuture< T >::Ptr CoroFuturePtr
Definition: quantum_icoro_future.h:72
Shared state used between a Promise and a Future to exchange values.
Definition: quantum_shared_state.h:38
std::enable_if_t<!Traits::IsBuffer< T >::value &&std::is_convertible< std::decay_t< V >, T >::value > NonBufferType
Definition: quantum_traits.h:91
std::shared_ptr< IPromiseBase > Ptr
Definition: quantum_ipromise_base.h:34
typename Promise< T >::Ptr PromisePtr
Definition: quantum_promise.h:89
void push(V &&value)
Definition: quantum_promise_impl.h:172
ThreadFuturePtr< T > getIThreadFuture() const
Get the associated thread future.
Definition: quantum_promise_impl.h:149
int setException(std::exception_ptr ex) final
Set an exception in this promise.
Definition: quantum_promise_impl.h:120
Provides an interface to facilitate 'implicit' coroutine yielding within other primitives such as mut...
Definition: quantum_icoro_sync.h:34
bool valid() const final
Determines if this promise still has a shared state with the corresponding future object.
Definition: quantum_promise_impl.h:114
Definition: quantum_stl_impl.h:23
int set(V &&value)
Definition: quantum_promise_impl.h:142
static void deleter(Promise< T > *p)
Definition: quantum_promise_impl.h:207
Class representing a promised value.
Definition: quantum_icoro_promise.h:77
ICoroFutureBase::Ptr getICoroFutureBase() const final
Get a coroutine-compatible interface used to access the associated future.
Definition: quantum_promise_impl.h:134
Promise()
Definition: quantum_promise_impl.h:91
std::shared_ptr< Promise< T > > Ptr
Definition: quantum_promise.h:38
std::shared_ptr< IThreadFutureBase > Ptr
Definition: quantum_ithread_future_base.h:34
void terminate() final
Terminates the object.
Definition: quantum_promise_impl.h:105
typename IThreadFuture< T >::Ptr ThreadFuturePtr
Definition: quantum_ithread_future.h:69
std::enable_if_t< Traits::IsBuffer< T >::value, typename Traits::IsBuffer< T >::Type > BufferRetType
Definition: quantum_traits.h:93
int closeBuffer()
Definition: quantum_promise_impl.h:188
IThreadFutureBase::Ptr getIThreadFutureBase() const final
Get a thread-compatible interface used to access the associated future.
Definition: quantum_promise_impl.h:127
Configuration parameters for the Quantum library.
CoroFuturePtr< T > getICoroFuture() const
Get the associated coroutine future.
Definition: quantum_promise_impl.h:164