17#ifndef _FGE_TASK_MANAGER_HPP_INCLUDED
18#define _FGE_TASK_MANAGER_HPP_INCLUDED
20#include "FastEngine/fge_extern.hpp"
30using TaskTypeIndex = uint16_t;
35 TaskTypeBase() =
default;
36 TaskTypeBase(TaskTypeBase
const& r) =
delete;
37 TaskTypeBase(TaskTypeBase&& r)
noexcept =
delete;
38 virtual ~TaskTypeBase() =
default;
40 TaskTypeBase& operator=(TaskTypeBase
const& r) =
delete;
41 TaskTypeBase& operator=(TaskTypeBase&& r)
noexcept =
delete;
43 [[nodiscard]]
virtual fge::Task* createTask()
const = 0;
44 [[nodiscard]]
virtual std::type_info
const& getType()
const = 0;
48class TaskType :
public TaskTypeBase
52 ~TaskType()
override =
default;
54 [[nodiscard]]
inline fge::Task* createTask()
const override {
return new T(); }
55 [[nodiscard]]
inline std::type_info
const& getType()
const override {
return typeid(T); }
69FGE_API std::optional<fge::TaskTypeIndex> RegisterNewTask(std::unique_ptr<fge::TaskTypeBase> taskType);
71inline std::optional<fge::TaskTypeIndex> RegisterNewTask()
81[[nodiscard]] FGE_API
fge::Task* CreateNewTask(fge::TaskTypeIndex index);
88[[nodiscard]] FGE_API std::optional<fge::TaskTypeIndex> GetTaskIndex(std::type_info
const& type);
Definition task_manager.hpp:49
Base class for all tasks.
Definition C_task.hpp:107