![]() |
FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
|
Handle the tasks of an object. More...
#include <C_task.hpp>
Public Member Functions | |
| TaskHandler (TaskHandler const &r)=delete | |
| TaskHandler (TaskHandler &&r) noexcept | |
| TaskHandler & | operator= (TaskHandler const &r)=delete |
| TaskHandler & | operator= (TaskHandler &&r) noexcept=delete |
| void | setParentObject (fge::Object &parentObject) |
| Set the parent object of the TaskHandler. | |
| fge::Object * | getParentObject () const |
| std::size_t | getTaskSize () const |
| template<class T = fge::Task> | |
| T * | setMainTask (std::unique_ptr< T > &&newTask) |
| Set the main task. | |
| template<class T> | |
| T * | setMainTask () |
| template<class T, class... TArgs> | |
| T * | setMainTaskAndInit (TArgs &&... args) |
| template<class T = fge::Task> | |
| T * | addSubTask (std::unique_ptr< T > &&newTask) |
| Add a sub-task. | |
| template<class T> | |
| T * | addSubTask () |
| template<class T, class... TArgs> | |
| T * | addSubTaskAndInit (TArgs &&... args) |
| fge::Task * | getMainTask () const |
| fge::Task * | getActualTask () const |
| std::optional< fge::TaskTypeIndex > | getActualTaskType () const |
| void | popTask () |
| void | clearTasks () |
| fge::TaskList const & | getTasks () const |
| std::optional< fge::TaskTypeIndex > | getLastTask () const |
| void | clearLastTask () |
| void | networkRegister (fge::net::NetworkTypeHandler &netList) |
| Register the network types of the tasks. | |
| fge::TasksChecksum | getChecksum () const |
Public Attributes | |
| fge::CallbackHandler< TaskHandler & > | _onMainTaskChanged |
| Called when the main task is changed. | |
Handle the tasks of an object.
A TaskHandler is used to handle the tasks of an object. It can have multiple sub-tasks and one main task.
| T * fge::TaskHandler::addSubTask | ( | std::unique_ptr< T > && | newTask | ) |
Add a sub-task.
This function should be called when a task is present and a sub-task is required.
| T | The type of the task for convenience |
| newTask | The new task |
| void fge::TaskHandler::networkRegister | ( | fge::net::NetworkTypeHandler & | netList | ) |
Register the network types of the tasks.
This is a helper function that register the network type using the NetworkTypeTasks class. It should be called inside the Object::networkRegister() function.
| netList | The network type container |
| T * fge::TaskHandler::setMainTask | ( | std::unique_ptr< T > && | newTask | ) |
Set the main task.
All tasks is cleared before setting the new main task.
| T | The type of the task for convenience |
| newTask | The new task |
| void fge::TaskHandler::setParentObject | ( | fge::Object & | parentObject | ) |
Set the parent object of the TaskHandler.
All created tasks will have this object as parent.
| parentObject | The parent object |
| fge::CallbackHandler<TaskHandler&> fge::TaskHandler::_onMainTaskChanged |
Called when the main task is changed.