Skip to main content

StateTransitionContext.ixx File

Context information for state transitions. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine

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

namespacestate

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

namespacetypes

Type definitions for state transitions. More...

Classes Index

classStateTransitionContext<StateType>

Captures the complete context of a state transition. More...

Description

Context information for state transitions.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file StateTransitionContext.ixx
3 * @brief Context information for state transitions.
4 */
5module;
6
7
8export module helios.engine.state.types.StateTransitionContext;
9
10import helios.engine.state.types.StateTransitionId;
11import helios.engine.state.types.StateTransitionType;
12
13export namespace helios::engine::state::types {
14
15 /**
16 * @brief Captures the complete context of a state transition.
17 *
18 * @details Contains the source state, target state, and the transition
19 * ID that triggered the change. Passed to listeners during state changes.
20 *
21 * @tparam StateType The state enum type.
22 *
23 * @see StateTransitionListener
24 * @see StateManager
25 */
26 template<typename StateType>
28
29 using StateTransitionIdType = typename StateTransitionId<StateType>::Type;
30
31 /**
32 * @brief The state being transitioned from.
33 */
34 StateType from_;
35
36 /**
37 * @brief The transition that triggered this change.
38 */
39 StateTransitionIdType transitionId_;
40
41 /**
42 * @brief The state being transitioned to.
43 */
44 StateType to_;
45
46 public:
47
48 /**
49 * @brief Constructs a transition context.
50 *
51 * @param from The source state.
52 * @param to The target state.
53 * @param transitionId The transition identifier.
54 */
56 const StateType from,
57 const StateType to,
58 const StateTransitionIdType transitionId
59 ) : from_(from), to_(to), transitionId_(transitionId) {}
60
61 /**
62 * @brief Returns the target state.
63 *
64 * @return The state being transitioned to.
65 */
66 [[nodiscard]] StateType to() const noexcept {
67 return to_;
68 }
69
70 /**
71 * @brief Returns the source state.
72 *
73 * @return The state being transitioned from.
74 */
75 [[nodiscard]] StateType from() const noexcept {
76 return from_;
77 }
78
79 /**
80 * @brief Returns the transition identifier.
81 *
82 * @return The ID of the transition.
83 */
84 [[nodiscard]] StateTransitionIdType transitionId() const noexcept {
85 return transitionId_;
86 }
87
88 };
89
90}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.