AUI Framework
master
Cross-platform module-based framework for developing C++20 desktop applications
|
Public Types | |
using | Task = typename super::TaskCallback |
using | Inner = decltype(std::declval< super >().inner()) |
Public Types inherited from aui::impl::future::Future< void > | |
using | TaskCallback = std::function< void()> |
using | OnSuccessCallback = typename OnSuccessCallback< void >::type |
Public Member Functions | |
AFuture (Task task=nullptr) noexcept | |
AFuture (const AFuture &)=default | |
AFuture (AFuture &&) noexcept=default | |
AFuture & | operator= (const AFuture &)=default |
AFuture & | operator= (AFuture &&) noexcept=default |
void | supplyException (std::exception_ptr causedBy=std::current_exception()) const noexcept |
Stores an exception from std::current_exception to the future. | |
void | supplyValue () const noexcept |
Pushes "success" result. More... | |
AFuture & | operator= (std::nullptr_t) noexcept |
bool | operator== (const AFuture &r) const noexcept |
template<aui::invocable Callback> | |
const AFuture & | onSuccess (Callback &&callback) const |
Add onSuccess callback to the future. More... | |
template<aui::invocable< const AException & > Callback> | |
const AFuture & | onError (Callback &&callback) const |
Add onSuccess callback to the future. More... | |
template<aui::invocable Callback> | |
const AFuture & | onFinally (Callback &&callback) const |
Adds the callback to both onSuccess and onResult. | |
Public Member Functions inherited from aui::impl::future::Future< void > | |
Future (TaskCallback task=nullptr) | |
const _< CancellationWrapper< Inner > > & | inner () const noexcept |
bool | isWaitNeeded () const noexcept |
bool | hasResult () const noexcept |
bool | hasValue () const noexcept |
void | reportException () const noexcept |
void | onSuccess (Callback &&callback) const |
void | onError (Callback &&callback) const |
void | onFinally (Callback &&callback) const |
Adds the callback to both onSuccess and onResult. | |
void | cancel () const noexcept |
Cancels the AFuture's task. More... | |
void | reportInterrupted () const |
void | wait (AFutureWait flags=AFutureWait::DEFAULT) const |
Sleeps if the supplyValue is not currently available. More... | |
FutureReturnType< void >::type | get (AFutureWait flags=AFutureWait::DEFAULT) const |
Returns the supplyValue from the another thread. Sleeps if the supplyValue is not currently available. More... | |
FutureReturnType< void >::type | operator* () const |
Returns the task result from the another thread. Sleeps if the task result is not currently available. More... | |
FutureReturnType< void >::type | operator* () |
Returns the supplyValue from the another thread. Sleeps if the supplyValue is not currently available. More... | |
void * | operator-> () const |
Returns the supplyValue from the another thread. Sleeps if the supplyValue is not currently available. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from aui::impl::future::Future< void > | |
static constexpr bool | isVoid |
Protected Attributes inherited from aui::impl::future::Future< void > | |
_< CancellationWrapper< Inner > > | mInner |
|
inline |
Add onSuccess callback to the future.
The callback will be called on the worker's thread when the async task is returned a result.
onSuccess does not expand AFuture's lifespan, so when AFuture becomes invalid, onSuccess would not be called.
|
inline |
Add onSuccess callback to the future.
The callback will be called on the worker's thread when the async task is returned a result.
onSuccess does not expand AFuture's lifespan, so when AFuture becomes invalid, onSuccess would not be called.
|
inlinenoexcept |
Pushes "success" result.
supplyValue calls onSuccess listeners with the new value.