ScorePoolManager Class
Manages score pools and processes score commands. More...
Declaration
Public Member Typedefs Index
| using | EngineRoleTag = helios::engine::common::tags::ManagerRole |
Public Member Functions Index
| ScorePool & | addScorePool (helios::engine::mechanics::scoring::types::ScorePoolId scorePoolId) noexcept |
|
Creates and registers a new score pool. More... | |
| ScorePool * | scorePool (const helios::engine::mechanics::scoring::types::ScorePoolId scorePoolId) noexcept |
|
Retrieves a score pool by ID. More... | |
| void | flush (helios::engine::runtime::world::UpdateContext &update_context) noexcept |
|
Flushes pending score updates to their respective pools. More... | |
| bool | submit (UpdateScoreCommand updateScoreCommand) noexcept |
|
Submits a score update command for processing. More... | |
| void | init (helios::engine::runtime::world::GameWorld &gameWorld) |
|
Initializes the manager and registers it as the score command handler. More... | |
| void | reset () |
|
Resets all managed score pools to zero. More... | |
Private Member Attributes Index
| std::vector< ScorePool > | pools_ |
|
Collection of score pools managed by this manager. More... | |
| std::vector< helios::engine::mechanics::scoring::types::ScoreValueContext > | scores_ |
|
Pending score contexts to be processed on flush. More... | |
Description
Manages score pools and processes score commands.
ScorePoolManager is responsible for creating and managing score pools, and for handling score update commands. It implements both the Manager interface (for lifecycle management) and ScoreCommandHandler (for receiving score commands from the command system).
Score updates are batched: commands submitted via `submit()` are queued and processed during `flush()`, ensuring deterministic ordering.
- See Also
- See Also
ScoreCommandHandler
- See Also
Manager
Definition at line 51 of file ScorePoolManager.ixx.
Public Member Typedefs
EngineRoleTag
|
Definition at line 66 of file ScorePoolManager.ixx.
Public Member Functions
addScorePool()
| inline noexcept |
Creates and registers a new score pool.
- Parameters
-
scorePoolId Unique identifier for the new pool.
- Returns
Reference to the newly created ScorePool.
Definition at line 75 of file ScorePoolManager.ixx.
Reference scorePool.
flush()
| inline noexcept |
Flushes pending score updates to their respective pools.
Processes all pending ScoreValueContext entries and adds them to the appropriate score pools based on their scorePoolId.
- Parameters
-
gameWorld Reference to the game world.
update_context Reference to the update context.
Definition at line 115 of file ScorePoolManager.ixx.
init()
| inline |
Initializes the manager and registers it as the score command handler.
- Parameters
-
gameWorld Reference to the game world.
Definition at line 154 of file ScorePoolManager.ixx.
Reference helios::engine::runtime::world::GameWorld::registerCommandHandler.
reset()
| inline |
Resets all managed score pools to zero.
Iterates through all registered pools and calls their reset() method, clearing all scores and resetting totals.
Definition at line 165 of file ScorePoolManager.ixx.
scorePool()
| inline nodiscard noexcept |
Retrieves a score pool by ID.
- Parameters
-
scorePoolId The ID of the pool to find.
- Returns
Pointer to the ScorePool, or nullptr if not found.
Definition at line 92 of file ScorePoolManager.ixx.
Reference scorePool.
Referenced by addScorePool and scorePool.
submit()
| inline noexcept |
Submits a score update command for processing.
- Parameters
-
updateScoreCommand The command containing score context.
- Returns
True if the command was accepted.
Definition at line 141 of file ScorePoolManager.ixx.
Private Member Attributes
pools_
|
Collection of score pools managed by this manager.
Definition at line 56 of file ScorePoolManager.ixx.
scores_
|
Pending score contexts to be processed on flush.
Definition at line 61 of file ScorePoolManager.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.