ORB::create_union_tc

Overview Creates a tk_union TypeCode.
Original class CORBA::ORB
Exceptions CORBA::SystemException


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

rep_id
The non-NULL Interface Repository identifier of the IDL union. The caller retains ownership of this string.
name
The non-NULL simple name of the IDL union. The caller retains ownership of this string.
discriminator_type
A non-NULL CORBA::TypeCode describing the type of the union's discriminator. The caller retains ownership of this TypeCode.
members
A CORBA::UnionMemberSeq object (a sequence of unions of type CORBA::UnionMember) listing the members of the IDL union. Each CORBA::UnionMember in the sequence specifies the name, type, and member label of the corresponding union member. The type member is used, but the type_def member should be set to NULL. A union-member label of the zero octet is used to indicate the default union member. The sequence must contain at least one CORBA::UnionMember, and the TypeCode of each CORBA::UnionMember in the sequence must be non-NULL. The caller retains ownership of this object.

Return values

CORBA::TypeCode_ptr
The newly-created TypeCode. The caller assumes ownership of this TypeCode, and should subsequently release it using CORBA::release(TypeCode_ptr).

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);

Related reference
CORBA module



Searchable topic ID:   rcor_modo21
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/ref/rcor_modo21.html

Library | Support | Terms of Use | Feedback