View Issue Details

IDProjectCategoryView StatusLast Update
000547910000-003: Address SpaceSpecpublic2021-10-11 22:05
ReporterZbynek Zahradnik Assigned ToJeff Harding  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Summary0005479: OptionSet encoding as UInteger is not described
Description

Table "FieldMetaData Structure" says for builtInType field: "(5) OptionSet DataTypes are either encoded as one of the concrete UInteger DataTypes or as an instance of an OptionSetType in an ExtensionObject.".

I could not find the encoding rules for "one of the concrete UInteger DataTypes" anywhere, and I think it should be elaborated on.

For example, when the builtInType is UInt16, how is the OptionSet encoded? This comes to my mind:

a) One UInt16 value, representing the Value, and assuming that all ValidBits are 1 [probably not this case],
b) One UInt16 value split in half, with 8 bits representing the option set Value and 8 bits representing the ValidBits [probably not this case either]
c) Two UInt16 values where the first is the Value and the second are the ValidBits [I think this is what the spec meant, but currently it is not described and in fact the text contradicts this solution, because it says it is encoded as "one" of the concrete data types, not two...]

What's more, this is in part that is not tied to a particular message mapping. The text should therefore also describe how the encoding will look like in JSON, or ideally in some more general sense any mapping that uses "named" fields - so, there should be rules specified for such mappings.

TagsNo tags attached.
Commit Version
Fix Due Date

Relationships

related to 0007355 closedJeff Harding OptionSet with <= 64 bits on wire 

Activities

Zbynek Zahradnik

2020-02-24 19:55

developer   ~0011626

After further investigation it looks like that the actual spec intent might have been option a) above; but still I could not find where is it described.

Zbynek Zahradnik

2020-02-27 17:50

developer   ~0011631

The underlying source of my confusion seems to be the fact that I cannot find the OptionSet (used in italics) defined anywhere. Either it is missing, or it is meant to always refer to OptionSet DataType - but in that case it would be incorrect at many places, because there are OptionSet-s not derived from the OptionSet DataType.

The issue thus better belongs to Part 3.

Zbynek Zahradnik

2020-03-05 19:01

developer   ~0011697

Discussed with Matthias. He suggests to extend the definition of OptionSet (which includes not just OptionSet DataType, but also OptionSet-s derived from UInteger) to OptionSet DataType chapter in Part 3. It should also refer to the DataType NodeClass where some of these definitions are already in the description of OptionSetValue property.

Zbynek Zahradnik

2020-05-26 10:51

developer   ~0012107

Below is a summary of where and how the option set is mentioned in the specs. The summary does not contain all references, but all relevant pieces should be there. I think the main problem is right at the beginning, with the formulation "...subtypes of UInteger representing an OptionSet". The OptionSet set is in italics, so it must be a term. It is not defined as a standalone term, so it probably refers to OptionSet DataType. But if so, then it is completely undefined how can subtypes of UInteger represent an OptionSet (a completely different DataType). My original understanding (as reflected in the Mantis issue description, which started from Part 14) was that if a UInteger represents an OptionSet, it should represent it in its entirety, that is, both its 'value' and 'validBits' parts. But it looks like that it does not: It is only the 'value' part, and the 'validBits' are assumed to be all '1'. The spec does not say it anywhere though. The second problem is that the fact that datatype A somehow "represents" B is fairly exceptional concept and should also be explained and not just left to guessing. I would see it more understandable if some term is introduced to cover both the "true" OptionSet (DataType) and the "fake" OptionSet-s based on UIntegers, and this term is then used when the general "idea" of option sets is meant. WIthout it, it is never clear when OptionSet is the actual DataType, or it can also be some UInteger.

Part 3:

5.8.3 DataType NodeClass

Table 16:
Explains that DataTypeDefinition attribute is mandatory for
"DataTypes derived from Enumeration, OptionSet and subtypes of UInteger representing an OptionSet. For such DataTypes, the Attribute contains a structure of the DataType EnumDefinition. The EnumDefinition DataType is defined in 8.50. It is a subtype of DataTypeDefinition."

OptionSetValues property:
"The OptionSetValues Property only applies for OptionSet DataTypes and UInteger DataTypes. An OptionSet DataType is used to represent a bit mask and the OptionSetValues Property contains the human-readable representation for each bit of the bit mask. The OptionSetValues Property provides an array of LocalizedText containing the human-readable representation for each bit. "

8.41 OptionSet

"This abstract DataType is the base DataType for all DataTypes representing a bit mask. All OptionSet DataTypes representing bit masks shall inherit from this DataType."
Table 33 follows, with OptionSet Definition having fields 'value' and 'validBits'.
"The DataType Nodes representing concrete subtypes of the OptionSet shall have an OptionSetValues Property defined in Table 16. "

8.50 EnumDefinition

This Structured DataType is used to provide the metadata for a custom Enumeration or OptionSet DataType. It is derived from the DataType DataTypeDefinition. The EnumDefinition is formally defined in Table 35.
{EnumField has 'value' and 'name'; 'value' is the bit number}

Part 4:

nothing

Part 5:

7.17 OptionSetType
{ this is a VariableType, an alternative to DataType OptionSet }

Part 6:

Part 14

6.2.2.1.3 FieldMetaData
builtInType: "(5) OptionSet DataTypes are either encoded as one of the concrete UInteger DataTypes or as an instance of an OptionSetType in an ExtensionObject.".

Jeff Harding

2020-06-15 18:04

developer   ~0012311

Added UInteger DataType to description of OptionSetValues

Jim Luth

2020-08-18 16:13

administrator   ~0012693

Agreed to changes in telecon.

Issue History

Date Modified Username Field Change
2020-02-24 07:27 Zbynek Zahradnik New Issue
2020-02-24 19:55 Zbynek Zahradnik Note Added: 0011626
2020-02-27 17:50 Zbynek Zahradnik Note Added: 0011631
2020-03-05 18:58 Jim Luth Project 10000-014: PubSub => 10000-003: Address Space
2020-03-05 19:01 Zbynek Zahradnik Note Added: 0011697
2020-05-26 10:51 Zbynek Zahradnik Note Added: 0012107
2020-05-26 15:54 Jim Luth Assigned To => Jeff Harding
2020-05-26 15:54 Jim Luth Status new => assigned
2020-06-15 18:04 Jeff Harding Status assigned => resolved
2020-06-15 18:04 Jeff Harding Resolution open => fixed
2020-06-15 18:04 Jeff Harding Fixed in Version => 1.05
2020-06-15 18:04 Jeff Harding Note Added: 0012311
2020-08-18 16:13 Jim Luth Status resolved => closed
2020-08-18 16:13 Jim Luth Note Added: 0012693
2021-10-11 22:05 Jim Luth Relationship added related to 0007355