Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
PS::Loader::Task Class Reference

Coroutine which performs the actual work. More...

#include <Loader.h>

Classes

class  promise_type
 

Public Member Functions

 Task (const Task &)=delete
 
Task & operator= (const Task &)=delete
 
 Task (Task &&other) noexcept
 
Task & operator= (Task &&other) noexcept
 
 ~Task ()
 
double GetProgress () const noexcept
 
void Step (const double timeBudget)
 
bool IsDone () const noexcept
 
int Get () const noexcept
 

Private Member Functions

 Task (std::coroutine_handle< promise_type > h) noexcept
 

Private Attributes

std::coroutine_handle< promise_type > m_Handle
 

Detailed Description

Coroutine which performs the actual work.

co_yield ... can be used to yield the current progress. Iff the timeout is reached, the coroutine suspends. co_await std::suspend_always{} is usefull to force a suspention. e.g. When no progress can be made such as when the work is done on a different thread. co_return 0 notifies the loader that the task is fineshed without an error. co_return ... when the returned value is negative the loader interprets that as a task failure. PS::Loader::ProgressiveLoad will abort immediately and forward the error code.

Constructor & Destructor Documentation

◆ Task() [1/3]

PS::Loader::Task::Task ( const Task &  )
delete

◆ Task() [2/3]

PS::Loader::Task::Task ( Task &&  other)
inlinenoexcept

◆ ~Task()

PS::Loader::Task::~Task ( )
inline

◆ Task() [3/3]

PS::Loader::Task::Task ( std::coroutine_handle< promise_type >  h)
inlineexplicitprivatenoexcept

Member Function Documentation

◆ Get()

int PS::Loader::Task::Get ( ) const
inlinenoexcept

◆ GetProgress()

double PS::Loader::Task::GetProgress ( ) const
inlinenoexcept

◆ IsDone()

bool PS::Loader::Task::IsDone ( ) const
inlinenoexcept

◆ operator=() [1/2]

Task & PS::Loader::Task::operator= ( const Task &  )
delete

◆ operator=() [2/2]

Task & PS::Loader::Task::operator= ( Task &&  other)
inlinenoexcept

◆ Step()

void PS::Loader::Task::Step ( const double  timeBudget)
inline

Member Data Documentation

◆ m_Handle

std::coroutine_handle<promise_type> PS::Loader::Task::m_Handle
private

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