![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Singleton registry for atomic task factories. More...
#include <string>#include <unordered_map>#include <functional>#include <memory>#include "IAtomicTask.h"
Include dependency graph for AtomicTaskRegistry.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| class | Olympe::AtomicTaskRegistry |
| Singleton registry mapping task IDs to factory functions. More... | |
Namespaces | |
| namespace | Olympe |
| < Provides AssetID and INVALID_ASSET_ID | |
Macros | |
| #define | REGISTER_ATOMIC_TASK(ClassName, Id) |
| Registers a factory for ClassName under Id at static init time. | |
Singleton registry for atomic task factories.
AtomicTaskRegistry stores factory functions keyed by a string task ID. Call Register() to associate a factory with an ID, and Create() to instantiate a task by ID.
The REGISTER_ATOMIC_TASK(ClassName, Id) macro registers a factory at static initialization time so that every translation unit that includes the concrete task's .cpp file automatically populates the registry.
C++14 compliant - no C++17/20 features.
Definition in file AtomicTaskRegistry.h.
Registers a factory for ClassName under Id at static init time.
Place this macro in the .cpp file of your concrete task class (outside any namespace or function):
The macro creates a file-scope object whose constructor calls AtomicTaskRegistry::Get().Register(), ensuring registration happens before main() is entered.
Definition at line 119 of file AtomicTaskRegistry.h.