The Common Object Request Broker: Architecture and Specification Version 3

ly, TypeCodes consist of a “kind” field, and a “parameter list.” For example, the IDL type long has TypeCode tk_long and no parameters. The IDL type sequence<boolean,10> has TypeCode tk_sequence and two parameters: 10 andboolean. Two TypeCodes are equal if the IDL type specifications from which they are compiled denote equal types. Equal TypeCodes are interchangeable, and give identical results when TypeCode operations are applied to them. 7.6.1 The TypeCode Interface The IDL interface for TypeCodes is module CORBA { enum TCKind { tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string, tk_sequence, tk_array }; interface TypeCode { exception Bounds {}; boolean equal (in TypeCode tc); TCkind kind (); long param_count (); // The number of parameters for this TypeCode. any parameter (in long index) raises (Bounds); // The index’th parameter. Parameters are indexed from 0 // to (param_count-1). }; }; With the above operations, any TypeCode can be decomposed into its constituent parts. Composing new TypeCodes is a topic for future OMG standardization. The Interface Repository 144 THE COMMON OBJECT REQUEST BROKER: ARCHITECTURE AND SPECIFICATION The legal combinations of kinds and parameters are listed in TBL. 16 on page 144. The tk_objref TypeCode represents an interface type. Its parameter is the interface-id of that interface. A structure with N members results in a tk_struct TypeCode with 2N+1 parameters: the type name of the struct, the rest are member names alternating with the corresponding member TypeCode. Member names are represented as strings. A union with N members results in a tk_union TypeCode with 3N+2 parameters: the type name of the union, the switch TypeCode followed by a label value, member name, and member TypeCode for each of the N members. The label values are all values of the data type designated by the switch TypeCode, with one exception. The default member (if present) is marked with a label value consisting of the 0 octet. Recall that the operation TBL. 16 Legal TypeCode Kinds and Parameters KIND PARAMETER LIST tk_null *NONE* tk_void *NONE* tk_short *NONE* tk_long *NONE* tk_ushort *NONE* tk_ulong *NONE* tk_float *NONE* tk_double *NONE* tk_boolean *NONE* tk_char *NONE* tk_octet *NONE* tk_any *NONE* tk_TypeCode *NONE* tk_Principal *NONE* tk_objref { interface-id } tk_struct {struct-name, member-name, TypeCode, ... (repeat pairs) } tk_union {union-name, switch-TypeCode, label-value, member-name, TypeCode, ... (repeat triples) } tk_enum {enum-name, enum-id, ... } tk_string { maxlen-integer } tk_sequence { TypeCode, maxlen-integer } tk_array { TypeCode, length-integer }