Expand description
The C++ backend of CodecTarget.
The third spelling of the same walk, and the closest to C’s of the three — which makes the places it still differs the interesting ones:
- References, not pointers. A codec takes
const T &v, soCodecTarget::memberisv.xandCodecTarget::handoffhands the value. C’s&v->xhas no counterpart here and neither does its array decay: aT[2][3]is astd::array<std::array<T, 3>, 2>, which is a value. - Methods, not free functions.
runtime/cppnames them exactly as the walk asks —write_u32,finish_dheader— so unlike Java nothing is re-cased. A codec for a type is astaticfree function in the probe’s translation unit, which C++ does have. - A
std::vectorknows its own size.count_ofis.size()andmake_roomis.resize(n); C’s_lengthand_bufferhave no counterpart and neither does its allocation guard, becauseresizethrows rather than returning nothing. - A plain pointer for
@optional. An absent member isnullptrand presence is!= nullptr(XTypes 1.3 §7.5.1.2.4.2); the codec reaches the value throughCodecTarget::behind_indirectionand a reader makes it withCodecTarget::make_indirection, the seams C uses for the same member. There is no flag beside the value, for the reasonadapter/java.rsgives for Java: a flag beside the value is two things that can disagree.
What is not different is the wire. runtime/cpp implements
DDS-XTypes 1.3 §7.4 from the clause and calls neither the Rust
runtime nor the C one.
Structs§
- Cpp
- The C++ backend.
Functions§
- enumerator_
constant_ name - The scoped name of one enumerator, as text.