Fast Sequence/Group Component Decoding

fast-protocol

#1

hello everyone,

i am really confused by the description in fast specification pertaining to <sequence…> decoding. please enlighten me with the answers for a couple of question listed below.

  1. does component needs a pmap bit in the upper level component (because sequence component can be nested in any other component)? I guess it depends on how field is defined (for exmaple if field needs a pmap bit in upper level component, doesn’t have to have one no matter it is mandatory or optional), am i right?
  2. sometimes needs to have its own pmap, which is usually encoded at beginning of the after length field. when does it exactly require one?
  3. does require a pmap bit at all? if yes, under which situation it requires one?

please advise

many thanks & regards
Fengwei


#2

Section 6.2.5 in the spec is what you need (although a little minimalistic and hard to digest):

A sequence field instruction specifies that the field in the application type is of sequence type and that the contained group of instructions should be used repeatedly to encode each element. If any instruction of the group needs to allocate a bit in a presence map, each element is represented as a segment in the transfer encoding.

A sequence has an associated length field containing an unsigned integer indicating the number of encoded elements. When a length field is present in the stream, it must appear directly before the encoded

Fields occupy 0, 1 or 2 bits (decimals only) in the presence map.

The length field of a sequence, which is of integer type, can occupy 0 or 1 bits, depending on field instruction. That bit, if any, is placed in the PMAP of the message/group where the sequence is declared. Hence, a sequence can occupy 0 or 1 bit in the PMAP, regardless of the contents of the sequence.

If any field of the content of the sequence requires a PMAP bit, then each element of the sequence will be encoded as a segment, meaning that it will have a separate PMAP before any fields.

For example, using this template:

<template name="Message">
  <sequence name="List1"><length><default value="0"/></length>
    <uInt32 name="Content1"/>
  </sequence>
  <sequence name="List2">
    <uInt32 name="Content2"><default value="0"/></uInt32>
  </sequence>
</template>
  • Message will have a PMAP.
  • List1 need one bit in the Message PMAP.
  • Content1 does not need a presence bit.
  • List2 does not need a presence bit.
  • Content2 need one bit in the List2 element PMAP.

For example, the message { List1: [ 1, 2 ], List2: [ 3, 4 ] } is encoded as:

PMAP of Message
TID
Length of List1 = 2
1
2
Length of List2 = 2
PMAP1
3
PMAP2
4

I hope this helps.

Regards,
Mikael Brännström


#3

Hello Mikael,

thanks a lot for the explanation in details.
i have a follow up question.
is there anywhere in specification indicates that if sequence is optional it will have no extra pmap encoding at beginning of this sequence? (i did search the whole document for such statement, i didn’t find it)

please advise

thanks & regards
Fengwei


#4

The presence of a sequence is applied to the length field. So an optional sequence means that that the length is optional, and uses the nullable integer encoding. No extra presence bit is needed.

E.g. in the basic form, a nullable unsigned integer length X is encoded as X+1 if present, or zero if not present (see section 10.6.1).


#5

hi,

thanks for the explanation.
if pmap bit for length field is set to 0, the whole sequence can be skipped, am i right?

thanks & regards
fengwei


#6

It depends on the operator applied to the sequence length.

Some operators use a bit in the PMAP. When that bit is set, a value is present in the transfer encoding, otherwise not. How to interpret the transfered value depends on the operator.

For example copy operator will use the last value if not present, otherwise use the transfered value. A default operator will use the default value whenever the value is not present in the transfer encoding.


#7

got it.

thank you very much

best regards
fengwei