home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / som30tk.zip / som30os2.zip / include / somstrt.idl < prev    next >
Text File  |  1996-12-24  |  5KB  |  137 lines

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