Class Sealed
public sealed class TableDefinition

Namespace: SharpMeter.Core.Tables

Defines the structure of a PSEM table — its ID, name, expected size, and field layout.

Properties

NameDescription
Description Gets the human-readable description.
DisplayName Gets the display name (e.g., "ST0" or "MT64").
DisplayNumber Gets the display number (0-2047 for ST, offset by 2048 for MT).
ExpectedSize Gets the expected table size in bytes. 0 means variable-length.
Fields Gets the ordered list of field definitions.
IsStandard Gets whether this is a standard table (ID 0-2047) or manufacturing table (2048-4095).
Name Gets the table name (e.g., "General Configuration Table").
Prefix Gets the display prefix ("ST" or "MT").
TableId Gets the table ID (0-4095).

Description

string TableDefinition.Description { get; init; }

Gets the human-readable description.

DisplayName

string TableDefinition.DisplayName { get; }

Gets the display name (e.g., "ST0" or "MT64").

DisplayNumber

int TableDefinition.DisplayNumber { get; }

Gets the display number (0-2047 for ST, offset by 2048 for MT).

ExpectedSize

int TableDefinition.ExpectedSize { get; init; }

Gets the expected table size in bytes. 0 means variable-length.

Fields

ImmutableArray<TableFieldDefinition> TableDefinition.Fields { get; init; }

Gets the ordered list of field definitions.

IsStandard

bool TableDefinition.IsStandard { get; }

Gets whether this is a standard table (ID 0-2047) or manufacturing table (2048-4095).

Name

string TableDefinition.Name { get; init; }

Gets the table name (e.g., "General Configuration Table").

Prefix

string TableDefinition.Prefix { get; }

Gets the display prefix ("ST" or "MT").

TableId

ushort TableDefinition.TableId { get; init; }

Gets the table ID (0-4095).

View Source
/// <summary>
///     Defines the structure of a PSEM table — its ID, name, expected size, and field layout.
/// </summary>
public sealed class TableDefinition
{
#region Properties
    /// <summary>Gets the table ID (0-4095).</summary>
    public required ushort TableId { get; init; }
    /// <summary>Gets the table name (e.g., "General Configuration Table").</summary>
    public required string Name { get; init; }
    /// <summary>Gets the human-readable description.</summary>
    public string Description { get; init; } = string.Empty;
    /// <summary>Gets the expected table size in bytes. 0 means variable-length.</summary>
    public int ExpectedSize { get; init; }
    /// <summary>Gets whether this is a standard table (ID 0-2047) or manufacturing table (2048-4095).</summary>
    public bool IsStandard => TableId <= 2047;
    /// <summary>Gets the display prefix ("ST" or "MT").</summary>
    public string Prefix => IsStandard ? "ST" : "MT";
    /// <summary>Gets the display number (0-2047 for ST, offset by 2048 for MT).</summary>
    public int DisplayNumber => IsStandard ? TableId : TableId - 2048;
    /// <summary>Gets the display name (e.g., "ST0" or "MT64").</summary>
    public string DisplayName => $"{Prefix}{DisplayNumber}";
    /// <summary>Gets the ordered list of field definitions.</summary>
    public required ImmutableArray<TableFieldDefinition> Fields { get; init; }
#endregion
}
Was this page helpful?