19 #ifndef GRPC_CORE_LIB_AVL_AVL_H
20 #define GRPC_CORE_LIB_AVL_AVL_H
45 void* (*copy_key)(
void* key,
void* user_data);
52 void* (*copy_value)(
void* value,
void* user_data);
grpc_avl grpc_avl_remove(grpc_avl avl, void *key, void *user_data)
Return a new tree with key deleted implicitly unrefs avl to allow easy chaining.
Definition: avl.cc:289
struct grpc_avl_node grpc_avl_node
internal node of an AVL tree
grpc_avl grpc_avl_ref(grpc_avl avl, void *user_data)
Add a reference to an existing tree - returns the tree as a convenience.
Definition: avl.cc:297
struct grpc_avl grpc_avl
"pointer" to an AVL tree - this is a reference counted object - use grpc_avl_ref to add a reference,...
grpc_avl grpc_avl_add(grpc_avl avl, void *key, void *value, void *user_data)
Return a new tree with (key, value) added to avl.
Definition: avl.cc:228
void * grpc_avl_get(grpc_avl avl, void *key, void *user_data)
Lookup key, and return the associated value.
Definition: avl.cc:112
grpc_avl grpc_avl_create(const grpc_avl_vtable *vtable)
Create an immutable AVL tree.
Definition: avl.cc:31
struct grpc_avl_vtable grpc_avl_vtable
vtable for the AVL tree The optional user_data is propagated from the top level grpc_avl_XXX API.
int grpc_avl_maybe_get(grpc_avl avl, void *key, void **value, void *user_data)
Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to its value.
Definition: avl.cc:117
int grpc_avl_is_empty(grpc_avl avl)
Return 1 if avl is empty, 0 otherwise.
Definition: avl.cc:306
void grpc_avl_unref(grpc_avl avl, void *user_data)
Remove a reference to a tree - destroying it if there are no references left.
Definition: avl.cc:302
Definition: sync_generic.h:36
internal node of an AVL tree
Definition: avl.h:27
struct grpc_avl_node * right
Definition: avl.h:32
gpr_refcount refs
Definition: avl.h:28
long height
Definition: avl.h:33
struct grpc_avl_node * left
Definition: avl.h:31
void * value
Definition: avl.h:30
void * key
Definition: avl.h:29
vtable for the AVL tree The optional user_data is propagated from the top level grpc_avl_XXX API.
Definition: avl.h:41
void(* destroy_value)(void *value, void *user_data)
destroy a value
Definition: avl.h:50
long(* compare_keys)(void *key1, void *key2, void *user_data)
compare key1, key2; return <0 if key1 < key2, >0 if key1 > key2, 0 if key1 == key2
Definition: avl.h:48
void(* destroy_key)(void *key, void *user_data)
destroy a key
Definition: avl.h:43
"pointer" to an AVL tree - this is a reference counted object - use grpc_avl_ref to add a reference,...
Definition: avl.h:58
grpc_avl_node * root
Definition: avl.h:60
const grpc_avl_vtable * vtable
Definition: avl.h:59