22#include <unordered_map>
50 using FactoryFn = std::function<std::unique_ptr<IAtomicTask>()>;
73 std::unique_ptr<IAtomicTask>
Create(
const std::string&
id)
const;
119#define REGISTER_ATOMIC_TASK(ClassName, Id) \
121 struct ClassName##_Registrar { \
122 ClassName##_Registrar() { \
123 ::Olympe::AtomicTaskRegistry::Get().Register( \
125 []() -> std::unique_ptr<::Olympe::IAtomicTask> { \
126 return std::unique_ptr<::Olympe::IAtomicTask>( \
131 static ClassName##_Registrar s_##ClassName##_registrar; \
ComponentTypeID GetComponentTypeID_Static()
Interface for atomic tasks in the Atomic Task System.
Singleton registry mapping task IDs to factory functions.
std::vector< std::string > GetAllTaskIDs() const
Returns a vector of all registered task IDs.
AtomicTaskRegistry()=default
bool IsRegistered(const std::string &id) const
Returns true if a factory is registered for id.
std::unique_ptr< IAtomicTask > Create(const std::string &id) const
Creates a new instance of the task identified by id.
static AtomicTaskRegistry & Get()
Returns the singleton instance.
std::unordered_map< std::string, FactoryFn > m_factories
void Register(const std::string &id, FactoryFn factory)
Registers a factory function under the given task ID.
std::function< std::unique_ptr< IAtomicTask >()> FactoryFn
Factory function type: returns a heap-allocated IAtomicTask.
< Provides AssetID and INVALID_ASSET_ID