Table of Contents

Struct SwiftTicketMapState<T>

Namespace
SwiftCollections
Assembly
SwiftCollections.dll

Represents the immutable state of a generational map, including item storage, allocation status, generation tracking, and free index management.

[MemoryPackable(GenerateType.Object)]
public readonly struct SwiftTicketMapState<T> : IMemoryPackable<SwiftTicketMapState<T>>, IMemoryPackFormatterRegister

Type Parameters

T

The type of elements stored in the map.

Implements
IMemoryPackable<SwiftTicketMapState<T>>
IMemoryPackFormatterRegister
Inherited Members

Remarks

This struct is typically used to capture or transfer the complete state of a generational map for serialization, persistence, or inspection purposes. All arrays are expected to be of the same length, and the struct is designed for efficient value-type usage. The state is read-only and does not provide mutation operations.

Constructors

SwiftTicketMapState(T[], bool[], uint[], int[], int)

Initializes a new instance of the SwiftTicketMapState class with the specified items, allocation states, generation counters, free indices, and peak index.

[JsonConstructor]
[MemoryPackConstructor]
public SwiftTicketMapState(T[] items, bool[] allocated, uint[] generations, int[] freeIndices, int peak)

Parameters

items T[]

The array of items to be managed by the map. Cannot be null; an empty array is used if null is provided.

allocated bool[]

An array indicating which slots in the map are currently allocated. Each element corresponds to an item in the items array. Cannot be null; an empty array is used if null is provided.

generations uint[]

An array of generation counters for each slot in the map. Used to track the version or state of each item. Cannot be null; an empty array is used if null is provided.

freeIndices int[]

An array of indices representing the free slots available for allocation. Cannot be null; an empty array is used if null is provided.

peak int

The highest index that has been allocated in the map. Must be greater than or equal to zero.

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[]

Generations

Gets the collection of generation values associated with this instance.

[JsonInclude]
[MemoryPackInclude]
public readonly uint[] Generations

Field Value

uint[]

Items

Gets the array of items contained in the collection.

[JsonInclude]
[MemoryPackInclude]
public readonly T[] Items

Field Value

T[]

Peak

Gets the peak value recorded during the measurement period.

[JsonInclude]
[MemoryPackInclude]
public readonly int Peak

Field Value

int