2.4.1.3 Iteration — Zix 0.8.2 documentation

# 2.4.1.3 Iteration

typedef struct ZixBTreeNodeImpl ZixBTreeNode

  An opaque node in a B-Tree.

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.

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).

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.

bool zix_btree_iter_equals(ZixBTreeIter lhs, ZixBTreeIter rhs)

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

ZixStatus zix_btree_iter_increment(ZixBTreeIter *i)

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

bool zix_btree_iter_is_end(const ZixBTreeIter i)

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

ZixBTreeIter zix_btree_iter_next(ZixBTreeIter iter)

  Return an iterator one past `iter`.