Nugget
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
psyqo::TaskQueue::Task Class Reference

The Task class. More...

#include <psyqo/task.hh>

Public Member Functions

 Task (eastl::function< void(Task *)> &&fun)
 Construct a new Task object.
 
 Task (Task &&)=default
 
 Task (const Task &)=delete
 
Taskoperator= (Task &&)=default
 
Taskoperator= (const Task &)=delete
 
void resolve ()
 Resolves this task.
 
void reject ()
 Rejects this task.
 
void complete (bool success)
 Resolves or rejects this task.
 

Friends

class TaskQueue
 

Detailed Description

The Task class.

This class is the holder for a task to execute within the queue. It can be constructed with a lambda, or be moved. It effectively acts as a promise, but without data attached to it.

Constructor & Destructor Documentation

◆ Task() [1/3]

psyqo::TaskQueue::Task::Task ( eastl::function< void(Task *)> &&  fun)
inlineexplicit

Construct a new Task object.

Parameters
funThe lambda to execute for this task. It will receive the task as its argument.

◆ Task() [2/3]

psyqo::TaskQueue::Task::Task ( Task &&  )
default

◆ Task() [3/3]

psyqo::TaskQueue::Task::Task ( const Task )
delete

Member Function Documentation

◆ complete()

void psyqo::TaskQueue::Task::complete ( bool  success)
inline

Resolves or rejects this task.

This method is to be called by the task's lambda function to resolve or reject the task. It is a convenience method that will either call resolve() or reject() depending on the value of the first argument.

◆ operator=() [1/2]

Task & psyqo::TaskQueue::Task::operator= ( const Task )
delete

◆ operator=() [2/2]

Task & psyqo::TaskQueue::Task::operator= ( Task &&  )
default

◆ reject()

void psyqo::TaskQueue::Task::reject ( )
inline

Rejects this task.

This method is to be called by the task's lambda function to reject the task. It will call the exception handler, and then the finally handler.

◆ resolve()

void psyqo::TaskQueue::Task::resolve ( )
inline

Resolves this task.

This method is to be called by the task's lambda function to resolve the task. It will continue to the next task in the queue, or call the finally handler if there are no more tasks.

Friends And Related Symbol Documentation

◆ TaskQueue

friend class TaskQueue
friend

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