home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSHashTable.h < prev    next >
Text File  |  1996-09-11  |  3KB  |  52 lines

  1. /*    NSHashTable.h
  2.     Scalable hash table
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #import <Foundation/NSString.h>
  7. #import <Foundation/NSArray.h>
  8.  
  9. /****************    Data structure    ****************/
  10.  
  11. typedef struct _NSHashTable NSHashTable;
  12.  
  13. typedef struct {
  14.     unsigned    (*hash)(NSHashTable *table, const void *);
  15.     BOOL    (*isEqual)(NSHashTable *table, const void *, const void *);
  16.     void    (*retain)(NSHashTable *table, const void *);
  17.     void    (*release)(NSHashTable *table, void *);
  18.     NSString     *(*describe)(NSHashTable *table, const void *);
  19. } NSHashTableCallBacks;
  20.     
  21. typedef struct {unsigned _pi; unsigned _si; void *_bs;} NSHashEnumerator;
  22.  
  23. /****************    Hash table operations    ****************/
  24.  
  25. FOUNDATION_EXPORT NSHashTable *NSCreateHashTableWithZone(NSHashTableCallBacks callBacks, unsigned capacity, NSZone *zone);
  26. FOUNDATION_EXPORT NSHashTable *NSCreateHashTable(NSHashTableCallBacks callBacks, unsigned capacity);
  27. FOUNDATION_EXPORT void NSFreeHashTable(NSHashTable *table);
  28. FOUNDATION_EXPORT void NSResetHashTable(NSHashTable *table);
  29. FOUNDATION_EXPORT BOOL NSCompareHashTables(NSHashTable *table1, NSHashTable *table2);
  30. FOUNDATION_EXPORT NSHashTable *NSCopyHashTableWithZone(NSHashTable *table, NSZone *zone);
  31. FOUNDATION_EXPORT void *NSHashGet(NSHashTable *table, const void *pointer);
  32. FOUNDATION_EXPORT void NSHashInsert(NSHashTable *table, const void *pointer);
  33. FOUNDATION_EXPORT void NSHashInsertKnownAbsent(NSHashTable *table, const void *pointer);
  34. FOUNDATION_EXPORT void *NSHashInsertIfAbsent(NSHashTable *table, const void *pointer);
  35. FOUNDATION_EXPORT void NSHashRemove(NSHashTable *table, const void *pointer);
  36. FOUNDATION_EXPORT NSHashEnumerator NSEnumerateHashTable(NSHashTable *table);
  37. FOUNDATION_EXPORT void *NSNextHashEnumeratorItem(NSHashEnumerator *enumerator);
  38. FOUNDATION_EXPORT unsigned NSCountHashTable(NSHashTable *table);
  39. FOUNDATION_EXPORT NSString *NSStringFromHashTable(NSHashTable *table);
  40. FOUNDATION_EXPORT NSArray *NSAllHashTableObjects(NSHashTable *table);
  41.  
  42. /****************    Common hash table callbacks    ****************/
  43.  
  44. FOUNDATION_EXPORT const NSHashTableCallBacks NSIntHashCallBacks;
  45. FOUNDATION_EXPORT const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks;
  46. FOUNDATION_EXPORT const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks;
  47. FOUNDATION_EXPORT const NSHashTableCallBacks NSObjectHashCallBacks;
  48. FOUNDATION_EXPORT const NSHashTableCallBacks NSOwnedObjectIdentityHashCallBacks;
  49. FOUNDATION_EXPORT const NSHashTableCallBacks NSOwnedPointerHashCallBacks;
  50. FOUNDATION_EXPORT const NSHashTableCallBacks NSPointerToStructHashCallBacks;
  51.  
  52.