Skip to main content

Module try_construct

Module try_construct 

Source
Expand description

What a receiving type does with a value it cannot hold.

DDS-XTypes 1.3 §7.2.2.7 and §7.3.1.2.1.12. The behaviour belongs to the position — a member, a collection element, a map key, a union case, the discriminator — and not to the type, because one typedef string<5> may be used at two positions that want different answers. So it arrives here as an argument, exactly as it arrives at the C runtime as zdw_try_construct.

The bound is not on the wire. Both sides serialise and deserialise the same bytes and the whole difference is what the receiving side decides, which is why crates/ast-layout/tests/fixtures/try_construct_behaviour.md records behaviours rather than byte strings. OpenDDS is the only one of the five implementations that implements USE_DEFAULT and TRIM; Cyclone, RTI 7.7 and omniORB discard whatever the annotation says, and Fast DDS cannot generate code for the annotation in any position.

Every caller reads the whole value off the wire before it gets here. A reader that stopped at its own bound would leave the rest in the stream and put every following member at the wrong offset — OpenDDS consumes the whole twelve-character string before it defaults or truncates, and the members after it come back correct, which is the property that matters.

Enums§

Narrowed
What a narrowing decided.
TryConstruct
The three behaviours §7.3.1.2.1.12 names.

Functions§

fit_map
A map that has been read whole, against the receiver’s bound.
fit_map_entries
A map held as its entries (XTypes 1.3 §7.5.1.3.6) that has been read whole, against the receiver’s bound, which counts entries.
fit_sequence
A sequence that has been read whole, against the receiver’s bound.
fit_string
A string that has been read whole, against the receiver’s bound.
fit_wstring
A wstring that has been read whole, against the receiver’s bound.