Struct SwiftSlotMapState<T>
- Namespace
- SwiftCollections
- Assembly
- SwiftCollections.dll
Represents the state of a map in a fast allocation pool, including the items, allocation status, free indices, and peak usage count.
[MemoryPackable(GenerateType.Object)]
public readonly struct SwiftSlotMapState<T> : IMemoryPackable<SwiftSlotMapState<T>>, IMemoryPackFormatterRegister
Type Parameters
TThe type of items stored in the map.
- Implements
-
IMemoryPackable<SwiftSlotMapState<T>>IMemoryPackFormatterRegister
- Inherited Members
Remarks
This struct is typically used to capture or transfer the current state of a map-based memory pool. It provides direct access to the underlying arrays representing the items, their allocation status, and the indices of free slots. The struct is serializable and designed for efficient state management in high-performance scenarios.
Constructors
SwiftSlotMapState(T[], bool[], int[], int)
Initializes a new instance of the SwiftSlotMapState class with the specified items, allocation states, free indices, and peak count.
[JsonConstructor]
[MemoryPackConstructor]
public SwiftSlotMapState(T[] items, bool[] allocated, int[] freeIndices, int peakCount)
Parameters
itemsT[]The array of items contained in the map. Cannot be null; an empty array is used if null is provided.
allocatedbool[]An array indicating which items in the map are currently allocated. Cannot be null; an empty array is used if null is provided.
freeIndicesint[]An array of indices representing the positions of free items in the map. Cannot be null; an empty array is used if null is provided.
peakCountintThe highest number of items that have been allocated in the map at any point.
Fields
Allocated
Indicates which items in the collection are currently allocated.
[JsonInclude]
[MemoryPackInclude]
public readonly bool[] Allocated
Field Value
- bool[]
FreeIndices
Gets the collection of indices that are currently available for allocation.
[JsonInclude]
[MemoryPackInclude]
public readonly int[] FreeIndices
Field Value
- int[]
Items
Gets the array of items contained in the collection.
[JsonInclude]
[MemoryPackInclude]
public readonly T[] Items
Field Value
- T[]
PeakCount
Gets the maximum number of peaks detected or recorded.
[JsonInclude]
[MemoryPackInclude]
public readonly int PeakCount