pub enum EnumeratorValue {
Declared,
Ordinal,
}Expand description
Which integer an enumerator serialises as.
XTypes 1.3 §7.4.3.5.3 rule (5) is
XCDR << {O : ENUM_TYPE} = XCDR << { O.value : O.holder_type }, and
IDL 4.2 §7.4.13 gives O.value as the @value(n) the enumerator
declares, else the previous enumerator’s value plus one, starting at
zero. So the clause has an answer, and it is Self::Declared.
§What is measured
Two front ends drop @value and number the enumerators by position,
and 40 recorded rows differ by exactly that. enum-negative-value,
enum-sparse-values, enum-bitbound-{8,16,32}-value and their
unannotated twins, OpenDDS, both encoding versions and both byte
orders — the same length in every row, and the first differing octet
is octet 0:
enum-negative-value @value(-1) MINUS, @value(0) ZERO, @value(2147483647) MAX
ours ffffffff 7fffffff
theirs 00000000 00000002
enum-sparse-values @value(1) OK, @value(100) WARN, @value(65535) FAIL
ours 0000ffff 00000001 00000064
theirs 00000002 00000000 00000001
enum-bitbound-8-value @value(3) RED, @value(9) GREEN, @value(200) BLUE
ours 000000c8 00000009 ab
theirs 00000002 00000001 abopendds_idl answers error in lookup of symbol: bit_bound and the
same for value; tao_idl drops the annotation the same way —
docs/wire-feature-inventory.md row E1, and
warnings.rs::CLASSIFICATION already carries the warning with
carried_into: "E1". Cyclone, RTI and Fast DDS all carry @value.
Two front ends dropping the annotation and three carrying it is the
same shape as EnumHolderWidth, and it takes the same answer: not
an axis by judgement 3, and a setting all the same, because a
peer that writes the ordinal writes the ordinal whatever the reason
and a reader of the declared value is reading a different
enumerator.
§It is not the holder’s width, and the corpus separates them
The two questions look like one on enum-bitbound-8-value, where
OpenDDS’s octets differ from this project’s in both. They are not:
enum-negative-value declares no @bit_bound at all and still
differs, and enum-bitbound-8-plain declares @bit_bound(8) with no
@value and is closed by EnumHolderWidth alone. The 16 rows of
enum-bitbound-{8,16}-value need both — the four-octet holder
and the ordinal — which is why EnumHolderWidth closed 76 rows and
not the 92 an estimate gave, and why those 16 were the difference
between the causes named for OpenDDS and the rows measured open.
§It is not a planner setting
The holder’s width does not change, so no offset moves and no
EMHEADER length code changes. It stays out of LayoutKey::offset_key
for the same reason MapEntryOrder and UnionLabelMatch do.
§It is a reader setting
Unlike MapEntryOrder. All 40 rows reach a reader: a peer’s
00000002 is BLUE’s ordinal and this project’s MAX’s declared
value, and a decoder that took the pattern for a declared value would
name a different enumerator or none at all.
§No dialect selects the second value
For the reason EnumHolderWidth::BitBoundDroppedByFrontEnd is not
selected either: OpenDDS and TAO are recorded peers here rather than
presets, and a front-end defect is not a reading of §7.4.3.5.3.
--enumerator-value ordinal reaches it.
Variants§
Declared
The value IDL 4.2 §7.4.13 gives: @value(n), else the previous
enumerator’s value plus one, from zero.
The default, and what Cyclone, RTI and Fast DDS write.
Ordinal
The enumerator’s position in its declaration, from zero,
whatever @value says.
What a front end that does not know the annotation writes.
Identical to Self::Declared for an enumeration that declares
no @value — which is every enumeration in the corpus but five —
so the setting is invisible except where the annotation is.
Implementations§
Source§impl EnumeratorValue
impl EnumeratorValue
Sourcepub const fn is_default(self) -> bool
pub const fn is_default(self) -> bool
Whether this is the default.