If the input value corresponds to the index 0 to the enumeration choices, the encoding stores no data. Otherwise, the encoding consists of an index to the enumeration choices minus 1 encoded as an 8-bit fixed-length unsigned integer. More...
#include <runtime_plan.h>
Public Attributes | |
const std::vector< sourcemeta::jsontoolkit::JSON > | choices |
The set of choice values. | |
If the input value corresponds to the index 0 to the enumeration choices, the encoding stores no data. Otherwise, the encoding consists of an index to the enumeration choices minus 1 encoded as an 8-bit fixed-length unsigned integer.
Option | Type | Description |
---|---|---|
choices | any[] | The set of choice values |
Condition | Description |
---|---|
len(choices) > 0 | The choices array must not be empty |
len(choices) < 2 ** 8 | The number of choices must be representable in 8 bits |
value in choices | The input value must be included in the set of choices |
Given an enumeration [ "foo", "bar", "baz" ]
and an input value "bar"
, the encoding results in the unsigned 8 bit integer 0:
Given an enumeration [ "foo", "bar", "baz" ]
and an input value "foo"
, the value is not encoded.