YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib::Task< V, E > Class Template Reference

Provides a mechanism to schedule the some async operations TODO(MBkkt) add description. More...

#include <task.hpp>

Public Member Functions

 Task (const Task &)=delete
 
Taskoperator= (const Task &)=delete
 
 Task (Task &&other) noexcept=default
 
Taskoperator= (Task &&other) noexcept=default
 
 Task () noexcept=default
 
 ~Task () noexcept
 
bool Valid () const &noexcept
 
bool Ready () const &noexcept
 Check that Result that corresponds to this Task is computed.
 
Task< V, EOn (std::nullptr_t) &&noexcept
 Do nothing, just for compatibility with FutureOn TODO(MBkkt) think about force On/Detach/ToFuture: It's able to set passed executor to previous nullptr/all/head/etc or replace.
 
template<typename Func >
auto Then (IExecutor &e, Func &&f) &&
 
template<typename Func >
auto ThenInline (Func &&f) &&
 
template<typename Func >
auto Then (Func &&f) &&
 
void Cancel () &&
 
void Detach () &&noexcept
 
void Detach (IExecutor &e) &&noexcept
 
Future< V, EToFuture () &&noexcept
 
FutureOn< V, EToFuture (IExecutor &e) &&noexcept
 
Result< V, EGet () &&noexcept
 
void Touch () &=delete
 
void Touch () const &&=delete
 
const Result< V, E > & Touch () const &noexcept
 
Result< V, ETouch () &&noexcept
 
detail::ResultCorePtr< V, E > & GetCore () noexcept
 Method that get internal Core state.
 
 Task (detail::ResultCorePtr< V, E > core) noexcept
 

Detailed Description

template<typename V, typename E>
class yaclib::Task< V, E >

Provides a mechanism to schedule the some async operations TODO(MBkkt) add description.

Definition at line 25 of file task.hpp.

Constructor & Destructor Documentation

◆ Task() [1/4]

template<typename V , typename E >
yaclib::Task< V, E >::Task ( const Task< V, E > &  )
delete

◆ Task() [2/4]

template<typename V , typename E >
yaclib::Task< V, E >::Task ( Task< V, E > &&  other)
defaultnoexcept

◆ Task() [3/4]

template<typename V , typename E >
yaclib::Task< V, E >::Task ( )
defaultnoexcept

◆ ~Task()

template<typename V , typename E >
yaclib::Task< V, E >::~Task ( )
inlinenoexcept

Definition at line 38 of file task.hpp.

References yaclib::Task< V, E >::Cancel(), and yaclib::Task< V, E >::Valid().

◆ Task() [4/4]

template<typename V , typename E >
yaclib::Task< V, E >::Task ( detail::ResultCorePtr< V, E core)
inlinenoexcept

Definition at line 134 of file task.hpp.

References yaclib::MakeContract().

Member Function Documentation

◆ Cancel()

template<typename V , typename E >
void yaclib::Task< V, E >::Cancel ( ) &&
inline

Definition at line 82 of file task.hpp.

References yaclib::MakeContract(), and yaclib::MakeInline().

Referenced by yaclib::Task< V, E >::~Task().

◆ Detach() [1/2]

template<typename V , typename E >
void yaclib::Task< V, E >::Detach ( ) &&
inlinenoexcept

◆ Detach() [2/2]

template<typename V , typename E >
void yaclib::Task< V, E >::Detach ( IExecutor e) &&
inlinenoexcept

◆ Get()

template<typename V , typename E >
Result< V, E > yaclib::Task< V, E >::Get ( ) &&
inlinenoexcept

Definition at line 108 of file task.hpp.

◆ GetCore()

template<typename V , typename E >
detail::ResultCorePtr< V, E > & yaclib::Task< V, E >::GetCore ( )
inlinenoexcept

Method that get internal Core state.

Returns
internal Core state ptr

Definition at line 131 of file task.hpp.

◆ On()

template<typename V , typename E >
Task< V, E > yaclib::Task< V, E >::On ( std::nullptr_t  ) &&
inlinenoexcept

Do nothing, just for compatibility with FutureOn TODO(MBkkt) think about force On/Detach/ToFuture: It's able to set passed executor to previous nullptr/all/head/etc or replace.

Definition at line 63 of file task.hpp.

◆ operator=() [1/2]

template<typename V , typename E >
Task & yaclib::Task< V, E >::operator= ( const Task< V, E > &  )
delete

◆ operator=() [2/2]

template<typename V , typename E >
Task & yaclib::Task< V, E >::operator= ( Task< V, E > &&  other)
defaultnoexcept

◆ Ready()

template<typename V , typename E >
bool yaclib::Task< V, E >::Ready ( ) const &
inlinenoexcept

Check that Result that corresponds to this Task is computed.

Returns
false if the Result of this Task is not computed yet, otherwise true

Definition at line 53 of file task.hpp.

References yaclib::Task< V, E >::Valid(), and YACLIB_ASSERT.

Referenced by yaclib::Task< V, E >::Touch(), and yaclib::Task< V, E >::Touch().

◆ Then() [1/2]

template<typename V , typename E >
template<typename Func >
auto yaclib::Task< V, E >::Then ( Func &&  f) &&
inline

Definition at line 77 of file task.hpp.

References yaclib::MakeContract().

◆ Then() [2/2]

template<typename V , typename E >
template<typename Func >
auto yaclib::Task< V, E >::Then ( IExecutor e,
Func &&  f 
) &&
inline

Definition at line 68 of file task.hpp.

References yaclib::MakeContract().

◆ ThenInline()

template<typename V , typename E >
template<typename Func >
auto yaclib::Task< V, E >::ThenInline ( Func &&  f) &&
inline

Definition at line 72 of file task.hpp.

References yaclib::MakeContract().

◆ ToFuture() [1/2]

template<typename V , typename E >
Future< V, E > yaclib::Task< V, E >::ToFuture ( ) &&
inlinenoexcept

Definition at line 99 of file task.hpp.

References yaclib::detail::Start().

◆ ToFuture() [2/2]

template<typename V , typename E >
FutureOn< V, E > yaclib::Task< V, E >::ToFuture ( IExecutor e) &&
inlinenoexcept

Definition at line 103 of file task.hpp.

References yaclib::MakeContract(), and yaclib::detail::Start().

◆ Touch() [1/4]

template<typename V , typename E >
Result< V, E > yaclib::Task< V, E >::Touch ( ) &&
inlinenoexcept

Definition at line 120 of file task.hpp.

References yaclib::MakeContract(), yaclib::Task< V, E >::Ready(), and YACLIB_ASSERT.

◆ Touch() [2/4]

template<typename V , typename E >
void yaclib::Task< V, E >::Touch ( ) &
delete

◆ Touch() [3/4]

template<typename V , typename E >
void yaclib::Task< V, E >::Touch ( ) const &&
delete

◆ Touch() [4/4]

template<typename V , typename E >
const Result< V, E > & yaclib::Task< V, E >::Touch ( ) const &
inlinenoexcept

Definition at line 116 of file task.hpp.

References yaclib::Task< V, E >::Ready(), and YACLIB_ASSERT.

◆ Valid()

template<typename V , typename E >
bool yaclib::Task< V, E >::Valid ( ) const &
inlinenoexcept

The documentation for this class was generated from the following files: