home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / somtc.hh < prev    next >
Encoding:
Text File  |  1996-01-24  |  5.2 KB  |  144 lines

  1. /*
  2.  *   COMPONENT_NAME: somc
  3.  *
  4.  *   ORIGINS: 27
  5.  *
  6.  *
  7.  *   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,
  8. 1994
  9.  *   All Rights Reserved
  10.  *   Licensed Materials - Property of IBM
  11.  *   US Government Users Restricted Rights - Use, duplication or
  12.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  13.  */
  14.  
  15.  
  16. /*
  17.  * somtc.hh DTS C++ include
  18.  * Typedefs, structs, & enums in support of CORBA TypeCodes
  19.  * and sequences for use with SOM 
  20.  */
  21.  
  22. #ifndef SOMTC_hh_DTS_INCLUDE
  23. #define SOMTC_hh_DTS_INCLUDE
  24.  
  25. #include <som.hh>
  26.  
  27. #pragma SOMAsDefault (off)
  28.  
  29. /*
  30.  * Operations supported by TypeCodes
  31.  *
  32.  */
  33.  
  34. SOMEXTERN short    SOMLINK tcAlignment (TypeCode t,Environment *ev);
  35. SOMEXTERN TypeCode SOMLINK tcCopy      (TypeCode t,Environment *ev);
  36. SOMEXTERN boolean  SOMLINK tcEqual     (TypeCode x,Environment *ev,TypeCode y);
  37. SOMEXTERN void     SOMLINK tcFree      (TypeCode t,Environment *ev);
  38. SOMEXTERN TCKind   SOMLINK tcKind      (TypeCode t,Environment *ev);
  39. SOMEXTERN long     SOMLINK tcParmCount (TypeCode t,Environment *ev);
  40. SOMEXTERN any      SOMLINK tcParameter (TypeCode t,Environment *ev,long index);
  41. SOMEXTERN void     SOMLINK tcPrint     (TypeCode t,Environment *ev);
  42. SOMEXTERN void     SOMLINK tcSetAlignment (TypeCode t,Environment *ev, short a);
  43. SOMEXTERN long     SOMLINK tcSize      (TypeCode t,Environment *ev);
  44.  
  45. /*
  46.  * Variable argument sequences for tcNew:
  47.  * (based on CORBA 7.6.1 Table 16 pp 139-140)
  48.  *
  49.  *  char     *interfaceId, *name, *mbrName, *enumId;
  50.  *  char     *structOrUnionName, *typeName, *context;
  51.  *  long     maxLength, length, labelFlag, labelValue;
  52.  *  TypeCode swTC, mbrTC, seqTC, arrayTC, ptrTC;
  53.  *  TCKind   tk_<xxx>;
  54.  *
  55.  *  tcNew (tk_<xxx>);
  56.  *  tcNew (tk_objref interfaceId);
  57.  *  tcNew (tk_string, maxLength);
  58.  *  tcNew (tk_sequence, seqTC, maxLength);
  59.  *  tcNew (tk_array, arrayTC, length);
  60.  *  tcNew (tk_pointer, ptrTC);                     <---[SOM extension]
  61.  *  tcNew (tk_self, structOrUnionName);            <---[SOM extension]
  62.  *  tcNew (tk_foreign, typeName, context, length); <---[SOM extension]
  63.  *
  64.  *  tcNew (tk_struct, name, mbrName, mbrTC, [...,] NULL);
  65.  *      [mbrName & TypeCode repeat as needed]
  66.  *
  67.  *  tcNew (tk_union, name, swTC, 
  68.  *      labelFlag, labelValue, mbrName, mbrTC, [...,] NULL);
  69.  *      [labelFlag, labelValue, mbrName & TypeCode repeat as needed]
  70.  *      labelFlag has the following meanings:
  71.  *          TCREGULAR_CASE - regular labelValue, cast as a long, follows,
  72.  *          TCDEFAULT_CASE - default case, with 0L for labelValue follows.
  73.  *
  74.  *  tcNew (tk_enum, name, enumId, [...,] NULL);
  75.  *      [enumId repeats as needed]
  76.  *
  77.  *  NULL is returned if tcNew detects an error or an attempt
  78.  *  to construct an illegal TypeCode
  79.  *
  80.  *  TypeCodes are assigned default alignment attributes appropriate 
  81.  *  to their constituent types.  The default alignment associated with  
  82.  *  the TypeCode as a whole is the greatest alignment associated with
  83.  *  any of its subordinate TypeCodes or primitive elements.  Note that
  84.  *  alignment information is platform-specific.  Default alignment
  85.  *  information can be overridden using the tcSetAlignment function,
  86.  *  where an argument value of zero means use default alignment, 
  87.  *  1 = byte alignment, n = alignment to an address boundary divisible 
  88.  *  by n.
  89.  *
  90.  *  TypeCodes created by tcNew do not hold references to any of the
  91.  *  passed strings, which are assumed to be owned by the caller.
  92.  *  This is not the case for the "TypeCode" arguments. They become
  93.  *  directly imbedded in the new TypeCode.  If you need to retain
  94.  *  ownership of passed TypeCodes, pass them using tcCopy.  Note that
  95.  *  TypeCode constants (TC_<xxx>) can be freely passed as arguments to
  96.  *  tcNew without using tcCopy.
  97.  *
  98.  *  All TypeCodes created by tcNew can be freed using tcFree.
  99.  */
  100. SOMEXTERN TypeCode SOMLINK tcNew (TCKind tag, ...);
  101.  
  102. /*  The following special variant on tcNew can be used when the
  103.  *  arguments are not known at compile-time and must be constructed
  104.  *  dynamically as a va_list.
  105.  */
  106. SOMEXTERN TypeCode SOMLINK tcNewVL (TCKind tag, va_list ap);
  107.  
  108. /*
  109.  *  Following constants used with tcNew to create union TypeCodes.
  110.  *  See calling sequences above.
  111.  */
  112. #define TCREGULAR_CASE 1L
  113. #define TCDEFAULT_CASE 2L
  114.  
  115. SOMEXTERN GENERIC_SEQUENCE * SOMLINK tcSequenceNew (TypeCode t,
  116.                             unsigned long max);
  117. #ifndef _IDL_SEQUENCE_string_defined
  118. #define _IDL_SEQUENCE_string_defined
  119. SOM_SEQUENCE_TYPEDEF (string);
  120. #endif /* _IDL_SEQUENCE_string_defined */
  121.  
  122. SOMEXTERN sequence(string) SOMLINK tcSeqFromListString (string s);
  123.  
  124. /* CORBA function names for TypeCodes, per CORBA 7.6.1, p.139 */
  125. #define TypeCode_kind         tcKind
  126. #define TypeCode_equal        tcEqual
  127. #define TypeCode_param_count  tcParmCount
  128. #define TypeCode_parameter    tcParameter
  129. /*
  130.  *  The following are IBM TypeCode extensions
  131.  */
  132. #define TypeCode_alignment    tcAlignment
  133. #define TypeCode_copy         tcCopy
  134. #define TypeCode_free         tcFree
  135. #define TypeCode_print        tcPrint
  136. #define TypeCode_setAlignment tcSetAlignment
  137. #define TypeCode_size         tcSize
  138.  
  139. #define TypeCodeNew           tcNew
  140. #define TypeCodeNewVL         tcNewVL
  141.  
  142. #pragma SOMAsDefault (pop)
  143. #endif /* SOMTC_hh */
  144.