Table of Contents

Class FieldCodec

Namespace
Typhon.Protocol
Assembly
Typhon.Protocol.dll

Encodes and decodes one section of fields — a record body, an event or command payload — per 03-wire-protocol § 5 and decisions W11–W13: the leading bit pack, then each byte-aligned field in wire order.

public static class FieldCodec
Inheritance
FieldCodec
Inherited Members

Fields

MaxListComponents

The largest number of components one numeric decode yields, a list's included.

public const int MaxListComponents = 1020

Field Value

int

Methods

ReadNumber(ref WireReader, FieldPlan, uint, scoped Span<double>)

Decodes one numeric value of field into destination.

public static void ReadNumber(ref WireReader reader, FieldPlan field, uint frameTick, scoped Span<double> destination)

Parameters

reader WireReader

The reader.

field FieldPlan

A byte-aligned numeric field (or list element, or position codec).

frameTick uint

The frame's tick, for tickLo.

destination Span<double>

Receives Components values.

ReadPackedBits(ReadOnlySpan<byte>, int, int)

Extracts count bits starting at offset from a pack, least significant bit first (W12).

public static uint ReadPackedBits(ReadOnlySpan<byte> pack, int offset, int count)

Parameters

pack ReadOnlySpan<byte>

The pack bytes.

offset int

The first bit.

count int

The width, 1 to 24.

Returns

uint

The unsigned value.

ReadSection<TSink>(ref WireReader, SectionPlan, uint, ref TSink)

Decodes a section, handing each field's value to sink.

public static void ReadSection<TSink>(ref WireReader reader, SectionPlan section, uint frameTick, ref TSink sink) where TSink : IFieldSink, allows ref struct

Parameters

reader WireReader

The reader, positioned at the section's first byte.

section SectionPlan

The section.

frameTick uint

The tick of the frame being decoded, which tickLo rebuilds against.

sink TSink

Receives the values.

Type Parameters

TSink

The sink type; a struct keeps the call inlined.

WriteNumber(ref WireWriter, FieldPlan, scoped ReadOnlySpan<double>)

Encodes one numeric value of field.

public static void WriteNumber(ref WireWriter writer, FieldPlan field, scoped ReadOnlySpan<double> components)

Parameters

writer WireWriter

The writer.

field FieldPlan

A byte-aligned numeric field (or list element, or position codec).

components ReadOnlySpan<double>

At least Components values.

WritePackedBits(Span<byte>, int, int, uint)

Stores count bits of value at offset in a pack, least significant bit first.

public static void WritePackedBits(Span<byte> pack, int offset, int count, uint value)

Parameters

pack Span<byte>

The pack bytes.

offset int

The first bit.

count int

The width, 1 to 24.

value uint

The value; bits above count must be zero.

WriteSection(ref WireWriter, SectionPlan, Func<FieldPlan, FieldValue>)

Encodes a section from values, which is asked for each field in wire order.

public static void WriteSection(ref WireWriter writer, SectionPlan section, Func<FieldPlan, FieldValue> values)

Parameters

writer WireWriter

The writer.

section SectionPlan

The section.

values Func<FieldPlan, FieldValue>

Supplies each field's value.