Previous Table of Contents Next


10.5.11 UnionDef


   A UnionDef represents an OMG IDL union definition.

   module CORBA { struct UnionMember {

Identifier name;
any label;
TypeCode type;
IDLType type_def;
};

   typedef sequence <UnionMember> UnionMemberSeq;

   interface UnionDef : TypedefDef, Container {

   readonly attribute TypeCode discriminator_type;

   attribute IDLType discriminator_type_def;

   attribute UnionMemberSeq members; }; };

   10.5.11.1 Read Interface

   The discriminator_type and discriminator_type_def attributes describe and identify the union’s discriminator type.

   The members attribute contains a description of each union member. The label of each UnionMemberDescription is a distinct value of the discriminator_type. Adjacent members can have the same name. Members with the same name must also have the same type. A label with type octet and value 0 indicates the default union member.

   The inherited type attribute is a tk_union TypeCode describing the union.

   10.5.11.2 Write Interface

   Setting the discriminator_type_def attribute also updates the discriminator_type attribute and setting the discriminator_type_def or members attribute also updates the type attribute.

   When setting the members attribute, the type member of the UnionMember structure should be set to TC_void.

   A UnionDef used as a Container may only contain StructDef, UnionDef, or EnumDef definitions.