SofaBuffers TypeScript - v0.11.0
    Preparing search index...

    Class ElementSeq<T>

    The slots of a wrapper-sequence array: the index rules of MESSAGE_SPEC §5.1 and the two bounds of CORELIB_PLAN §6.2.1, once, for any element type.

    StringSeq and BlobSeq place leaf elements through it, and generated code places a framed element — a struct / union / nested row — through it directly: reserve at the element's sequenceBegin, then build the child into out[id]. The element kind changes which path arrives here and nothing else, which is the point — the bound is the index (§7.2 item 8).

    The destination array; grown to id + 1 as elements arrive.

    The element default, written into a gap and into a reserved slot.

    The schema count as an index capacity: id >= cap is INVALID (§7.1) — a statement about validity. Pass UNBOUNDED (-1) for an array the schema left open, where receiverCap governs instead.

    The schema field name, used only in a rejection message.

    The receiver-side index cap for a schema-unbounded array (§6.2.1): id >= receiverCap is LIMIT_EXCEEDED, a policy rejection. There is no unlimited setting — a wrapper array announces no count, so the index is the only place a receiver can bound it. Required, with no default: the number is generated code's, and falling back to ARRAY_MAX would report a policy rejection against a format ceiling nobody configured (§6.2.1). A value that states no cap at all — negative, NaN, Infinity — is Argument at construction, never LIMIT_EXCEEDED (requireReceiverBound).

    Type Parameters

    • T
    Index
    • Type Parameters

      • T

      Parameters

      • out: T[]
      • def: T
      • cap: number
      • name: string
      • receiverCap: number

      Returns ElementSeq<T>

    cap: number
    def: T
    name: string
    out: T[]
    receiverCap: number
    • The two index bounds, without growing: the schema count as validity (INVALID) or, where the schema left the array open, the receiver cap as capacity (LIMIT_EXCEEDED). Never both — §6.2.1 keeps a cap off a field the schema already bounds, which is why one bound can stand for both.

      Split out from reserve because a leaf element is bound-checked at its length word, before its payload has arrived and so before there is anything to place (StringSeq.begin).

      Parameters

      • id: number

      Returns void

    • What reserve does, then value written into the slot. A repeat replaces (§7.4).

      Written out rather than delegating to reserve: on the baseline tier a call is not free, and this is the per-element path. The check still precedes the growth, which is the property §7.2 item 8 asks for.

      Parameters

      • id: number
      • value: T

      Returns void

    • Bound-check id and grow out to id + 1, filling any gap — and the slot itself — with the element default.

      The check runs before the growth, which is the whole of §7.2 item 8's "after a rejected id the container is not left partially extended": a rejection leaves out exactly as it was, so a lower id delivered afterwards still lands at its own index.

      Parameters

      • id: number

      Returns void