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 () &&noexcept
 
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::UniqueCorePtr< V, E > & GetCore () noexcept
 Method that get internal Core state.
 
 Task (detail::UniqueCorePtr< 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 40 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::UniqueCorePtr< V, E core)
inlinenoexcept

Definition at line 142 of file task.hpp.

Member Function Documentation

◆ Cancel()

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

Definition at line 88 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 116 of file task.hpp.

◆ GetCore()

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

Method that get internal Core state.

Returns
internal Core state ptr

Definition at line 139 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 65 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 55 of file task.hpp.

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

Referenced by yaclib::Task< V, E >::Then(), yaclib::Task< V, E >::Then(), yaclib::Task< V, E >::ThenInline(), 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 82 of file task.hpp.

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

◆ 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 70 of file task.hpp.

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

◆ ThenInline()

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

Definition at line 76 of file task.hpp.

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

◆ ToFuture() [1/2]

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

Definition at line 105 of file task.hpp.

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

◆ ToFuture() [2/2]

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

◆ Touch() [1/4]

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

Definition at line 128 of file task.hpp.

References 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 124 of file task.hpp.

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

◆ Valid()


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