ECSTASY
All in the name
Loading...
Searching...
No Matches
ecstasy::Pipeline::Phase Class Reference

A phase in the pipeline. More...

#include <Pipeline.hpp>

Collaboration diagram for ecstasy::Pipeline::Phase:

Public Member Functions

void run ()
 Run all systems in this phase.
 
constexpr std::size_t getSize () const noexcept
 Get the number of systems in this phase.
 
constexpr PhaseId getId () const noexcept
 Get the phase ID.
 
SystemIterator begin () const noexcept
 Get the iterator to the first system in this phase.
 
SystemIterator end () const noexcept
 Get the iterator past the last system in this phase.
 
constexpr TimergetTimer () noexcept
 Get the phase timer.
 
constexpr const TimergetTimer () const noexcept
 Get the phase timer.
 

Private Member Functions

 Phase (Pipeline &pipeline, PhaseId id)
 Construct a new empty Phase object.
 
constexpr std::size_t begin_idx () const
 Get the index of the first system in this phase.
 
constexpr std::size_t end_idx () const
 Get the index past the last system in this phase.
 

Private Attributes

Pipeline_pipeline
 Owning pipeline.
 
std::size_t _begin
 Index of the first system in this phase.
 
std::size_t _size
 Number of systems in this phase.
 
PhaseId _id
 Identifier of the phase.
 
Timer _timer
 Timer to control the execution of the phase.
 
friend Pipeline
 Allow Pipeline to access the private members.
 

Detailed Description

A phase in the pipeline.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 66 of file Pipeline.hpp.

Constructor & Destructor Documentation

◆ Phase()

ecstasy::Pipeline::Phase::Phase ( Pipeline pipeline,
PhaseId  id 
)
inlineprivate

Construct a new empty Phase object.

Note
This constructor is private, use the Pipeline::getPhase() method to get a phase.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 76 of file Pipeline.hpp.

76 : _pipeline(pipeline), _begin(), _size(0), _id(id)
77 {
78 }
std::size_t _begin
Index of the first system in this phase.
Definition Pipeline.hpp:178
PhaseId _id
Identifier of the phase.
Definition Pipeline.hpp:182
Pipeline & _pipeline
Owning pipeline.
Definition Pipeline.hpp:176
std::size_t _size
Number of systems in this phase.
Definition Pipeline.hpp:180

Member Function Documentation

◆ begin()

Pipeline::SystemIterator ecstasy::Pipeline::Phase::begin ( ) const
noexcept

Get the iterator to the first system in this phase.

Returns
SystemIterator Iterator to the first system in this phase.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 18 of file Pipeline.cpp.

19 {
20 return _pipeline._systemsIds.begin() + static_cast<long>(_begin);
21 }
T begin(T... args)
std::vector< std::type_index > _systemsIds
Ordered list of systems.
Definition Pipeline.hpp:324

◆ begin_idx()

constexpr std::size_t ecstasy::Pipeline::Phase::begin_idx ( ) const
inlineconstexprprivate

Get the index of the first system in this phase.

Returns
constexpr std::size_t The index of the first system in this phase.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 194 of file Pipeline.hpp.

195 {
196 return _begin;
197 }

◆ end()

Pipeline::SystemIterator ecstasy::Pipeline::Phase::end ( ) const
noexcept

Get the iterator past the last system in this phase.

Warning
This does not represent a system in this phase.
Returns
SystemIterator Iterator past the last system in this phase.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 23 of file Pipeline.cpp.

24 {
25 return _pipeline._systemsIds.begin() + static_cast<long>(end_idx());
26 }
constexpr std::size_t end_idx() const
Get the index past the last system in this phase.
Definition Pipeline.hpp:209

◆ end_idx()

constexpr std::size_t ecstasy::Pipeline::Phase::end_idx ( ) const
inlineconstexprprivate

Get the index past the last system in this phase.

Warning
This index is not valid to access the last system.
Returns
constexpr std::size_t The index past the last system in this phase.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 209 of file Pipeline.hpp.

210 {
211 return _begin + _size;
212 }

◆ getId()

constexpr PhaseId ecstasy::Pipeline::Phase::getId ( ) const
inlineconstexprnoexcept

Get the phase ID.

Returns
constexpr PhaseId The phase identifier.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 109 of file Pipeline.hpp.

110 {
111 return _id;
112 }

◆ getSize()

constexpr std::size_t ecstasy::Pipeline::Phase::getSize ( ) const
inlineconstexprnoexcept

Get the number of systems in this phase.

Returns
std::size_t The number of systems in this phase.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 96 of file Pipeline.hpp.

97 {
98 return _size;
99 }

◆ getTimer() [1/2]

constexpr const Timer & ecstasy::Pipeline::Phase::getTimer ( ) const
inlineconstexprnoexcept

Get the phase timer.

Note
The timer is used to control the execution of the phase. You can also use ISystem scale timers.
Warning
Rate limiting both the phase and the systems will result in multiplied timers (not added). However interval timers will be cumulative.
Returns
const Timer& Reference to the system timer.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-22)

Definition at line 169 of file Pipeline.hpp.

170 {
171 return _timer;
172 }
Timer _timer
Timer to control the execution of the phase.
Definition Pipeline.hpp:184

◆ getTimer() [2/2]

constexpr Timer & ecstasy::Pipeline::Phase::getTimer ( )
inlineconstexprnoexcept

Get the phase timer.

Note
The timer is used to control the execution of the phase. You can also use ISystem scale timers.
Warning
Rate limiting both the phase and the systems will result in multiplied timers (not added). However interval timers will be cumulative.
Returns
Timer& Reference to the system timer.
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-22)

Definition at line 150 of file Pipeline.hpp.

151 {
152 return _timer;
153 }

◆ run()

void ecstasy::Pipeline::Phase::run ( )

Run all systems in this phase.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2024-11-21)

Definition at line 28 of file Pipeline.cpp.

29 {
30 if (!_timer.trigger())
31 return;
32 for (auto it = begin(); it < end(); ++it) {
34 }
35 }
SystemIterator begin() const noexcept
Get the iterator to the first system in this phase.
Definition Pipeline.cpp:18
SystemIterator end() const noexcept
Get the iterator past the last system in this phase.
Definition Pipeline.cpp:23
Registry & _registry
Owning registry.
Definition Pipeline.hpp:328
void runSystem()
Run a specific system from the registry.
bool trigger() noexcept
Trigger the timer if it is time to do so.
Definition Timer.cpp:64

Member Data Documentation

◆ _begin

std::size_t ecstasy::Pipeline::Phase::_begin
private

Index of the first system in this phase.

Definition at line 178 of file Pipeline.hpp.

◆ _id

PhaseId ecstasy::Pipeline::Phase::_id
private

Identifier of the phase.

Definition at line 182 of file Pipeline.hpp.

◆ _pipeline

Pipeline& ecstasy::Pipeline::Phase::_pipeline
private

Owning pipeline.

Definition at line 176 of file Pipeline.hpp.

◆ _size

std::size_t ecstasy::Pipeline::Phase::_size
private

Number of systems in this phase.

Definition at line 180 of file Pipeline.hpp.

◆ _timer

Timer ecstasy::Pipeline::Phase::_timer
private

Timer to control the execution of the phase.

Definition at line 184 of file Pipeline.hpp.

◆ Pipeline

friend ecstasy::Pipeline::Phase::Pipeline
private

Allow Pipeline to access the private members.

Definition at line 215 of file Pipeline.hpp.


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