Class DatumStreamMetadataRegistry

A registry of datum stream metadata instances for object (node or location) and source ID combinations.

This registry acts like a map of (stream ID) -> metadata as well as (object ID, source ID) -> metadata.

Hierarchy

  • DatumStreamMetadataRegistry

Constructors

Properties

#metaList: DatumStreamMetadata[]

The metadata.

#metaMap: Map<string, DatumStreamMetadata>

A map of stream ID to associated metadata.

Methods

  • Get the index of the metadata with a specific stream ID.

    Parameters

    • streamId: string

      the stream ID to get the index of

    Returns number

    the found index, or -1 if not found

  • Get the first available metadata for a given object and source ID combination.

    Parameters

    • objectId: number

      the object ID of the metadata to get

    • sourceId: string

      the source ID of the metadata to get

    • Optional kind: DatumStreamType

      optional kind to get; if not provided the first metadata to match the given objectId and sourceId will be returned

    Returns undefined | DatumStreamMetadata

    the associated metadata, or undefined if none available

  • Get a list of all available stream IDs in insertion order.

    Returns string[]

    all available metadata stream ID values in the same order as added to this registry

  • Get this object as a standard JSON encoded string value.

    The returned JSON is an array of the toJsonEncoding() result of all metadata in the registry. An example result looks like this:

    [
    {
    "streamId": "7714f762-2361-4ec2-98ab-7e96807b32a6",
    "zone": "Pacific/Auckland",
    "kind": "n",
    "objectId": 123,
    "sourceId": "/power/1",
    "i": ["watts", "current", "voltage", "frequency"],
    "a": ["wattHours"]
    },
    {
    "streamId": "5514f762-2361-4ec2-98ab-7e96807b3255",
    "zone": "America/New_York",
    "kind": "n",
    "objectId": 456,
    "sourceId": "/irradiance/2",
    "i": ["irradiance", "temperature"],
    "a": ["irradianceHours"]
    }
    ]

    Returns string

    the JSON encoded string

Generated using TypeDoc