![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
07/09/2019
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
07/09/2019
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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.
1 Guest(s)