Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches

Handle to an asynchronous task managed by the Executor. More...

#include <async_task.hpp>

Public Member Functions

 AsyncTask ()=default
 AsyncTask (const AsyncTask &)=default
 AsyncTask (AsyncTask &&) noexcept=default
 ~AsyncTask ()=default
AsyncTaskoperator= (const AsyncTask &)=default
AsyncTaskoperator= (AsyncTask &&) noexcept=default
void Reset ()
 Resets the underlying asynchronous task handle.
bool operator== (const AsyncTask &other) const noexcept
bool operator!= (const AsyncTask &other) const noexcept
bool Done () const
 Checks if the asynchronous task has completed.
bool Empty () const
 Checks if the task handle is empty (not associated with any task).
size_t Hash () const
 Returns a hash value for the task.
size_t UseCount () const
 Returns the number of references to the underlying task.

Static Public Member Functions

static constexpr TaskType GetTaskType () noexcept
 Gets the type of the task.

Friends

class Executor
class SubTaskGraph

Detailed Description

Handle to an asynchronous task managed by the Executor.

Wraps a tf::AsyncTask, providing methods to query task state and manage its lifecycle. Instances are typically returned by Executor's asynchronous methods.

Note
Thread-safe.

Definition at line 19 of file async_task.hpp.

Constructor & Destructor Documentation

◆ AsyncTask() [1/3]

helios::async::AsyncTask::AsyncTask ( )
default

◆ AsyncTask() [2/3]

helios::async::AsyncTask::AsyncTask ( const AsyncTask & )
default

◆ AsyncTask() [3/3]

helios::async::AsyncTask::AsyncTask ( AsyncTask && )
defaultnoexcept

◆ ~AsyncTask()

helios::async::AsyncTask::~AsyncTask ( )
default

Member Function Documentation

◆ Done()

bool helios::async::AsyncTask::Done ( ) const
inlinenodiscard

Checks if the asynchronous task has completed.

Returns
True if the task is done, false otherwise.

Returns false if task is empty.

Definition at line 89 of file async_task.hpp.

◆ Empty()

bool helios::async::AsyncTask::Empty ( ) const
inlinenodiscard

Checks if the task handle is empty (not associated with any task).

Returns
True if empty, false otherwise.

Definition at line 51 of file async_task.hpp.

◆ GetTaskType()

constexpr TaskType helios::async::AsyncTask::GetTaskType ( )
inlinestaticnodiscardconstexprnoexcept

Gets the type of the task.

Returns
TaskType::Async

Definition at line 71 of file async_task.hpp.

◆ Hash()

size_t helios::async::AsyncTask::Hash ( ) const
inlinenodiscard

Returns a hash value for the task.

Returns
Hash value.

Returns '0' if task is empty.

Definition at line 97 of file async_task.hpp.

◆ operator!=()

bool helios::async::AsyncTask::operator!= ( const AsyncTask & other) const
inlinenoexcept

Definition at line 36 of file async_task.hpp.

◆ operator=() [1/2]

AsyncTask & helios::async::AsyncTask::operator= ( AsyncTask && )
defaultnoexcept

◆ operator=() [2/2]

AsyncTask & helios::async::AsyncTask::operator= ( const AsyncTask & )
default

◆ operator==()

bool helios::async::AsyncTask::operator== ( const AsyncTask & other) const
inlinenoexcept

Definition at line 32 of file async_task.hpp.

◆ Reset()

void helios::async::AsyncTask::Reset ( )
inline

Resets the underlying asynchronous task handle.

Definition at line 30 of file async_task.hpp.

◆ UseCount()

size_t helios::async::AsyncTask::UseCount ( ) const
inlinenodiscard

Returns the number of references to the underlying task.

Returns
Reference count.

Returns '0' if task is empty.

Definition at line 65 of file async_task.hpp.

◆ Executor

friend class Executor
friend

Definition at line 85 of file async_task.hpp.

◆ SubTaskGraph

friend class SubTaskGraph
friend

Definition at line 86 of file async_task.hpp.