Skip to content

Support for 1.04 multidimensional array encodings #161

Closed
@bjakke

Description

@bjakke

1.04 allows multidimensional arrays outside of Variants, e.g. as Structure fields. Part 6 section 5.2.5 adds logic on how such arrays are binaryencoded:

Multi- dimensional Arrays are encoded as an Int32 Array containing the dimensions followed by
a list of all the values in the Array. The total number of values is equal to the product of the
dimensions. The number of values is 0 if one or more dimension is less than or equal to 0. The
process for reconstructing the multi - dimensional array is described in 5.2.2.16.

So it somewhat behaves like multidimensional arrays inside a Variant. However with one crucial difference: in variant there is a field for the lenght on the actual value, in this new form that is missing and needs to be calculated.

Within a Variant a multidimensional array of String objects would be encoded as Int32, (each String individually in order per Variant spec), Int32 for ArrayDimensions lenght, (each Int32 separately for the array). This is equal for 2x normal 1-dim Array encoding rules of 5.2.5, as simpified: Int32, String array data, Int32, Int32 array data.

However the generic the multidim array encoding rule for the same multidim array of Strings is instead Int32, Int32 array data, String array data. This means it cannot be resolved by using a combination of 1-dim array encoding rules in Structure serializers, therefore we need new logic for encoding/decoding N dimensional arrays (and with a note that the 1-dim array encoding stays as is, i.e. the new logic only applies to 2+ dim arrays).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions