Resources | Resources |



IDL union in C++

An IDL union is mapped to a C++ struct, consisting of a discriminator and a union containing all the type declarators of the discriminated union. The name of the discriminator is '_d' and the declarator of the union is '_u'.

For example:

union u switch(color)
  case RED: 
   IFoo foo;
  case GREEN:
  case BLUE:
   long l;
   short s;

is mapped as:

struct u
  color _d;
  union {
   IFoo* foo;
   int l;
   short int s;
  } _u;

Note: Union discriminators must be specified by the caller and may not be changed by the callee for rout and inrout parameters.