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