2.4.1.2 Iteration — Zix 0.4.2 documentation

# 2.4.1.2 Iteration

struct ZixBTreeIter

  An iterator over a B-Tree.

  Note that modifying the tree invalidates all iterators.

  The contents of this type are considered an implementation detail and should not be used directly by clients. They are nevertheless exposed here so that iterators can be allocated on the stack.

  ZixBTreeNode *nodes[ZIX_BTREE_MAX_HEIGHT]

    Node stack.

  uint16_t indexes[ZIX_BTREE_MAX_HEIGHT]

    Index stack.

  uint16_t level

    Current level.

typedef struct ZixBTreeNodeImpl ZixBTreeNode

  An opaque node in a B-Tree.

const ZixBTreeIter zix_btree_end_iter

  A static end iterator for convenience.

void *zix_btree_get(ZixBTreeIter ti)

  Return the data at the given position in the tree.

ZixBTreeIter zix_btree_begin(const ZixBTree *t)

  Return an iterator to the first (smallest) element in `t`

ZixBTreeIter zix_btree_end(const ZixBTree *t)

  Return an iterator to the end of `t` (one past the last element)

bool zix_btree_iter_equals(ZixBTreeIter lhs, ZixBTreeIter rhs)

  Return true iff `lhs` is equal to `rhs`

bool zix_btree_iter_is_end(const ZixBTreeIter i)

  Return true iff `i` is an iterator at the end of a tree.

ZixStatus zix_btree_iter_increment(ZixBTreeIter *i)

  Increment `i` to point to the next element in the tree.

ZixBTreeIter zix_btree_iter_next(ZixBTreeIter iter)

  Return an iterator one past `iter`