34 #ifndef GRPC_SUPPORT_AVL_H
35 #define GRPC_SUPPORT_AVL_H
53 void *(*copy_key)(
void *key);
60 void *(*copy_value)(
void *value);
struct gpr_avl_node * right
Definition: avl.h:45
GPRAPI void * gpr_avl_get(gpr_avl avl, void *key)
lookup key, and return the associated value.
Definition: sync_generic.h:47
GPRAPI int gpr_avl_is_empty(gpr_avl avl)
Return 1 if avl is empty, 0 otherwise.
"pointer" to an AVL tree - this is a reference counted object - use gpr_avl_ref to add a reference...
Definition: avl.h:66
long(* compare_keys)(void *key1, void *key2)
compare key1, key2; return <0 if key1 < key2, >0 if key1 > key2, 0 if key1 == key2 ...
Definition: avl.h:56
void * value
Definition: avl.h:43
GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable *vtable)
create an immutable AVL tree
struct gpr_avl gpr_avl
"pointer" to an AVL tree - this is a reference counted object - use gpr_avl_ref to add a reference...
struct gpr_avl_vtable gpr_avl_vtable
GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value)
return a new tree with (key, value) added to avl.
gpr_refcount refs
Definition: avl.h:41
gpr_avl_node * root
Definition: avl.h:68
long height
Definition: avl.h:46
void(* destroy_value)(void *value)
destroy a value
Definition: avl.h:58
GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void *key, void **value)
Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to its value.
const gpr_avl_vtable * vtable
Definition: avl.h:67
struct gpr_avl_node gpr_avl_node
internal node of an AVL tree
GPRAPI void gpr_avl_unref(gpr_avl avl)
remove a reference to a tree - destroying it if there are no references left
void(* destroy_key)(void *key)
destroy a key
Definition: avl.h:51
GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void *key)
return a new tree with key deleted implicitly unrefs avl to allow easy chaining.
void * key
Definition: avl.h:42
internal node of an AVL tree
Definition: avl.h:40
struct gpr_avl_node * left
Definition: avl.h:44
GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl)
add a reference to an existing tree - returns the tree as a convenience