Manages the registration, update, and shutdown of systems.
More...
#include <System.h>
Manages the registration, update, and shutdown of systems.
SystemManager is a singleton that dynamically registers systems using a unique identifier. It supports both systems running in the main loop and those running on dedicated threads.
◆ SystemManager() [1/2]
| Raven::SystemManager::SystemManager |
( |
| ) |
|
|
default |
◆ ~SystemManager()
| Raven::SystemManager::~SystemManager |
( |
| ) |
|
|
default |
◆ SystemManager() [2/2]
◆ DispatchEvent()
| void Raven::SystemManager::DispatchEvent |
( |
Event & | e | ) |
|
Dispatches an event to all registered systems' OnEvent functions.
This method will iterate over all systems and forward the event to their respective OnEvent function, allowing systems to react to events.
- Parameters
-
◆ operator=()
◆ RegisterSystem()
template<typename T, typename... Args>
| void Raven::SystemManager::RegisterSystem |
( |
bool | dedicated, |
|
|
const std::string & | id, |
|
|
Args &&... | args ) |
|
inline |
Registers a new system of type T.
Dynamically allocates the system and wraps it in a SystemHolder. The system is identified by a unique string and can optionally be run on a dedicated thread.
- Template Parameters
-
| T | The system type. |
| Args | Constructor argument types for the system. |
- Parameters
-
| dedicated | If true, the system will run on its own thread. |
| id | A unique string identifier for the system. |
| args | Arguments forwarded to the system's constructor. |
◆ ShutdownAll()
| void Raven::SystemManager::ShutdownAll |
( |
| ) |
|
Shuts down all registered systems.
Signals each system to stop running by setting Running to false, calls the system's Shutdown function, joins dedicated threads if necessary, and destroys the system instance. Finally, clears the systems map.
◆ ShutdownSystem()
| bool Raven::SystemManager::ShutdownSystem |
( |
const std::string & | id | ) |
|
Shuts down a specific system identified by its unique ID.
If the system is found, it stops its execution, cleans up its resources, and removes it from the systems map.
- Parameters
-
| id | The unique identifier of the system to shut down. |
- Returns
- true if the system was found and shut down, false otherwise.
◆ UpdateAll()
| void Raven::SystemManager::UpdateAll |
( |
float | ts | ) |
|
Updates all non-dedicated systems.
This function should be called from the main loop to update systems that are not running on a dedicated thread.
The documentation for this class was generated from the following files: