AVL Trees

## AVL Trees AVL Trees — AVL Trees |

## Functions

raptor_avltree * | raptor_new_avltree ()
void | raptor_free_avltree ()
int | raptor_avltree_add ()
int | raptor_avltree_delete ()
int | raptor_avltree_print ()
void * | raptor_avltree_remove ()
void * | raptor_avltree_search ()
void | raptor_avltree_set_print_handler ()
int | raptor_avltree_size ()
int | raptor_avltree_visit ()
raptor_avltree_iterator * | raptor_new_avltree_iterator ()
void | raptor_free_avltree_iterator ()
void * | raptor_avltree_iterator_get ()
int | raptor_avltree_iterator_is_end ()
int | raptor_avltree_iterator_next ()
int | (*raptor_avltree_visit_handler) ()

## Types and Values

typedef | raptor_avltree
enum | raptor_avltree_bitflags
typedef | raptor_avltree_iterator

## Description

AVL Trees

## Functions

### raptor_new_avltree ()

    raptor_avltree *
    raptor_new_avltree (raptor_data_compare_handler compare_handler,
                        raptor_data_free_handler free_handler,
                        unsigned int flags);

#### Returns

### raptor_free_avltree ()

    void
    raptor_free_avltree (raptor_avltree *tree);

### raptor_avltree_add ()

    int
    raptor_avltree_add (raptor_avltree *tree,
                        void *p_data);

#### Returns

### raptor_avltree_delete ()

    int
    raptor_avltree_delete (raptor_avltree *tree,
                           void *p_data);

#### Returns

### raptor_avltree_print ()

    int
    raptor_avltree_print (raptor_avltree *tree,
                          FILE *stream);

#### Returns

### raptor_avltree_remove ()

    void *
    raptor_avltree_remove (raptor_avltree *tree,
                           void *p_data);

#### Returns

### raptor_avltree_search ()

    void *
    raptor_avltree_search (raptor_avltree *tree,
                           const void *p_data);

#### Returns

### raptor_avltree_set_print_handler ()

    void
    raptor_avltree_set_print_handler (raptor_avltree *tree,
                                      raptor_data_print_handler print_handler);

### raptor_avltree_size ()

    int
    raptor_avltree_size (raptor_avltree *tree);

#### Returns

### raptor_avltree_visit ()

    int
    raptor_avltree_visit (raptor_avltree *tree,
                          raptor_avltree_visit_handler visit_handler,
                          void *user_data);

#### Returns

### raptor_new_avltree_iterator ()

    raptor_avltree_iterator *
    raptor_new_avltree_iterator (raptor_avltree *tree,
                                 void *range,
                                 raptor_data_free_handler range_free_handler,
                                 int direction);

#### Returns

### raptor_free_avltree_iterator ()

    void
    raptor_free_avltree_iterator (raptor_avltree_iterator *iterator);

### raptor_avltree_iterator_get ()

    void *
    raptor_avltree_iterator_get (raptor_avltree_iterator *iterator);

#### Returns

### raptor_avltree_iterator_is_end ()

    int
    raptor_avltree_iterator_is_end (raptor_avltree_iterator *iterator);

#### Returns

### raptor_avltree_iterator_next ()

    int
    raptor_avltree_iterator_next (raptor_avltree_iterator *iterator);

#### Returns

### raptor_avltree_visit_handler ()

    int
    (*raptor_avltree_visit_handler) (int depth,
                                     void *data,
                                     void *user_data);

AVL Tree visitor function as given to `raptor_avltree_visit()`

#### Parameters

depth | depth of object in tree |
data | data object being visited |
user_data | user data arg to `raptor_avltree_visit()` |

#### Returns

non-0 to terminate visit early.

## Types and Values

### raptor_avltree

    typedef struct raptor_avltree_s raptor_avltree;

AVL Tree

### enum raptor_avltree_bitflags

Bit flags for AVL Tree class constructor `raptor_new_avltree()`

#### Members

RAPTOR_AVLTREE_FLAG_REPLACE_DUPLICATES | If set `raptor_avltree_add()` will replace any duplicate items. If not set, `raptor_avltree_add()` will not replace them and will return status >0 when adding a duplicate. (Default is not set) |

### raptor_avltree_iterator

    typedef struct raptor_avltree_iterator_s raptor_avltree_iterator;

AVL Tree Iterator as created by `raptor_new_avltree_iterator()`