Key points for parsing pmap and sequence in the fix/fast Protocol
Wu Yu
Taiyan Network Studio
Due to the upgrade, I sorted out a fix/fast parsing code written by my old brother. What keeps me confused about pmap and sequence solutions (because the code is actually problematic), and I have not found any relevant documents. I downloaded the quickfast installation package, paid for the installation, and found it more complicated. Fortunately, only a little bit is used to understand these two things.
Pmap may not exist.
This is a fatal trap. The first data of a normal message is pmap, and the first bit of this pmap is the TID of the message. A normal message must have pmap.
But for sequence, the first data after it is the length of the sequence. The next data may be pmap or formal data. If yes or no, it will be wrong.
Because no relevant documents can be found, you have to check the quick fast code. The quickfast code shows whether pmap is related to the use of pmap based on all the filed in the template. If all fields in this template can be determined without pmap, pmap will not appear. For example:
<Sequence name = "bidpricelevel" presence = "optional">
<Lengthname = "nobidpricelevel" id = "10068" presence = "optional"/>
<Int64name = "bidsize" id = "134"/>
<Int32name = "bidpx" id = "132" decimalplaces = "3"/>
</Sequence>
Because the field operator in sequence is none, this sequence will not have pmap. If yes or no, it should be calculated after the template is loaded.
Explicit and implicit sequence length representation.
In the above example, the first field in sequence refers to the number of all sequence, which only needs to be read once. Never regard it as a field in sequence. Another implicit method may be more rational, as shown below:
<Sequence id = "73" presence = "optional" name = "orders">
<Uint32 id = "38" presence = "mandatory" name = "orderqty"/>
</Sequence>
The fast template is a self-similar structure.
Self-similarity is another expression of fragment, that is, the whole is very similar to the local image. It is taken out separately. You cannot tell which is the whole and which is the local image. This function is described as recursion. It is called layer by layer, but the same function is called. Quickfast uses dozens of classes for parsing. I have finished using only three classes.