Source: Real-Time Innovations ( Gerardo Pardo-Castellote)
The IDL4 spec syntax for bitsets departed from the one used in DDS-XTYPES.
In DDS XTYPES a bitset is defined like an enumeration with some extra annotations. For example:
This defined the total number of bits in the bitset (16) as well provided symbolic names for the bits (FLAG_0), ... It also allowed the bit assignment to be defaulted (e.g. FLAG_0, FLAG_1) or explicitly assigned.
It is unclear how to do this in IDL4.
On the one hand one could write
This would indicate each flag uses one bit. But it would not constrain the size of the overall bitset, nor the bit values for the flags.
One could also say:
According to 188.8.131.52.3.2 the second integer would specify that the representation should use a 16-bit integer. But nowhere it is stated that all these will be reusing the same 16-bit integer...
Also bitsets can appear inside other structures as in (see 184.108.40.206.3.2):
Where it is stated that bitsets that appear sequentially should be put together. This seems non-intuitive and brittle... In fact the spec recommends not to mix bitsets with other types for readability...
This syntax seems a bit arbitrary and also hard to process by IDL compiler. The XTYPES approach was simpler. If the goal was to avoid "re-purposing" the "enum" then IDL4 could have defined a new keyword, but yet use similar syntax/approach as XTYPES as in:
This is less ambiguous as it separates clearly the size of the bitset from the actual flags-names used for each bit. It also allows the user to not bother assigning explicit values to each bit. Finally the syntax is closer to that of enumeration so it is much easier for IDL parsers to handle it.
Reported: IDL 4.0 — Wed, 10 Aug 2016 15:15 GMT
Disposition: Resolved — IDL 4.1
Redesign of bitsets
In the previous version of IDL4, bit sets were created to serve two main purposes in a single construct, namely::
- Bit fields (à la C/C++)
- Named accesses to individual bits (as in XTypes)
Rationale for that "all-in-one" approach was to avoid introducing too many new IDL keywords. However, the result was deemed difficult to understand and to implement (notably because a struct had then different meanings and implementation depending if it contains or not bit fields) and not fully compliant with what was designed in XTypes.
The proposal is thus to separate those two things and to design accordingly two different constructs.
The consequence is that it introduces 2 new keywords (bitfield and bitmask) in addition to the existing one (bitset), which is not that annoying as they should not collide too often with existing identifiers (and if they do, IDL provides a mechanism to mitigate the collision).
Updated: Thu, 6 Apr 2017 13:50 GMT