home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / somstrt.idl < prev    next >
Encoding:
Text File  |  1996-02-21  |  4.5 KB  |  128 lines

  1. //
  2. //   COMPONENT_NAME: some
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  8. //   All Rights Reserved
  9. //   Licensed Materials - Property of IBM
  10. //   US Government Users Restricted Rights - Use, duplication or
  11. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12. //
  13.  
  14. #ifndef somstrt_idl
  15. #define somstrt_idl
  16.  
  17. #include <somobj.idl>
  18.  
  19. // We try to map "typedef entryT *(*tablePT)[]" onto the following
  20. // IDL strucuture.  It doesn't appear to work correctly.
  21.   typedef struct entryT {
  22.       string key;
  23.       string value;
  24.       entryT *next;
  25.   } ***tablePT;
  26.  
  27. interface SOMStringTableC : SOMObject
  28.  
  29. // Objects of the SOMStringTableC class are symbol tables that map null
  30. // terminated strings to null terminated strings.  While any instance
  31. // of this class can hold an indefinite number of sysbols, performance
  32. // will be inproved if the instance is created with an appropriate
  33. // maximum target capacity.
  34.  
  35. {
  36.  
  37.   attribute unsigned long somstTargetCapacity;
  38.   // The expected maximum number of associations for this table.
  39.   // Accuracy can result in improved performance.  A low target may
  40.   // result in some storage saving, but at the cost of performance.
  41.   // Note: this attribute must be set before any strings are added to
  42.   // the string table or it will not be setable.
  43.  
  44.   readonly attribute unsigned long somstAssociationsCount;
  45.   // The number of associations currently in this table
  46.  
  47.   short somstAssociate(in string key, in string value);
  48.   // Associates <key> and <value>.  After this call, whenever <key> is
  49.   // lookedup, <value> will be returned.
  50.   // Zero will be returned if the association cannot be accomplished
  51.   // (<key> is null, or memory is not available), -1 will be returned
  52.   // if the association suceeds, but <key> had a previous association,
  53.   // and 1 is returned if the association suceeds and <key> had no
  54.   // previous association.
  55.   // Note: the string table takes over ownership of both <key> and
  56.   // <value>.
  57.  
  58.   short somstAssociateCopyKey(in string key, in string value);
  59.   // Same as <somstAssociate> except don't take ownership of <key>.
  60.  
  61.   short somstAssociateCopyValue(in string key, in string value);
  62.   // Same as <somstAssociate> except don't take ownership of <value>.
  63.  
  64.   short somstAssociateCopyBoth(in string key, in string value);
  65.   // Same as <somstAssociate> except don't take ownership of <key> or
  66.   // <value>.
  67.  
  68.   string somstGetAssociation(in string key);
  69.  
  70.   // The string associated with <key> is returned if there is one and
  71.   // NULL is returned if <key> has no association.
  72.   // The string table will maintain ownership of any returned value.
  73.  
  74.   boolean somstClearAssociation(in string key);
  75.  
  76.   // The association for <key>, if any, is removed.
  77.   // 1 is returned if <key> had an association, and 0 is returned if
  78.   // it did not.
  79.  
  80.   string somstGetIthKey(in unsigned long i);
  81.  
  82.   // Returns the key part of the <i> association in this string table
  83.   // if there is one and null otherwise.
  84.   // The order of associations in a string table is not specified, but
  85.   // will not change unless changes are made in the table.
  86.   // Ownership of the key is retained, the pointer returned is valid
  87.   // until any changes are made in the table.
  88.  
  89.   string somstGetIthValue(in unsigned long i);
  90.  
  91.   // Returns the value part of the <i> association in this string table
  92.   // if there is one and null otherwise.
  93.   // The order of associations in a string table is not specified, but
  94.   // will not change unless changes are made in the table.
  95.   // Ownership of the value is retained, the pointer returned is valid
  96.   // until any changes are made in the table.
  97.  
  98. #ifdef __SOMIDL__
  99.   implementation {
  100.     releaseorder: _get_somstTargetCapacity, _set_somstTargetCapacity,
  101.           _get_somstAssociationsCount, 
  102.                   somstAssociate,somstAssociateCopyKey,somstAssociateCopyValue, 
  103.                   somstAssociateCopyBoth,somstGetAssociation,
  104.           somstClearAssociation,somstGetIthKey,somstGetIthValue;
  105.  
  106.     majorversion = 2;
  107.     minorversion = 1;
  108.     filestem = somstrt;
  109.     callstyle = oidl;
  110.  
  111.     passthru C_h_after =  "extern char * SOMLINK somstDupStr(char *str);";
  112.  
  113.     unsigned long tableSize;        
  114.     tablePT table;                  
  115.     unsigned long numberOfEntries;  
  116.  
  117.     somInit: override;
  118.     somUninit: override;
  119.     somPrintSelf: override;
  120.     somDumpSelfInt: override;
  121.  
  122.     somstTargetCapacity: nodata;
  123.   };
  124. #endif /* __SOMIDL__ */
  125. };
  126.  
  127. #endif  /* somstrt_idl */
  128.