EntropyEngine::Core::SlotGeneration
EntropyEngine::Core::SlotGeneration
Section titled “EntropyEngine::Core::SlotGeneration”Generation counter component for slot-based pools. More…
#include <HandleSlot.h>
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| void | reset(uint32_t newValue =1) Resets the generation (typically only used in tests or pool reinitialization). |
| SlotGeneration & | operator=(const SlotGeneration & ) =delete |
| SlotGeneration & | operator=(SlotGeneration && other) |
| uint32_t | increment() Increments the generation to invalidate stale handles. |
| uint32_t | current() const Gets the current generation value. |
| SlotGeneration() =default | |
| SlotGeneration(const SlotGeneration & ) =delete | |
| SlotGeneration(SlotGeneration && other) |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| std::atomic< uint32_t > | value Generation counter (starts at 1, 0 reserved for “never allocated”). |
Detailed Description
Section titled “Detailed Description”struct EntropyEngine::Core::SlotGeneration;Generation counter component for slot-based pools.
Provides the authoritative generation counter that lives in each pool slot. The generation is incremented each time the slot is released, invalidating any handles that were stamped with the previous generation.
This is designed to be composed into custom slot structures:
struct MyPoolSlot { SlotGeneration generation; // Generation tracking RefObject<MyType> resource; // The pooled resource // ... other slot-specific data};Public Functions Documentation
Section titled “Public Functions Documentation”function reset
Section titled “function reset”inline void reset( uint32_t newValue =1)Resets the generation (typically only used in tests or pool reinitialization).
Parameters:
- newValue Value to reset to (default: 1)
function operator=
Section titled “function operator=”SlotGeneration & operator=( const SlotGeneration &) =deletefunction operator=
Section titled “function operator=”inline SlotGeneration & operator=( SlotGeneration && other)function increment
Section titled “function increment”inline uint32_t increment()Increments the generation to invalidate stale handles.
Return: The new generation value (post-increment)
Call this when releasing a slot. Any handles stamped with the previous generation will fail validation after this call.
function current
Section titled “function current”inline uint32_t current() constGets the current generation value.
Return: Current generation value
Use this when stamping objects or for validation checks.
function SlotGeneration
Section titled “function SlotGeneration”SlotGeneration() =defaultfunction SlotGeneration
Section titled “function SlotGeneration”SlotGeneration( const SlotGeneration &) =deletefunction SlotGeneration
Section titled “function SlotGeneration”inline SlotGeneration( SlotGeneration && other)Public Attributes Documentation
Section titled “Public Attributes Documentation”variable value
Section titled “variable value”std::atomic< uint32_t > value {1};Generation counter (starts at 1, 0 reserved for “never allocated”).
Updated on 2026-01-26 at 17:14:35 -0500