CombinedStateToIdMapPair.ixx File
Combined policy mapping two state types to IDs using 2D indexing. More...
Included Headers
#include <vector>
#include <span>
#include <helios-engine-config.h>
#include <cassert>
#include <bit>
#include <algorithm>
#include <iterator>
#include <cstddef>
#include <utility>
#include <helios.engine.core.types>
#include <helios.engine.state.types>
#include <helios.engine.state.StateToIdMap>
Namespaces Index
| namespace | helios |
| namespace | engine |
| namespace | state |
Classes Index
| class | CombinedStateToIdMapPair<LState, RState, TId> |
|
Maps combined state pairs directly to ID lists. More... | |
Description
Combined policy mapping two state types to IDs using 2D indexing.
File Listing
The file content with the documentation metadata removed is:
9#include <helios-engine-config.h>
27using namespace helios::engine::state::types;
29export namespace helios::engine::state {
50 class CombinedStateToIdMapPair {
78 assert((std::to_underlying(stateLft) & (std::to_underlying(stateLft) -1)) == 0 && "LState must be a power of 2");
80 return std::countr_zero(std::to_underlying(stateLft));
95 if (std::to_underlying(stateRgt) != 0 ) {
96 assert((std::to_underlying(stateRgt) & (std::to_underlying(stateRgt) -1)) == 0 && "RState must be a power of 2");
99 return std::countr_zero(std::to_underlying(stateRgt)) + 1;
116 CombinedStateToIdMapPair& add(const LState stateLft, const RState stateRgt, const TId id) noexcept {
118 assert(!frozen_ && "Cannot add to a frozen map");
127 if (states_.size() <= stL) {
128 states_.resize(stL + 1);
143 for (auto& statesL : states_) {
156 finalize();
180 [[nodiscard]] std::span<const TId> ids(const LState stateLft, const RState stateRgt) const noexcept {
182 assert(frozen_ && "Cannot return from a non-frozen map");
187 if (states_.size() <= stL) {
193 return states_[stL][0];
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.