TimerManager Class
Manager that owns game timers and processes timer control commands. More...
Declaration
Public Member Typedefs Index
| using | EngineRoleTag = helios::engine::runtime::world::tags::ManagerRole |
Public Member Functions Index
| Timer & | addTimer (TimerId timerId) noexcept |
|
Registers a new game timer. More... | |
| Timer * | getTimer (const TimerId timerId) |
|
Looks up a timer by its id. More... | |
| std::span< Timer > | timers () noexcept |
|
Returns a span over all registered timers. More... | |
| void | flush (helios::engine::runtime::world::UpdateContext &updateContext) noexcept |
|
Applies all pending timer control contexts. More... | |
| bool | submit (const TimerControlCommand timerControlCommand) noexcept |
|
Enqueues a timer control command for deferred processing. More... | |
| void | init (helios::engine::runtime::messaging::command::CommandHandlerRegistry &commandHandlerRegistry) |
|
Registers this manager as the timer command handler in the game world. More... | |
| void | reset () |
|
Resets all managed timers. More... | |
Private Member Functions Index
| bool | has (const TimerId timerId) noexcept |
|
Checks whether a timer with the given id exists. More... | |
| Timer & | add (const TimerId timerId) noexcept |
|
Creates and appends a new timer. More... | |
Private Member Attributes Index
| std::vector< Timer > | timers_ |
|
Collection of game timers managed by this manager. More... | |
| std::vector< TimerControlContext > | pendingControlContexts_ |
|
Pending timer control contexts to be applied during flush. More... | |
Description
Manager that owns game timers and processes timer control commands.
Pending control commands are collected via submit() and applied during flush() at the beginning of each frame.
- See Also
- See Also
- See Also
Manager
Definition at line 47 of file TimerManager.ixx.
Public Member Typedefs
EngineRoleTag
|
Definition at line 85 of file TimerManager.ixx.
Public Member Functions
addTimer()
| inline noexcept |
Registers a new game timer.
Asserts that no timer with the given id already exists.
- Parameters
-
timerId The unique id for the new timer.
- Returns
Reference to the newly created Timer.
Definition at line 96 of file TimerManager.ixx.
Reference helios::engine::runtime::registerComponents.
flush()
| inline noexcept |
Applies all pending timer control contexts.
For each pending context, the corresponding timer's state is updated. The pending list is cleared after processing.
- Parameters
-
gameWorld Reference to the game world.
updateContext Reference to the current update context.
Definition at line 140 of file TimerManager.ixx.
References getTimer and helios::engine::runtime::registerComponents.
getTimer()
Looks up a timer by its id.
- Parameters
-
timerId The id to search for.
- Returns
Pointer to the timer, or nullptr if not found.
Definition at line 109 of file TimerManager.ixx.
Reference helios::engine::runtime::registerComponents.
Referenced by flush.
init()
| inline |
Registers this manager as the timer command handler in the game world.
- Parameters
-
gameWorld The game world to register with.
Definition at line 174 of file TimerManager.ixx.
Reference helios::engine::runtime::messaging::command::CommandHandlerRegistry::registerHandler.
reset()
| inline |
Resets all managed timers.
Definition at line 181 of file TimerManager.ixx.
Reference helios::engine::runtime::registerComponents.
submit()
| inline noexcept |
Enqueues a timer control command for deferred processing.
- Parameters
-
timerControlCommand The command to enqueue.
- Returns
True if the command was accepted.
Definition at line 164 of file TimerManager.ixx.
Reference helios::engine::runtime::registerComponents.
timers()
| inline noexcept |
Returns a span over all registered timers.
- Returns
A span of Timer instances.
Definition at line 127 of file TimerManager.ixx.
Referenced by helios::engine::runtime::timing::systems::TimerClearSystem::update and helios::engine::runtime::timing::systems::TimerUpdateSystem< TCommandBuffer >::update.
Private Member Functions
add()
Creates and appends a new timer.
- Parameters
-
timerId The id for the new timer.
- Returns
Reference to the newly created timer.
Definition at line 78 of file TimerManager.ixx.
has()
Checks whether a timer with the given id exists.
- Parameters
-
timerId The id to look up.
- Returns
True if a timer with the given id is registered.
Definition at line 66 of file TimerManager.ixx.
Private Member Attributes
pendingControlContexts_
|
Pending timer control contexts to be applied during flush.
Definition at line 57 of file TimerManager.ixx.
timers_
|
Collection of game timers managed by this manager.
Definition at line 52 of file TimerManager.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.