Skip to content

EntropyEngine::Core::SlotGeneration

Generation counter component for slot-based pools. More…

#include <HandleSlot.h>

Name
voidreset(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_tincrement()
Increments the generation to invalidate stale handles.
uint32_tcurrent() const
Gets the current generation value.
SlotGeneration() =default
SlotGeneration(const SlotGeneration & ) =delete
SlotGeneration(SlotGeneration && other)
Name
std::atomic< uint32_t >value
Generation counter (starts at 1, 0 reserved for “never allocated”).
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
};
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)
SlotGeneration & operator=(
const SlotGeneration &
) =delete
inline SlotGeneration & operator=(
SlotGeneration && other
)
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.

inline uint32_t current() const

Gets the current generation value.

Return: Current generation value

Use this when stamping objects or for validation checks.

SlotGeneration() =default
SlotGeneration(
const SlotGeneration &
) =delete
inline SlotGeneration(
SlotGeneration && other
)
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