Skip to main content

CommitPoint.ixx File

Defines commit points for synchronization within the game loop. More...

Included Headers

#include <cstdint> #include <utility>

Namespaces Index

namespacehelios
namespaceengine

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

namespaceruntime

Runtime infrastructure for game execution and lifecycle orchestration. More...

namespacegameloop

Central game loop orchestration module. More...

Description

Defines commit points for synchronization within the game loop.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file CommitPoint.ixx
3 * @brief Defines commit points for synchronization within the game loop.
4 */
5module;
6
7#include <cstdint>
8#include <utility>
9
10export module helios.engine.runtime.gameloop.CommitPoint;
11
12
14
15 /**
16 * @brief Flags defining synchronization actions at the end of a pass.
17 *
18 * @details A CommitPoint specifies what operations should be performed when a pass
19 * completes. Multiple flags can be combined using bitwise OR to trigger several
20 * actions at once.
21 *
22 * Commit points are essential for the deterministic ordering of the game loop:
23 * - Commands are queued during passes and executed at commit points
24 * - Pass-level events become readable only after a commit
25 * - Managers process their queued requests at commit points
26 *
27 * Example usage:
28 * ```cpp
29 * pass.addCommitPoint(CommitPoint::PassEvents | CommitPoint::FlushCommands);
30 * ```
31 *
32 * @see Pass::addCommitPoint()
33 * @see GameLoop::passCommit()
34 */
35 enum class CommitPoint : uint8_t {
36
37 /**
38 * @brief No commit action.
39 */
40 None = 0,
41
42 /**
43 * @brief Commits pass-level events.
44 *
45 * Events pushed via `UpdateContext::pushPass()` become readable in subsequent
46 * passes through `UpdateContext::readPass()`. Pass events are discarded at the
47 * end of the phase.
48 */
49 PassEvents = 1 << 0,
50
51 /**
52 * @brief Flushes the command buffer.
53 *
54 * Pending commands are dispatched to their registered handlers and executed.
55 */
56 FlushCommands = 1 << 1,
57
58 /**
59 * @brief Flushes all registered managers.
60 *
61 * Managers process their queued requests (e.g., ProjectileManager spawns
62 * projectiles from its request queue).
63 */
64 FlushManagers = 1 << 2,
65
66 /**
67 * @brief Full structural commit.
68 *
69 * Combines PassEvents, FlushManagers, and FlushCommands for a complete
70 * synchronization point.
71 */
73 };
74
75 /**
76 * @brief Bitwise AND operator for CommitPoint flags.
77 *
78 * @param a First operand.
79 * @param b Second operand.
80 *
81 * @return The combined flags.
82 */
83 CommitPoint constexpr operator &(CommitPoint a, CommitPoint b) noexcept {
84 return static_cast<CommitPoint>(std::to_underlying(a) & std::to_underlying(b));
85 }
86
87 /**
88 * @brief Bitwise OR operator for CommitPoint flags.
89 *
90 * @param a First operand.
91 * @param b Second operand.
92 *
93 * @return The combined flags.
94 */
95 CommitPoint constexpr operator |(CommitPoint a, CommitPoint b) noexcept {
96 return static_cast<CommitPoint>(std::to_underlying(a) | std::to_underlying(b));
97 }
98
99
100}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.