Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Misunderstanding about offset attribute inside a <composite> tag #122

Open
cardefusco opened this issue Jun 4, 2020 · 2 comments

Comments

@cardefusco
Copy link

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>
@donmendelson
Copy link
Member

@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.

@cardefusco
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants