guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::ecs::SystemRegistry Class Reference

Owns the systems of an application, grouped by phase and kept in registration order. More...

#include <headers/guillaume/ecs/system_registry.hpp>

Inheritance diagram for guillaume::ecs::SystemRegistry:
Collaboration diagram for guillaume::ecs::SystemRegistry:

Public Member Functions

 SystemRegistry (void)=default
 Create a registry with no system.
 ~SystemRegistry (void)=default
 Destroy the registry and the systems it owns.
void registerNewSystem (std::unique_ptr< System > system)
 Take ownership of a system and append it to the list of its phase (System::getPhase).
const std::vector< std::unique_ptr< System > > & getSystemsByPhase (Phase phase) const
 Get the systems of a phase, in the order they run.

Detailed Description

Owns the systems of an application, grouped by phase and kept in registration order.

Application has one registry, filled once at start-up by systems::registerCoreSystems, and shared by every scene. Each frame, for each phase, Application::routine runs the systems returned by getSystemsByPhase() in order.

systems.registerNewSystem(std::make_unique<MySystem>());
for (const auto &system:
systems.getSystemsByPhase(ecs::Phase::Layout)) {
system->routine(componentRegistry, entityRegistry, traveler);
}
Owns the systems of an application, grouped by phase and kept in registration order.
Rules. Every class here runs each frame on the entities that have the components it declares.
Note
Within a phase, registration order is execution order. When a system needs what another system of the same phase produces in the same frame, register that other system first.
See also
System
Phase

Definition at line 67 of file system_registry.hpp.

Member Function Documentation

◆ getSystemsByPhase()

const std::vector< std::unique_ptr< System > > & guillaume::ecs::SystemRegistry::getSystemsByPhase ( Phase phase) const

Get the systems of a phase, in the order they run.

Parameters
phaseThe phase to list.
Returns
Reference to the list, in registration order; empty when no system is registered for the phase. It stays valid as long as the registry, and grows when a system is registered.
Exceptions
std::out_of_rangeWhen phase is not one of the four phases (Phase::Count, for instance).

Definition at line 41 of file system_registry.cpp.

◆ registerNewSystem()

void guillaume::ecs::SystemRegistry::registerNewSystem ( std::unique_ptr< System > system)

Take ownership of a system and append it to the list of its phase (System::getPhase).

Nothing prevents registering two systems of the same type: both are kept and both run.

Parameters
systemThe system to add. Must not be null.
Exceptions
std::out_of_rangeWhen the phase of the system is not one of the four phases (Phase::Count, for instance).

Definition at line 30 of file system_registry.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: