![]() |
Overview Creates a tk_enum TypeCode. Original class CORBA::ORB Exceptions CORBA::SystemException
Intended Usage
This method is intended to be used to create a TypeCode of kind tk_enum, representing an IDL enum.
IDL Syntax
CORBA::TypeCode_ptr create_enum_tc ( CORBA::RepositoryId rep_id, CORBA::Identifier name, CORBA::EnumMemberSeq & members);
Input parameters
- rep_id
- The non-NULL Interface Repository identifier of the IDL enum. The caller retains ownership of this string.
- name
- The non-NULL simple name of the IDL enum. The caller retains ownership of this string.
- members
- A CORBA::EnumMemberSeq object (essentially a sequence of strings) listing the members of the IDL enum. The caller retains ownership of this object. The length of this sequence cannot be zero, and the contained strings must not be NULL.
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_enum TypeCode corresponding to this IDL definition: enum color { red, green, blue }; */ /* assume op initialized */ extern CORBA::ORB_ptr op; CORBA::Identifier identenum = CORBA::string_dup ("color"); CORBA::EnumMemberSeq enum_seq; enum_seq.length(3); enum_seq[0].type = CORBA::_tc_string; enum_seq[0].name = CORBA::string_dup("red"); enum_seq[1].type = CORBA::_tc_string; enum_seq[1].name = CORBA::string_dup("green"); enum_seq[2].type = CORBA::_tc_string; enum_seq[2].name = CORBA::string_dup("blue"); CORBA::RepositoryId rep_id = CORBA::string_dup ("RepositoryId_999"); CORBA::TypeCode_ptr tc= op->create_enum_tc (rep_id, identenum, enum_seq); ...