Class EnumTag

Enumerated tag support.

Handles enumMeta code mappings.

Enumerations in haystack don't have a first class mapping. There is no enum kind. Instead an enumerated point its kind tag set to Str with an additional enum tag that defines the enumerations to use. The string is comma separated and each enum should be a valid tag name.

The enumMeta record is a record that should be considered a singleton. This is used to reference enumerations that could be used on points and other parts of the system.

Hierarchy

  • EnumTag

Constructors

  • Constructs a new enum tag.

    Parameters

    • data: string | HGrid<HDict> | HStr | Record<string, number | number[]>

      A comma separated string of enumerations, enum grid or enum name to code object.

    Returns EnumTag

Properties

falseName?: string
trueName?: string

Accessors

Methods

  • Converts a boolean value to a name.

    Parameters

    • value: boolean | HBool

      The boolean value to convert.

    Returns undefined | string

    The name or undefined if not found.

  • Convert a code to a name.

    Parameters

    • code: number | HNum

      The enumeration code.

    Returns undefined | string

    The enumeration name or undefined if not found.

  • Returns Record<string, number[]>

    encodes the enumerations to an object.

  • Convert a name to a boolean value.

    Parameters

    • name: string | HStr

      The name to convert.

    Returns undefined | boolean

    The boolean value or undefined if not found.

  • Convert a name to a code.

    Parameters

    • name: string | HStr

      The enumeration name.

    Returns undefined | number

    The code for the enumeration or undefined if not found.

  • Decodes the enum meta record into some enum tags.

    Parameters

    • dict: HDict

      The enumMeta dict to decode.

    Returns Record<string, EnumTag>

    The decoded enum tag information.

  • Encodes the enum tags into an enum meta dict.

    Parameters

    • enumTags: Record<string, EnumTag>

      The enum tags to encode.

    Returns HDict

    The encoded enum meta record.

Generated using TypeDoc