Skip to main content

DelayedStateCommand.ixx File

Timer-deferred command for requesting state transitions. More...

Included Headers

#include <cassert> #include <memory> #include <helios.engine.state.types> #include <helios.engine.state.Bindings> #include <helios.engine.mechanics.timing.types.GameTimerId>

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacestate

Generic, template-based state management system. More...

namespacecommands

State transition commands. More...

Classes Index

classDelayedStateCommand<StateType>

Command that pairs a state transition request with a timer. More...

Description

Timer-deferred command for requesting state transitions.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file DelayedStateCommand.ixx
3 * @brief Timer-deferred command for requesting state transitions.
4 */
5module;
6
7#include <cassert>
8#include <memory>
9
10export module helios.engine.state.commands.DelayedStateCommand;
11
12import helios.engine.mechanics.timing.types.GameTimerId;
13
14import helios.engine.state.Bindings;
15
16import helios.engine.state.types;
17
18using namespace helios::engine::state::types;
20
21
23
24 /**
25 * @brief Command that pairs a state transition request with a timer.
26 *
27 * @details Unlike StateCommand, which triggers a transition immediately
28 * during the next flush, DelayedStateCommand associates the request with
29 * a GameTimerId. The TypedCommandBuffer holds the command until the
30 * referenced timer expires, then forwards it to the StateManager.
31 *
32 * When the StateManager receives a DelayedStateCommand via submit(),
33 * it extracts the StateTransitionRequest and enqueues it as a regular
34 * StateCommand — the timer ID is not retained by the manager.
35 *
36 * @tparam StateType The state enum type.
37 *
38 * @see StateCommand
39 * @see StateTransitionRequest
40 * @see StateManager
41 */
42 template<typename StateType>
44
45 /**
46 * @brief The transition request to process.
47 */
48 StateTransitionRequest<StateType> transitionRequest_;
49
50 /**
51 * @brief The timer that gates this command.
52 */
53 GameTimerId timerId_;
54
55 public:
56
57 /**
58 * @brief Constructs a delayed state command.
59 *
60 * @param transitionRequest The transition to perform when the timer fires.
61 * @param timerId Identifier of the timer that triggers this command.
62 */
64 : transitionRequest_(transitionRequest), timerId_(timerId) {}
65
66
67
68 /**
69 * @brief Returns the transition request.
70 *
71 * @return The encapsulated transition request.
72 */
74 return transitionRequest_;
75 }
76
77 /**
78 * @brief Returns the associated timer identifier.
79 *
80 * @return The GameTimerId that gates this command.
81 */
82 [[nodiscard]] GameTimerId gameTimerId() const noexcept {
83 return timerId_;
84 }
85
86
87 };
88
89
90}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.