Table of Contents

Struct ComponentFieldSpec

Namespace
Typhon.Schema.Definition
Assembly
Typhon.Schema.Definition.dll

Pure-data description of a single component field: its identity, CLR type, byte offset, and any array / index / foreign-key / spatial metadata. The engine maps DotNetType to its stored field type and applies field-id resolution (schema migration) when building the definition, so this spec carries the same inputs reflection would read from the struct — never a pre-resolved field id.

public readonly struct ComponentFieldSpec
Inherited Members

Constructors

ComponentFieldSpec(string, Type, int, string, int?, bool, int, bool, bool, bool, Type, bool, float, float, SpatialMode, uint)

Creates a component field spec. Only name, dotNetType, and offset are required; the remaining metadata defaults to "absent".

public ComponentFieldSpec(string name, Type dotNetType, int offset, string previousName = null, int? explicitFieldId = null, bool isStatic = false, int arrayLength = 0, bool hasIndex = false, bool indexAllowMultiple = false, bool isForeignKey = false, Type foreignKeyTargetType = null, bool hasSpatialIndex = false, float spatialMargin = 0, float spatialCellSize = 0, SpatialMode spatialMode = SpatialMode.Dynamic, uint spatialCategory = 4294967295)

Parameters

name string

Field name (see Name).

dotNetType Type

Backing CLR type (see DotNetType).

offset int

Byte offset within component storage (see Offset).

previousName string

Former field name (see PreviousName).

explicitFieldId int?

Explicit field id (see ExplicitFieldId).

isStatic bool

Schema-static flag (see IsStatic).

arrayLength int

Fixed array length (see ArrayLength).

hasIndex bool

Scalar-index flag (see HasIndex).

indexAllowMultiple bool

Non-unique index flag (see IndexAllowMultiple).

isForeignKey bool

Foreign-key flag (see IsForeignKey).

foreignKeyTargetType Type

Foreign-key target type (see ForeignKeyTargetType).

hasSpatialIndex bool

Spatial-index flag (see HasSpatialIndex).

spatialMargin float

Spatial margin (see SpatialMargin).

spatialCellSize float

Spatial cell size (see SpatialCellSize).

spatialMode SpatialMode

Spatial mode (see SpatialMode).

spatialCategory uint

Spatial category bitmask (see SpatialCategory).

Properties

ArrayLength

Fixed element count when the field is an array; 0 for a scalar field.

public int ArrayLength { get; }

Property Value

int

DotNetType

The backing CLR type of the field (e.g. typeof(float)). The engine maps this to its stored field type.

public Type DotNetType { get; }

Property Value

Type

ExplicitFieldId

Explicit stable field id (from FieldId), or null to let the engine assign / resolve it.

public int? ExplicitFieldId { get; }

Property Value

int?

ForeignKeyTargetType

The target component type the foreign key points at (from TargetComponentType); null unless IsForeignKey is true.

public Type ForeignKeyTargetType { get; }

Property Value

Type

HasIndex

True when the field carries a scalar index (IndexAttribute).

public bool HasIndex { get; }

Property Value

bool

HasSpatialIndex

True when the field carries a spatial index (SpatialIndexAttribute). At most one spatial field is allowed per component.

public bool HasSpatialIndex { get; }

Property Value

bool

IndexAllowMultiple

True when the index permits multiple entities per key (non-unique). Only meaningful when HasIndex is true.

public bool IndexAllowMultiple { get; }

Property Value

bool

IsForeignKey

True when the field is a foreign key (ForeignKeyAttribute) referencing another component's entities.

public bool IsForeignKey { get; }

Property Value

bool

IsStatic

True for a schema-static field — carried on the definition but excluded from per-entity storage and the field-id layout.

public bool IsStatic { get; }

Property Value

bool

Name

Field name — the schema-match key (from Name or the C# field name).

public string Name { get; }

Property Value

string

Offset

Byte offset of the field within the component's storage, computed once via OffsetOf(Type, string).

public int Offset { get; }

Property Value

int

PreviousName

Former field name, set when the field was renamed so the persisted field can be carried forward (from PreviousName); null when never renamed.

public string PreviousName { get; }

Property Value

string

SpatialCategory

Archetype-level category bitmask for spatial broadphase filtering (from Category). Meaningful when HasSpatialIndex.

public uint SpatialCategory { get; }

Property Value

uint

SpatialCellSize

Broadphase cell size (from CellSize); 0 selects the engine default. Meaningful when HasSpatialIndex.

public float SpatialCellSize { get; }

Property Value

float

SpatialMargin

Fat-AABB movement-hysteresis margin (from Margin). Meaningful when HasSpatialIndex.

public float SpatialMargin { get; }

Property Value

float

SpatialMode

Whether the spatial index is static or dynamic (from Mode). Meaningful when HasSpatialIndex.

public SpatialMode SpatialMode { get; }

Property Value

SpatialMode