|
R-Type
Distributed multiplayer game engine in C++
|
Advanced scheduler for controlling system execution order and dependencies. More...
#include <SystemScheduler.hpp>

Classes | |
| struct | SystemInfo |
| Information about a scheduled system. More... | |
Public Member Functions | |
| SystemScheduler (ECSWorld *world) | |
| Construct a SystemScheduler. | |
| SystemScheduler & | registerSystem (const std::string &name, int priority=0) |
| Register a system with the scheduler. | |
| SystemScheduler & | runBefore (const std::string &systemName, const std::string &afterSystemName) |
| Specify that a system must run before another. | |
| SystemScheduler & | runAfter (const std::string &systemName, const std::string &beforeSystemName) |
| Specify that a system must run after another. | |
| void | enable (const std::string &name) |
| Enable a system. | |
| void | disable (const std::string &name) |
| Disable a system. | |
| bool | isEnabled (const std::string &name) const |
| Check if a system is enabled. | |
| void | update (float deltaTime) |
| Update all enabled systems in the scheduled order. | |
| const std::vector< std::string > & | getExecutionOrder () const |
| Get the computed execution order. | |
| void | printExecutionOrder () const |
| Print the execution order for debugging. | |
Private Member Functions | |
| void | computeExecutionOrder () |
| void | topologicalSort () |
Private Attributes | |
| ECSWorld * | _world |
| std::unordered_map< std::string, SystemInfo > | _systemInfos |
| std::vector< std::string > | _executionOrder |
| bool | _needsReorder |
Advanced scheduler for controlling system execution order and dependencies.
Allows defining execution stages, priorities, and dependencies between systems. Useful for complex server-side game logic with specific ordering requirements.
Definition at line 27 of file SystemScheduler.hpp.
|
explicit |
Construct a SystemScheduler.
| world | Pointer to the ECS world |
Definition at line 14 of file SystemScheduler.cpp.
|
private |
Definition at line 76 of file SystemScheduler.cpp.
References _executionOrder, _needsReorder, _systemInfos, and topologicalSort().
Referenced by update().

| void ecs::wrapper::SystemScheduler::disable | ( | const std::string & | name | ) |
Disable a system.
| name | System name |
Definition at line 61 of file SystemScheduler.cpp.
References _systemInfos.
| void ecs::wrapper::SystemScheduler::enable | ( | const std::string & | name | ) |
Enable a system.
| name | System name |
Definition at line 54 of file SystemScheduler.cpp.
References _systemInfos.
| const std::vector< std::string > & ecs::wrapper::SystemScheduler::getExecutionOrder | ( | ) | const |
Get the computed execution order.
Definition at line 186 of file SystemScheduler.cpp.
References _executionOrder.
| bool ecs::wrapper::SystemScheduler::isEnabled | ( | const std::string & | name | ) | const |
Check if a system is enabled.
| name | System name |
Definition at line 68 of file SystemScheduler.cpp.
References _systemInfos.
| void ecs::wrapper::SystemScheduler::printExecutionOrder | ( | ) | const |
Print the execution order for debugging.
Definition at line 190 of file SystemScheduler.cpp.
References _executionOrder, and _systemInfos.
| SystemScheduler & ecs::wrapper::SystemScheduler::registerSystem | ( | const std::string & | name, |
| int | priority = 0 |
||
| ) |
Register a system with the scheduler.
| name | System name |
| priority | Execution priority (higher = earlier) |
Definition at line 16 of file SystemScheduler.cpp.
References _needsReorder, _systemInfos, ecs::wrapper::SystemScheduler::SystemInfo::enabled, ecs::wrapper::SystemScheduler::SystemInfo::name, and ecs::wrapper::SystemScheduler::SystemInfo::priority.
| SystemScheduler & ecs::wrapper::SystemScheduler::runAfter | ( | const std::string & | systemName, |
| const std::string & | beforeSystemName | ||
| ) |
Specify that a system must run after another.
| systemName | The system that runs second |
| beforeSystemName | The system that runs before |
Definition at line 41 of file SystemScheduler.cpp.
References _needsReorder, _systemInfos, and LOG_ERROR.
| SystemScheduler & ecs::wrapper::SystemScheduler::runBefore | ( | const std::string & | systemName, |
| const std::string & | afterSystemName | ||
| ) |
Specify that a system must run before another.
| systemName | The system that runs first |
| afterSystemName | The system that runs after |
Definition at line 28 of file SystemScheduler.cpp.
References _needsReorder, _systemInfos, and LOG_ERROR.
|
private |
Definition at line 100 of file SystemScheduler.cpp.
References _executionOrder, _systemInfos, and LOG_WARNING.
Referenced by computeExecutionOrder().
| void ecs::wrapper::SystemScheduler::update | ( | float | deltaTime | ) |
Update all enabled systems in the scheduled order.
| deltaTime | Time elapsed since last update |
Definition at line 173 of file SystemScheduler.cpp.
References _executionOrder, _needsReorder, _systemInfos, _world, computeExecutionOrder(), and ecs::wrapper::ECSWorld::updateSystem().

|
private |
Definition at line 44 of file SystemScheduler.hpp.
Referenced by computeExecutionOrder(), getExecutionOrder(), printExecutionOrder(), topologicalSort(), and update().
|
private |
Definition at line 45 of file SystemScheduler.hpp.
Referenced by computeExecutionOrder(), registerSystem(), runAfter(), runBefore(), and update().
|
private |
Definition at line 43 of file SystemScheduler.hpp.
Referenced by computeExecutionOrder(), disable(), enable(), isEnabled(), printExecutionOrder(), registerSystem(), runAfter(), runBefore(), topologicalSort(), and update().
|
private |
Definition at line 42 of file SystemScheduler.hpp.
Referenced by update().