Skip to main content

Module cpp

Module cpp 

Source
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, so CodecTarget::member is v.x and CodecTarget::handoff hands the value. C’s &v->x has no counterpart here and neither does its array decay: a T[2][3] is a std::array<std::array<T, 3>, 2>, which is a value.
  • Methods, not free functions. runtime/cpp names them exactly as the walk asks — write_u32, finish_dheader — so unlike Java nothing is re-cased. A codec for a type is a static free function in the probe’s translation unit, which C++ does have.
  • A std::vector knows its own size. count_of is .size() and make_room is .resize(n); C’s _length and _buffer have no counterpart and neither does its allocation guard, because resize throws rather than returning nothing.
  • A plain pointer for @optional. An absent member is nullptr and presence is != nullptr (XTypes 1.3 §7.5.1.2.4.2); the codec reaches the value through CodecTarget::behind_indirection and a reader makes it with CodecTarget::make_indirection, the seams C uses for the same member. There is no flag beside the value, for the reason adapter/java.rs gives 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.