[Question] Misunderstanding about offset attribute inside a <composite> tag
cardefusco opened this issue · 2 comments
Inside section 04MessageSchema.md there are described all attributes of tag .
I have a question about the attribute offset inside a <composite> tag. I understand that inside a <composite> could be other types described by tags: <types>, <enum>, <set> and maybe also other <composite>.
Each of these tag can indicate where is located from the beginning of the composite in which is declarated. This for me make sense.
However, why there is the attribute "offset" also for tag <composite> ? and what is it its goal?. This should describe only a new type made by the union of others type.
For example, if I have this composite:
<composite name="groupSizeEncoding" description="Repeating group dimensions" offset="10">
<type name="blockLength" primitiveType="uint8"/>
<type name="numInGroup" primitiveType="uint8" semanticType="NumInGroup"/>
</composite>
How should I interpret the value "10" of offset for the "groupSizeEncoding" inside a message that have a group with dimensionType="groupSizeEncoding" like this ?:
<group id="5" dimensionType="groupSizeEncoding" name="FreeText">
<field id="1" name="freeText" presence="optional" type="char"/>
</group>
@cardefusco which version of SBE are you referring to?
In version 1.0 a composite type is allowed to have offset, but I agree that it isn't clear how to interpret that.
In version 2.x release candidates, composite, like other elements, can be specified with either offset or alignment. Alignment and offset are intended to be mutually exclusive. (We had to roll back the XML schema version from 1.1 which could have enforced that rule with an assertion because not all programming languages support it.) Again offset doesn't make a lot of sense for group dimension but alignment might, to align on a boundary irrespective of the previous block size.
I am referring to SBE 2.x release candidate as described here https://github.com/FIXTradingCommunity/fix-simple-binary-encoding/blob/master/v2-0-RC2/doc/04MessageSchema.md
So my question is, if as you assert offset doesn't make a lot of sense for group dimension, which is the utility of have "offset" as attribute of a composite? Could be removed?