Handle implied padding in composite types and at end of blocks#7
Open
threewholefish wants to merge 2 commits intokizzx2:masterfrom
Open
Handle implied padding in composite types and at end of blocks#7threewholefish wants to merge 2 commits intokizzx2:masterfrom
threewholefish wants to merge 2 commits intokizzx2:masterfrom
Conversation
added 2 commits
May 11, 2022 18:37
Some composite component types have an offset value, which can imply padding between components. By adding the offset attribute to the Type class, we can check if padding needs to be added.
If the total length of fields in a block is less than the given block length, then padding needs to be added up to said length.
Owner
|
Can you provide example data of when this is needed? |
Author
|
An example of padding within the composite is the following from the CME MDP3 spec: <composite name="groupSize8Byte" description="8 Byte aligned repeating group dimensions" semanticType="NumInGroup">
<type name="blockLength" description="Length" primitiveType="uint16"/>
<type name="numInGroup" description="NumInGroup" offset="7" primitiveType="uint8"/>
</composite>
An example of padding at the end of blocks is the following from the same spec: <group name="NoMDEntries" id="268" description="Number of Trade Summary entries" blockLength="32" dimensionType="groupSize">
<field name="MDEntryPx" id="270" type="PRICE" description="Trade price" offset="0" semanticType="Price"/>
<field name="MDEntrySize" id="271" type="Int32" description="Consolidated trade quantity" offset="8" semanticType="Qty"/>
<field name="SecurityID" id="48" type="Int32" description="Security ID as defined by CME" offset="12" semanticType="int"/>
<field name="RptSeq" id="83" type="uInt32" description="Sequence number per instrument update" offset="16" semanticType="int"/>
<field name="NumberOfOrders" id="346" type="Int32NULL" description="The total number of real orders per instrument that participated in a match step within a match event" offset="20" semanticType="int"/>
<field name="AggressorSide" id="5797" type="AggressorSide" description="Indicates which side is the aggressor or if there is no aggressor" offset="24" semanticType="int"/>
<field name="MDUpdateAction" id="279" type="MDUpdateAction" description="Market Data update action" offset="25" semanticType="int"/>
<field name="MDEntryType" id="269" type="MDEntryTypeTrade" description="Market Data entry type" semanticType="char"/>
<field name="MDTradeEntryID" id="37711" type="uInt32NULL" description="Market Data Trade entry ID" offset="26" sinceVersion="7" semanticType="int"/>
</group>This is the same problem as in #5, which is that the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was some code to handle implied padding, but it didn't quite go far enough for some functions.
The first type of padding is between composite type components, as indicated by the
offsetattribute of said components.The second is padding at the end of blocks to make the total length equal to the stated
blockLengthThis happens for message fields (groups do not count towards the messageblockLength) and group fields.