GenoM IDL unions map onto C struct
s. The discriminator in the enum is
referred to as _d
, the union itself is referred to as _u
.
For instance, the following IDL:
union u switch(long) { case 1: long a; case 2: float b; default: char c; };
would map into
struct u { int32_t _d; union { int32_t a; float b; char c; } _u; };
Note that the C++ standard does not allow union members that have a
non-trivial constructor. Consequently, the C++ mapping for such kind
of unions is not allowed in GenoM either. This concerns
sequence
s and string
s, and structures or unions that
contain such a type. You should thus avoid to define such datatypes in
GenoM IDL in order to maximize the portability of your definitions.