home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / btree / IXBTreeCursor.h < prev    next >
Text File  |  1992-05-27  |  2KB  |  79 lines

  1. /*
  2. IXBTreeCursor.h
  3. Copyright 1991, NeXT, Inc.
  4. */
  5.  
  6. #import    "IXBTree.h"
  7.  
  8. #ifndef    RELEASE_2
  9. @interface IXBTreeCursor : Object <IXCursorPositioning>
  10. #else    RELEASE_2
  11. @interface IXBTreeCursor : Object
  12. #endif    RELEASE_2
  13. {
  14.     struct BTree        *btree;
  15.     void                *keyBuffer;
  16.     unsigned            keyLength;
  17.     unsigned            bufferSize;
  18.     unsigned            storeVersion;
  19.     unsigned            keyLimit;
  20.     unsigned            traceHint;
  21.     unsigned            cursorVersion;
  22.     unsigned            cursorDepth;
  23.     NXZone            *cursorZ(
  24.     struct BTreeTraceRecord    *cursorTrace;
  25.     struct            {
  26.     unsigned        isSpanning:1;
  27.     unsigned        rightRotation:1;
  28.     unsigned        leftRotation:1;
  29.     unsigned        traceNeeded:1;
  30.     unsigned        traceOpened:1;
  31.     unsigned        zeroPosition:1;
  32.     unsigned        lastPosition:1;
  33.     }                cursorStatus;
  34. }
  35.  
  36. - (IXBTree *)btree;
  37. - initWithBTree:(IXBTree *)aBTree;
  38.  
  39. - (unsigned)readRange:(void **)value // reads part of the value
  40.     ofLength:(unsigned)length atOffset:(unsigned)offset;
  41. - (unsigned)readValue:(void **)value; // reads the value and returns length
  42.  
  43. - removeValue; // removes the key/value pair from the B* tree
  44.  
  45. - (BOOL)writeValue:(const void *)value // replaces if key exists, else inserts
  46.     andLength:(unsigned)length;
  47. - writeRange:(const void *)value 
  48.     ofLength:(unsigned)length atOffset:(unsigned)offset;
  49.  
  50. - (unsigned)openRange:(void **)value // returns a pointer to write mapped page
  51.     ofLength:(unsigned)length atOffset:(unsigned)offset 
  52.     forWriting:(BOOL)writing;
  53.  
  54. - (BOOL)getKey:(void **)key // returns hint for cursor position
  55.     andLength:(unsigned *)length withHint:(unsigned *)hint;
  56. - (BOOL)setKey:(const void *)key // sets key with hint returned by preceding
  57.     andLength:(unsigned)length withHint:(unsigned)hint;
  58.  
  59. #ifdef    RELEASE_2
  60.  
  61. // @protocol IXCursorPositioning
  62.  
  63. - (BOOL)setFirst; // positions cursor at first key in key space
  64. - (BOOL)setLast; // positions cursor at last key in key space
  65. - (BOOL)setNext; // positions cursor at next key in key space
  66. - (BOOL)setPrevious; // position cursor at previous key in key space
  67.  
  68. - (BOOL)getKey:(const void **)key // returns value of key at cursor
  69.     andLength:(unsigned *)length;
  70. - (BOOL)setKey:(const void *)key // positions cursor at supplied key
  71.     andLength:(unsigned)length;
  72.  
  73. - (BOOL)isMatch; // true if cursor matched a key on last operation
  74.  
  75. #endif    RELEASE_2
  76.  
  77. @end
  78.  
  79.