TypeCodeNew

From EDM2
Jump to: navigation, search

This function creates a new TypeCode instance.

Syntax

TCKind      tag;
string      interfaceID;
string      name;
string      mbrName;
string      EnumId;
string      structOrUnionName;
long        maxLength;
long        length;
long        flag;
long        labelValue;
TypeCode    mbrTC;
TypeCode    swTC;
TypeCode    seqTC;
TypeCode    arrayTC;
TypeCode    ptrTC;
string      typename;
string      impCtx;
long        instSize;
TCKind      allOtherTagValues;
TypeCode    rc;

rc = TypeCodeNew(tag, interfaceID, name, mbrName, EnumId, structOrUnionName, maxLength,
      length, flag, labelValue, mbrTC, swTC, seqTC, arrayTC, ptrTC, typename, impCtx,
      instSize, allOtherTagValues);

Parameters

tag (TCKind)
The type or category of TypeCode to create. The actual parameters that follow are variable in number and type, depending on the value of the tag paramater. (There are no implicit parameters in this function.) See the remarks section for the syntax form appropriate for each kind of TCKind tag.
interfaceID (string)
A string containing the fully-qualified interface name that is the subject of an object reference type.
name (string)
A string that gives the name of a struct, union, or enum.
mbrName (string)
A string that gives the name of a struct or union member element.
EnumId (string)
A string that gives the name of an enum enumerator.
structOrUnionName (string)
A string that gives the name of a struct or union that has been previously named in the current TypeCode and is the subject of a self-referential pointer type. See the footnote on tk_self in Table 1 for an example of what this means and how it is applied.
maxLength (long)
The maximum permitted length of a string or a sequence. The value 0 (zero) means that the string or sequence is considered unbounded.
length (long)
The maximum number of elements that can be stored in an array. All IDL arrays are bounded, hence a value of zero denotes an array of zero elements.
flag (long)
One of the following constant values used to distinguish a labeled case in an IDL discriminated union switch statement from the default case:
TCREGULAR_CASE - The value 1
TCDEFAULT_CASE - The value 2
labelValue (long)
The actual value associated with a regular labeled case in an IDL discriminated union switch statement. If preceded by the argument TCDEFAULT_CASE, the value zero should be used.
mbrTC (TypeCode)
A TypeCode that represents the data type of a struct or union member.
swTC (TypeCode)
A TypeCode that represents the data type of the discriminator in an IDL union statement.
seqTC (TypeCode)
A TypeCode that describes the data type of the elements in a sequence.
arrayTC (TypeCode)
A TypeCode that describes the data type of the elements of an array.
ptrTC (TypeCode)
A TypeCode that describes the data type referenced by a pointer.
typename (string)
A string that provides the name of a foreign type.
impCtx (string)
A string that identifies an implementation context where a foreign type is understood.
instSize (long)
A long that holds the size of a foreign type instance. If the size is variable or is not known, the value zero should be used.
allOtherTagValues (TCKind)
One of the values: 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, or Tk_Principal. All of these tags represent basic IDL data types that do not require any other descriptive parameters.

Returns

rc (TypeCode)
A new TypeCode instance, or NULL if the new instance could not be created.

Remarks

The TypeCodeNew function creates a new instance of a TypeCode from the supplied parameters. TypeCodes are complex data structures whose actual representation is hidden. The number and types of arguments required by TypeCodeNew varies depending on the value of the first argument. The syntax for all of the valid invocation sequences are as follows:

  • TyepCodeNew(tk_objref, string interfaceld);
  • TypeCodeNew(tk_string, long maxLength);
  • TypeCodeNew(tk_sequence, TypeCode seqTC, long maxLength);
  • TypeCodeNew(tk_array, TypeCodearrayTC, long length);
  • TypeCodeNew(tk_pointer, TypeCode ptrTC);
  • TypeCodeNew(tk_self, string structOrUnionName);
  • TypeCodeNew(tk_foreign, string typename, string impCtx, long instSize);
  • TypeCodeNew(tk_struct, string name, string mbrname,
  • TypeCode mbrTC,[...,][mbrName and mbrTC repeat as needed] NULL);
  • TypeCodeNew (tk_union, string name, TypeCode swTC, longflag, long labelValue, string mbrName, TypeCode mbrTC,[...,] [flag, labelValue, mbrName and mbrTC repeat as needed] NULL);
  • TypeCodeNew(tk_enum, string name, string enumld,[...,] [enumlds repeat as needed] NULL);
  • TypeCodeNew(TCKindall OtherTAgValues);

All TypeCodes created by TypeCodeNew should be destroyed (when no longer needed) using the TypeCode_free function.

This function is a SOM-unique extension to the CORBA standard.

Related Information

  • TypeCode_alignment
  • TypeCode_copy
  • TypeCode_equal
  • TypeCode_free
  • TypeCode_kind
  • TypeCode_param_count
  • TypeCode_parameter
  • TypeCode_print
  • TypeCode_size
  • TypeCode_setAlignment