Table of Contents

Class CatalogCodec

Namespace
Typhon.Protocol
Assembly
Typhon.Protocol.dll

A codec: a CodecKind and the parameters that kind reads. Parameters a kind does not read stay at their default and are not written.

public sealed class CatalogCodec
Inheritance
CatalogCodec
Inherited Members

Remarks

Nothing here names a CLR type or a storage offset. A decoder that does not recognise Kind can still skip the field when FixedBytes says how wide it is — which only a codec newer than this library carries.

Constructors

CatalogCodec()

public CatalogCodec()

Properties

Bits

Width in bits for the quantizing kinds: 8, 16, 24 or 32.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int Bits { get; init; }

Property Value

int

Count

How many values of this codec the field is, 2 to 16, in its shape's component order (W33); 0 — absent — is one value. Read only by the byte-aligned scalar codecs (TakesCount(CodecKind)).

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int Count { get; init; }

Property Value

int

Element

The element of a Coll: its fields, shaped like a command's (W34).

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public CatalogElement Element { get; init; }

Property Value

CatalogElement

FixedBytes

Wire width in bytes, declared only by a codec newer than the protocol minor a client may speak, so that client can skip the field instead of refusing the catalog.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int FixedBytes { get; init; }

Property Value

int

Kind

The codec kind Type names; Unknown for a token this library does not know.

[JsonIgnore]
public CodecKind Kind { get; init; }

Property Value

CodecKind

Remarks

Setting Unknown leaves a Type already set alone: System.Text.Json 8's source generator (the one Unity ships, netstandard2.1 build) creates the object with an initializer that assigns this ignored property too, after Type, with its default — which would otherwise erase the token just read.

Max

Upper bound per axis (exclusive), paired with Min.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double[] Max { get; init; }

Property Value

double[]

MaxBytes

Upper bound on encoded length for Str and Blob.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int MaxBytes { get; init; }

Property Value

int

MaxCount

The most elements a List may carry, at most 255, or a Coll may send, 1 to MaxCollCount — required: a collection's bound is load-bearing and has no default.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int MaxCount { get; init; }

Property Value

int

Min

Lower bound per axis (inclusive): one value for Quant, two or three for a position.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double[] Min { get; init; }

Property Value

double[]

MinCount

The fewest elements a List may carry.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int MinCount { get; init; }

Property Value

int

N

Bit count for Bits, or byte count for Bytes.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int N { get; init; }

Property Value

int

Of

The element codec of a List.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public CatalogCodec Of { get; init; }

Property Value

CatalogCodec

Scale

The size of one step, for Vec2 and Vec3.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double Scale { get; init; }

Property Value

double

Type

The codec's wire token, serialized as t — the name the TypeScript table is keyed by. Kept as the token rather than the enum so a codec newer than this library survives a parse and a re-serialization unchanged.

[JsonPropertyName("t")]
public string Type { get; init; }

Property Value

string

UnitExp

The velocity unit's binary exponent, for Vel2 and Vel3: one code is 2^unitExp metres per tick (W5, typhon.3) — absolute, independent of any position codec or realm.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? UnitExp { get; init; }

Property Value

int?

Methods

WithCount(int)

A copy of this codec carrying count values (W33); 0 or 1 is one value, written as no count at all.

public CatalogCodec WithCount(int count)

Parameters

count int

The count.

Returns

CatalogCodec

The copy.