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

The base class to derive a system from: a System whose signature is the list of component types given as template arguments. More...

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

Inheritance diagram for guillaume::ecs::SystemFiller< ComponentTypes >:
Collaboration diagram for guillaume::ecs::SystemFiller< ComponentTypes >:

Public Member Functions

 SystemFiller (Phase phase)
 Create the system and set its signature from ComponentTypes.
virtual ~SystemFiller (void)=default
 Virtual destructor.
Public Member Functions inherited from guillaume::ecs::System
 System (Phase phase)
 Create a system that runs in a given phase, with an empty signature.
virtual ~System (void)=default
 Virtual destructor.
Phase getPhase (void) const noexcept
 Get the phase of the frame in which the system runs.
Entity::Signature getSignature (void) const noexcept
 Get the component types an entity must declare to be visited by this system.
void routine (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry, const ecs::EntityTreeTraveler &traveler)
 Run the system once over a scene: prepare(), update() on each matching entity, cleanup().
void bindComponentRegistry (ecs::ComponentRegistry &componentRegistry)
 Bind a component registry so update() can be called directly, without routine().
void unbindComponentRegistry (void)
 Drop the binding made by bindComponentRegistry().
virtual void update (const ecs::Entity::Identifier &entityIdentifier)=0
 Apply the system's rule to one entity. Implemented by each system.
virtual void prepare (void)
 Called once per pass, before the first update().
virtual void cleanup (void)
 Called once per pass, after the last update().

Additional Inherited Members

Protected Member Functions inherited from guillaume::ecs::System
template<InheritFromComponent... ComponentTypes>
void setSignature (void)
 Replace the signature by the one made of the given component types.
ecs::EntityRegistry & getEntityRegistry (void)
 Get the entity registry of the scene being processed.
const ecs::EntityRegistry & getEntityRegistry (void) const
 Get the entity registry of the scene being processed, read-only.
ecs::ComponentRegistry & getComponentRegistry (void)
 Get the component registry of the scene being processed.
const ecs::ComponentRegistry & getComponentRegistry (void) const
 Get the component registry of the scene being processed, read-only.
template<InheritFromComponent ComponentType>
bool hasComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Tell whether an entity has a component, in the bound registry.
template<InheritFromComponent ComponentType>
ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier)
 Get a component of an entity from the bound registry, to read or modify it.
template<InheritFromComponent ComponentType>
const ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Get a component of an entity from the bound registry, read-only.
template<InheritFromComponent ComponentType>
bool requireComponent (const ecs::Entity::Identifier &entityIdentifier)
 Tell whether an entity has a component, and log a warning naming the entity and the component when it does not.

Detailed Description

template<InheritFromComponent... ComponentTypes>
class guillaume::ecs::SystemFiller< ComponentTypes >

The base class to derive a system from: a System whose signature is the list of component types given as template arguments.

The list answers "which entities does this system run on?": update() is called for every entity of the scene that declares all the listed components. List the components the system cannot work without; check the optional ones in update() with hasComponent().

// Runs in the Measure phase on every entity that has both a
// Transform and a Bound.
class Snap:
public ecs::SystemFiller<components::Transform, components::Bound>
{
public:
Snap(void)
: ecs::SystemFiller<components::Transform, components::Bound>(
{
}
void update(const ecs::Entity::Identifier &identifier) override;
};
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
Definition entity.hpp:86
The base class to derive a system from: a System whose signature is the list of component types given...
SystemFiller(Phase phase)
Create the system and set its signature from ComponentTypes.
virtual void update(const ecs::Entity::Identifier &entityIdentifier)=0
Apply the system's rule to one entity. Implemented by each system.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Definition component.hpp:28
Phase
The four steps of a frame. Every system belongs to one of them.
Template Parameters
ComponentTypesThe component types an entity must declare to be visited. An empty list makes the system visit every entity.
See also
System
Phase

Definition at line 62 of file system_filler.hpp.

Constructor & Destructor Documentation

◆ SystemFiller()

template<InheritFromComponent... ComponentTypes>
guillaume::ecs::SystemFiller< ComponentTypes >::SystemFiller ( Phase phase)

Create the system and set its signature from ComponentTypes.

Parameters
phaseThe phase of the frame in which the system runs.

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