Intended Usage
This method is intended to be used to create a TypeCode of kind tk_union, representing an IDL union.
Syntax
CORBA::TypeCode_ptr create_union_tc ( CORBA::RepositoryId rep_id, CORBA::Identifier name, CORBA::TypeCode_ptr discriminator_type, CORBA::UnionMemberSeq & members);
Input parameters
Return values
Example
/* Code to create a tk_union TypeCode corresponding to this IDL definition: union my_union switch (long) { case1: ulong my_ulong; case2: float my_float; }; */ /* assume op initialized */ extern CORBA::ORB_ptr op; CORBA::_IDL_SEQUENCE_UnionMember unm_seq; unm_seq.length(2); /* Set the member typecode and the member name for the first UnionMember */ unm_seq [0].type = CORBA::_tc_ulong; unm_seq [0].name = CORBA::string_dup("my_ulong"); /* Set the member typecode and the member name for the second UnionMember */ unm_seq [1].type = CORBA::_tc_float; unm_seq [1].name = CORBA::string_dup("my_float"); /* Create the Any that define the two member labels */ unm_seq [0].label <<= (corba::long) 1; unm_seq [1].label <<="(CORBA::Long)" 2; corba::repositoryid rep_id="CORBA::string_dup("repositoryid_999"); " corba::identifier name="CORBA::string_dup("my_union"); " corba::typecode_ptr discriminator_type = "CORBA::_t _long;" corba::typecode_ptr tc="op-">create_union_tc (rep_id, name, discriminator_type, unm_seq);