pat_iter functions

pat_iter functions — functions to iterate over Patricia tries in prefix order

Synopsis


#include <patricia.h>


            pat_iter;
gboolean    pat_iter_step                   (pat_iter *iter);
pat_prefix* pat_iter_get_key                (pat_iter *iter);
pat_prefix* pat_iter_get_value              (pat_iter *iter);
pat_trie*   pat_iter_get_trie               (pat_iter *iter);
void        pat_iter_destroy                (pat_iter **iter);

Description

Prefix order means "000*" strings come before "01*", "10*", ...

Since bits in strings are read from most significant to least significant, pat_iter_step() enumerates fixed-length keys in ascending unsigned numeric order. Iterators are forward-only (in version 0.20).

Details

pat_iter

typedef struct _pat_iter pat_iter;

A pat_iter points back to the trie being iterated over. Call pat_iter_get_trie()


pat_iter_step ()

gboolean    pat_iter_step                   (pat_iter *iter);

Go to next key/value pair. Must be called to get to the first item

iter : a pat_iter
Returns : false if iter is past the end

pat_iter_get_key ()

pat_prefix* pat_iter_get_key                (pat_iter *iter);

iter : a pat_iter
Returns : null if there is no current key.

pat_iter_get_value ()

pat_prefix* pat_iter_get_value              (pat_iter *iter);

iter : a pat_iter
Returns : null if there is no current key.

pat_iter_get_trie ()

pat_trie*   pat_iter_get_trie               (pat_iter *iter);

iter : a pat_iter
Returns : the trie over which iter iterates

pat_iter_destroy ()

void        pat_iter_destroy                (pat_iter **iter);

Destroy an iterator (*iter)

iter : an iterator