StateToIdMapPair Class Template
Combines two StateToIdMap instances for dual-state lookups. More...
Declaration
Public Member Functions Index
template <typename LState, typename RState, typename TId> | |
| StateToIdMapPair & | add (LState state, TId id) |
|
Adds an ID for the left state type. More... | |
template <typename LState, typename RState, typename TId> | |
| StateToIdMapPair & | add (RState state, TId id) |
|
Adds an ID for the right state type. More... | |
template <typename LState, typename RState, typename TId> | |
| auto | ids (const LState stateLft, const RState stateRgt) const -> std::span< const TId > |
|
Returns IDs for a state combination. More... | |
template <typename LState, typename RState, typename TId> | |
| void | freeze () |
|
Freezes both underlying maps. More... | |
Private Member Functions Index
template <typename LState, typename RState, typename TId> | |
| void | mergeInto (std::vector< TId > &out, std::span< const TId > lft, std::span< const TId > rgt) const |
|
Merges two sorted ID lists into the output. More... | |
Private Member Attributes Index
template <typename LState, typename RState, typename TId> | |
| StateToIdMap< LState, TId > | lft_ |
|
Map for the left state type. More... | |
template <typename LState, typename RState, typename TId> | |
| StateToIdMap< RState, TId > | rgt_ |
|
Map for the right state type. More... | |
template <typename LState, typename RState, typename TId> | |
| std::vector< TId > | combined_ |
|
Buffer for merged results. More... | |
Description
Combines two StateToIdMap instances for dual-state lookups.
Allows associating IDs with two different state types (e.g., GameState and MatchState). When queried, returns the union of IDs from both maps for the given state combination.
- Template Parameters
-
LState The left/primary state type.
RState The right/secondary state type.
TId The ID type to associate with states.
Definition at line 43 of file StateToIdMapPair.ixx.
Public Member Functions
add()
| inline |
Adds an ID for the left state type.
- Parameters
-
state The state to associate the ID with.
id The ID to add.
- Returns
Reference to this map for chaining.
Definition at line 86 of file StateToIdMapPair.ixx.
Reference helios::engine::state::StateToIdMapPair< LState, RState, TId >::add.
Referenced by helios::engine::state::StateToIdMapPair< LState, RState, TId >::add and helios::engine::state::StateToIdMapPair< LState, RState, TId >::add.
add()
| inline |
Adds an ID for the right state type.
- Parameters
-
state The state to associate the ID with.
id The ID to add.
- Returns
Reference to this map for chaining.
Definition at line 99 of file StateToIdMapPair.ixx.
Reference helios::engine::state::StateToIdMapPair< LState, RState, TId >::add.
freeze()
| inline |
Freezes both underlying maps.
Definition at line 131 of file StateToIdMapPair.ixx.
ids()
| inline nodiscard |
Returns IDs for a state combination.
Returns the sorted union of IDs from both maps. Both maps must be frozen before calling this method.
- Parameters
-
stateLft The left state to query.
stateRgt The right state to query.
- Returns
Span of IDs for the state combination.
Definition at line 115 of file StateToIdMapPair.ixx.
Private Member Functions
mergeInto()
| inline |
Merges two sorted ID lists into the output.
- Parameters
-
out The output vector.
lft IDs from the left map.
rgt IDs from the right map.
Definition at line 67 of file StateToIdMapPair.ixx.
Private Member Attributes
combined_
| mutable |
Buffer for merged results.
Definition at line 58 of file StateToIdMapPair.ixx.
lft_
|
Map for the left state type.
Definition at line 48 of file StateToIdMapPair.ixx.
rgt_
|
Map for the right state type.
Definition at line 53 of file StateToIdMapPair.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.