Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters

Please confirm you want to mark all posts read

Mark all topics read

sp_MobileMenu Actions
Avatar

New/Updated Topics

Select Forum

sp_TopicIcon
Serializing structures with optional fields
Avatar
Sascha Kattelmann
Posts: 16
08/23/2019 - 02:39

1

Hi,

following the spec (part 6) on the serialization about structures with optional fields there is an encoding mask prefixed to the binary blob which contains the encoded fields. This encoding mask is 32 bits long and contains bit flags which show which fields are actually present in the blob.

I am wondering if that part of the spec is true. Having a look into the core model for some structure with optional fields we can see something like this:

<UADataType NodeId=”i=15904″ BrowseName=”DataSetFieldFlags”>
  <DisplayName>DataSetFieldFlags</DisplayName>
  <References>
    <Reference ReferenceType=”HasProperty”>i=15577</Reference>
    <Reference ReferenceType=”HasSubtype” IsForward=”false”>i=5</Reference>
  </References>
  <Definition Name=”DataSetFieldFlags” IsOptionSet=”true”>
    <Field Name=”PromotedField” Value=”0″ />
  </Definition>
</UADataType>

And looking at the parent data type we can see that we got an UInt16 (i=5) which kind of makes no sense regarding inheritance on structures. In fact every structure with optional fields seem to have a Byte, UInt16 or UInt32 as parent. This suggests that the parent data type is here actually not used in terms of inheritance but rather as the datatype for the encoding mask. Is that correct?

Avatar
Randy Armstrong
Posts: 1580
08/23/2019 - 08:25

2

There are no examples of optional fields or unions in the base specification.

You are looking at OptionSets which simply assign meaning to individual bits in an integer.

Avatar
Sascha Kattelmann
Posts: 16
08/26/2019 - 02:11

3

Many thanks for clearing this up, I got misguided by the naming. What you said is well explained in chap 3 8.41.

Another thing: what contributed to my misunderstanding was that option sets are not part of the serialization explanations in chap 6. Maybe this should be added there.

Forum Timezone:
America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 33

Devices in use: Phone (5), Desktop (28)

Forum Stats:
Groups: 2
Forums: 10
Topics: 1448
Posts: 4893