Class FieldCodec
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
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
readerWireReaderThe reader.
fieldFieldPlanA byte-aligned numeric field (or list element, or position codec).
frameTickuintThe frame's tick, for
tickLo.destinationSpan<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
packReadOnlySpan<byte>The pack bytes.
offsetintThe first bit.
countintThe 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
readerWireReaderThe reader, positioned at the section's first byte.
sectionSectionPlanThe section.
frameTickuintThe tick of the frame being decoded, which
tickLorebuilds against.sinkTSinkReceives the values.
Type Parameters
TSinkThe 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
writerWireWriterThe writer.
fieldFieldPlanA byte-aligned numeric field (or list element, or position codec).
componentsReadOnlySpan<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
packSpan<byte>The pack bytes.
offsetintThe first bit.
countintThe width, 1 to 24.
valueuintThe value; bits above
countmust 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
writerWireWriterThe writer.
sectionSectionPlanThe section.
valuesFunc<FieldPlan, FieldValue>Supplies each field's value.