Class ClusterEntityRecordAccessor
Static accessor for cluster entity records stored as raw bytes in the per-archetype RawValueHashMap.
public static class ClusterEntityRecordAccessor
- Inheritance
-
ClusterEntityRecordAccessor
- Inherited Members
Remarks
Base record layout: [EntityRecordHeader (14B)] [ClusterChunkId (4B)] [SlotIndex (1B)] = 19 bytes.
For archetypes with Versioned components, the record extends with per-Versioned-slot compRevFirstChunkId (4B each): [Base (19B)] [CompRevFirstChunkIdâ‚€ (4B)] ... [CompRevFirstChunkId_{V-1} (4B)]
Total: 19 + 4 * versionedSlotCount bytes.
The EntityRecordHeader is identical to the legacy format (same BornTSN/DiedTSN/EnabledBits).
Fields
BaseRecordSize
Base cluster entity record size (no Versioned slots): Header(14) + ClusterChunkId(4) + SlotIndex(1) = 19.
public const int BaseRecordSize = 19
Field Value
ClusterChunkIdOffset
Byte offset of ClusterChunkId within the record.
public const int ClusterChunkIdOffset = 14
Field Value
CompRevOffset
Byte offset where compRevFirstChunkId array starts (immediately after SlotIndex).
public const int CompRevOffset = 19
Field Value
HeaderSize
Size of the EntityRecordHeader in bytes (same as legacy).
public const int HeaderSize = 14
Field Value
SlotIndexOffset
Byte offset of SlotIndex within the record.
public const int SlotIndexOffset = 18
Field Value
Methods
GetClusterChunkId(byte*)
Read the cluster chunk ID (the cluster's chunkId in the ClusterSegment).
public static int GetClusterChunkId(byte* record)
Parameters
recordbyte*
Returns
GetCompRevFirstChunkId(byte*, int)
Read the compRevFirstChunkId for the given versioned index (0-based within Versioned slots only).
public static int GetCompRevFirstChunkId(byte* record, int versionedIndex)
Parameters
Returns
GetHeader(byte*)
Get a reference to the header at the start of the record.
public static ref EntityRecordHeader GetHeader(byte* record)
Parameters
recordbyte*
Returns
GetSlotIndex(byte*)
Read the slot index within the cluster (0..63).
public static byte GetSlotIndex(byte* record)
Parameters
recordbyte*
Returns
InitializeRecord(byte*, int)
Zero-initialize an entire cluster entity record (base + versioned extensions).
public static void InitializeRecord(byte* record, int versionedSlotCount)
Parameters
RecordSize(int)
Compute the total record size for a cluster archetype with versionedSlotCount Versioned components.
public static int RecordSize(int versionedSlotCount)
Parameters
versionedSlotCountint
Returns
SetClusterChunkId(byte*, int)
Write the cluster chunk ID.
public static void SetClusterChunkId(byte* record, int chunkId)
Parameters
SetCompRevFirstChunkId(byte*, int, int)
Write the compRevFirstChunkId for the given versioned index.
public static void SetCompRevFirstChunkId(byte* record, int versionedIndex, int chunkId)
Parameters
SetSlotIndex(byte*, byte)
Write the slot index within the cluster.
public static void SetSlotIndex(byte* record, byte slotIndex)