JSON BinPack  0.0.1
A space-efficient open-source binary JSON serialization format based on JSON Schema with both schema-driven and schema-less support.
sourcemeta::jsonbinpack::ROOF_TYPED_ARRAY Struct Reference

The encoding consists of maximum minus the length of the array encoded as a Base-128 64-bit Little Endian variable-length unsigned integer followed by the elements of the array encoded in order. The encoding of the element at index i is either prefix_encodings[i] if set, or encoding. More...

#include <runtime_plan.h>

Public Attributes

const std::uint64_t maximum
 The maximum length of the array.
 
const SinglePlan encoding
 Element encoding.
 
const MultiplePlans prefix_encodings
 Positional encodings.
 

Detailed Description

The encoding consists of maximum minus the length of the array encoded as a Base-128 64-bit Little Endian variable-length unsigned integer followed by the elements of the array encoded in order. The encoding of the element at index i is either prefix_encodings[i] if set, or encoding.

Options

Option Type Description
maximum uint The maximum length of the array
prefixEncodings encoding[] Positional encodings
encoding encoding Element encoding

Conditions

Condition Description
len(prefixEncodings) <= maximum The number of prefix encodings must be less than or equal to the maximum array length

Examples

Given the array [ true, false, 5 ] where the maximum is 3, the prefixEncodings options corresponds to BYTE_CHOICE_INDEX with choices [ false, true ] and BYTE_CHOICE_INDEX with choices [ false, true ] and encoding corresponds to BOUNDED_MULTIPLE_8BITS_ENUM_FIXED with minimum 0 and maximum 255, the encoding results in:

+------+------+------+------+
| 0x00 | 0x01 | 0x00 | 0x05 |
+------+------+------+------+
size true false 5