home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / btree / IXBTree.h next >
Text File  |  1992-07-18  |  3KB  |  96 lines

  1. /*
  2. IXBTree.h
  3. Copyright 1991, NeXT, Inc.
  4. */
  5.  
  6. #import    "protocols.h"
  7.  
  8. #ifndef    RELEASE_2
  9. #import <mach/cthreads.h>
  10. #else    RELEASE_2
  11. #import <cthreads.h>
  12. #endif    RELEASE_2
  13. #import    <objc/Object.h>
  14. #import    <store/IXStoreFile.h>
  15.  
  16. #ifndef    RELEASE_2
  17. @interface IXBTree: Object <IXBlockAndStoreAccess, IXNameAndFileAccess, IXComparatorSetting, IXComparisonSetting>
  18. #else    RELEASE_2
  19. @interface IXBTree: Object
  20. #endif    RELEASE_2
  21. {
  22. @public
  23.     struct mutex    mutexLock; // public for explicit locking
  24. #ifndef    RELEASE_2
  25. @protected
  26. #endif    RELEASE_2
  27.     vm_offset_t        _rootOffset;
  28.     unsigned        _recordCount;
  29.     unsigned        _syncVersion;
  30.     unsigned        _codeVersion;
  31.     unsigned        _page_size_shift;
  32.     unsigned        _btreeDepth;
  33.     boolean_t        _freeStore;
  34.     char        *_handleName;
  35.     unsigned        _blockHandle;
  36.     IXStore        *_store;
  37.     IXComparator    *_comparator;
  38.     void        *_context;
  39.     char        *_comparison;
  40.     struct BTreeStore    *_btreeStore;
  41.     struct        {
  42.     unsigned    isSpanning:1;
  43.     unsigned    rightRotation:1;
  44.     unsigned    leftRotation:1;
  45.     }            _cursorStatus;
  46. }
  47.  
  48. - (unsigned)count; // returns the number of key/record pairs
  49. - empty; // removes all key/record pairs
  50.  
  51. - compact; // reduces storage by ~25%; reduces key insertion performance
  52. - (unsigned)keyLimit; // returns maximum key length
  53.  
  54. - optimizeForTime; // faster insertion, more empty space per page
  55. - optimizeForSpace; // slower insertion, less empty space per page
  56.  
  57. - setSpanning:(BOOL)flag; // undocumented; packing read only B* trees
  58.  
  59. #ifdef    RELEASE_2
  60. // @protocol IXComparatorSetting
  61.  
  62. - getComparator:(IXComparator **)comparator andContext:(const void **)context;
  63. - setComparator:(IXComparator *)comparator andContext:(const void *)context;
  64.  
  65. // @protocol IXComparisonSetting
  66.  
  67. - (const char *)comparisonFormat;
  68. - setComparisonFormat:(const char *)aFormat;
  69.  
  70. // @protocol IXBlockAndStoreAccess
  71.  
  72. + freeFromBlock:(unsigned)aHandle inStore:(id)aStore;
  73. - freeFromStore;
  74.  
  75. - initInStore:(id)aStore;
  76. - initFromBlock:(unsigned)aHandle inStore:(id)aStore;
  77.  
  78. - getBlock:(unsigned *)aHandle andStore:(id *)aStore;
  79.  
  80. // @protocol IXNameAndFileAccess
  81.  
  82. + freeFromName:(const char *)aName inFile:(const char *)aFile;
  83.  
  84. - initWithName:(const char *)aName inFile:(const char *)aFile;
  85. - initFromName:(const char *)'e inFile:(const char *)aFile 
  86.     forWriting:(BOOL)writingFlag;
  87.  
  88. - getName:(const char **)aName andFile:(const char **)aFile;
  89. #endif    RELEASE_2
  90.  
  91. @end
  92.  
  93. #define    IXLockBTreeMutex(btree)    mutex_lock(&(btree)->mutexLock)
  94. #define IXUnlockBTreeMutex(btree) mutex_unlock(&(btree)->mutexLock)
  95.  
  96.