![]() |
Overview Creates a tk_struct TypeCode. Original class CORBA::ORB Exceptions CORBA::SystemException
Intended Usage
This method is intended to be used to create a TypeCode of kind tk_struct, representing an IDL struct.
IDL Syntax
CORBA::TypeCode_ptr create_struct_tc ( CORBA::RepositoryId rep_id, CORBA::Identifier name, CORBA::StructMemberSeq & members);
Input parameters
- rep_id
- The non-NULL Interface Repository identifier of the IDL struct. The caller retains ownership of this string.
- name
- The non-NULL simple name of the IDL struct. The caller retains ownership of this string.
- members
- A CORBA::StructMemberSeq object (a sequence of structs of type CORBA::StructMember) listing the members of the IDL struct. Each CORBA::StructMember in the sequence specifies the name and type of the corresponding struct member; only the type member is used, and the type_def member should be set to NULL. The sequence must contain at least one CORBA::StructMember, and each CORBA::StructMember in the sequence must have a non-NULL TypeCode. 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_struct TypeCode corresponding to this IDL definition: struct my_struct { long my_long; char my_char; }; */ /* assume op initialized */ extern CORBA::ORB_ptr op; CORBA::_IDL_SEQUENCE_StructMember stm_seq; stm_seq.length(2); stm_seq [0].type = CORBA::_tc_long; stm_seq [0].name = CORBA::string_dup ("my_long"); stm_seq [1].type = CORBA::_tc_char; stm_seq [1].name = CORBA::string_dup ("my_char"); CORBA::RepositoryId rep_id = CORBA::string_dup("RepositoryId_999"); CORBA::Identifier name = CORBA::string_dup("my_struct"); CORBA::TypeCode_ptr tc = op->create_struct_tc (rep_id, name, stm_seq);