YACLib
C++ library for concurrent tasks execution
|
Provides a mechanism to access the result of async operations. More...
#include <future.hpp>
Public Member Functions | |
FutureBase (const FutureBase &)=delete | |
FutureBase & | operator= (const FutureBase &)=delete |
FutureBase (FutureBase &&other) noexcept=default | |
FutureBase & | operator= (FutureBase &&other) noexcept=default |
FutureBase () noexcept=default | |
The default constructor creates not a Valid Future. | |
~FutureBase () noexcept | |
If Future is Valid then call Stop. | |
bool | Valid () const &noexcept |
Check if this Future has Promise. | |
bool | Ready () const &noexcept |
Check that Result that corresponds to this Future is computed. | |
void | Get () &=delete |
void | Get () const &&=delete |
void | Touch () &=delete |
void | Touch () const &&=delete |
const Result< V, E > * | Get () const &noexcept |
Return copy of Result from Future. | |
Result< V, E > | Get () &&noexcept |
const Result< V, E > & | Touch () const &noexcept |
Result< V, E > | Touch () &&noexcept |
template<typename Func > | |
auto | Then (IExecutor &e, Func &&f) && |
Attach the continuation func to *this. | |
void | Detach () &&noexcept |
Disable calling Stop in destructor. | |
template<typename Func > | |
void | DetachInline (Func &&f) && |
Attach the final continuation func to *this and Detach *this. | |
template<typename Func > | |
void | Detach (IExecutor &e, Func &&f) && |
Attach the final continuation func to *this and Detach *this. | |
detail::ResultCorePtr< V, E > & | GetCore () noexcept |
Method that get internal Core state. | |
Protected Member Functions | |
FutureBase (detail::ResultCorePtr< V, E > core) noexcept | |
Protected Attributes | |
detail::ResultCorePtr< V, E > | _core |
Provides a mechanism to access the result of async operations.
Future and Promise are like a Single Producer/Single Consumer one-shot one-element channel. Use the Promise to fulfill the Future.
Definition at line 20 of file future.hpp.
|
delete |
|
defaultnoexcept |
|
defaultnoexcept |
|
inlinenoexcept |
If Future is Valid then call Stop.
Definition at line 42 of file future.hpp.
References yaclib::FutureBase< V, E >::Detach(), and yaclib::FutureBase< V, E >::Valid().
|
inlineexplicitprotectednoexcept |
Definition at line 184 of file future.hpp.
References yaclib::MakeContract().
Disable calling Stop in destructor.
Definition at line 141 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::MakeContract(), and yaclib::detail::MakeDrop().
Referenced by yaclib::FutureBase< V, E >::~FutureBase().
|
inline |
Attach the final continuation func to *this and Detach *this.
The func will be executed on the specified executor.
e | Executor which will Execute the continuation |
f | A continuation to be attached |
Definition at line 168 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::IExecutor::Inline, yaclib::MakeContract(), and YACLIB_WARN.
|
inline |
Attach the final continuation func to *this and Detach *this.
The func will be executed on Inline executor.
f | A continuation to be attached |
Definition at line 155 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, and yaclib::MakeContract().
|
inlinenoexcept |
Definition at line 92 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::MakeContract(), and yaclib::Wait().
|
inlinenoexcept |
Return copy of Result from Future.
If Ready is false return an empty Result. This method is thread-safe and can be called multiple times.
Definition at line 79 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, and yaclib::FutureBase< V, E >::Ready().
|
inlinenoexcept |
Method that get internal Core state.
Definition at line 179 of file future.hpp.
References yaclib::FutureBase< V, E >::_core.
|
delete |
|
defaultnoexcept |
|
inlinenoexcept |
Check that Result that corresponds to this Future is computed.
Definition at line 62 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::FutureBase< V, E >::Valid(), and YACLIB_ASSERT.
Referenced by yaclib::FutureBase< V, E >::Get(), yaclib::FutureBase< V, E >::Touch(), and yaclib::FutureBase< V, E >::Touch().
|
inline |
Attach the continuation func to *this.
The func will be executed on the specified executor.
e | Executor which will Execute the continuation |
f | A continuation to be attached |
Definition at line 132 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::IExecutor::Inline, yaclib::MakeContract(), and YACLIB_WARN.
|
inlinenoexcept |
Definition at line 116 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::MakeContract(), yaclib::FutureBase< V, E >::Ready(), and YACLIB_ASSERT.
|
inlinenoexcept |
Definition at line 105 of file future.hpp.
References yaclib::FutureBase< V, E >::_core, yaclib::FutureBase< V, E >::Ready(), and YACLIB_ASSERT.
|
inlinenoexcept |
Check if this Future has Promise.
Definition at line 53 of file future.hpp.
References yaclib::FutureBase< V, E >::_core.
Referenced by yaclib::FutureBase< V, E >::Ready(), TEST(), and yaclib::FutureBase< V, E >::~FutureBase().
|
protected |
Definition at line 187 of file future.hpp.
Referenced by yaclib::FutureBase< V, E >::Detach(), yaclib::FutureBase< V, E >::Detach(), yaclib::FutureBase< V, E >::DetachInline(), yaclib::FutureBase< V, E >::Get(), yaclib::FutureBase< V, E >::Get(), yaclib::FutureBase< V, E >::GetCore(), yaclib::FutureBase< V, E >::Ready(), yaclib::FutureBase< V, E >::Then(), yaclib::FutureBase< V, E >::Touch(), yaclib::FutureBase< V, E >::Touch(), and yaclib::FutureBase< V, E >::Valid().