GRPC Core  4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
avl.h File Reference
#include <grpc/support/sync.h>

Go to the source code of this file.

Data Structures

struct  gpr_avl_node
 internal node of an AVL tree More...
 
struct  gpr_avl_vtable
 
struct  gpr_avl
 "pointer" to an AVL tree - this is a reference counted object - use gpr_avl_ref to add a reference, gpr_avl_unref when done with a reference More...
 

Typedefs

typedef struct gpr_avl_node gpr_avl_node
 internal node of an AVL tree More...
 
typedef struct gpr_avl_vtable gpr_avl_vtable
 
typedef struct gpr_avl gpr_avl
 "pointer" to an AVL tree - this is a reference counted object - use gpr_avl_ref to add a reference, gpr_avl_unref when done with a reference More...
 

Functions

GPRAPI gpr_avl gpr_avl_create (const gpr_avl_vtable *vtable)
 create an immutable AVL tree More...
 
GPRAPI gpr_avl gpr_avl_ref (gpr_avl avl)
 add a reference to an existing tree - returns the tree as a convenience More...
 
GPRAPI void gpr_avl_unref (gpr_avl avl)
 remove a reference to a tree - destroying it if there are no references left More...
 
GPRAPI gpr_avl gpr_avl_add (gpr_avl avl, void *key, void *value)
 return a new tree with (key, value) added to avl. More...
 
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. More...
 
GPRAPI void * gpr_avl_get (gpr_avl avl, void *key)
 lookup key, and return the associated value. More...
 
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. More...
 
GPRAPI int gpr_avl_is_empty (gpr_avl avl)
 Return 1 if avl is empty, 0 otherwise. More...
 

Typedef Documentation

typedef struct gpr_avl gpr_avl

"pointer" to an AVL tree - this is a reference counted object - use gpr_avl_ref to add a reference, gpr_avl_unref when done with a reference

typedef struct gpr_avl_node gpr_avl_node

internal node of an AVL tree

Function Documentation

GPRAPI gpr_avl gpr_avl_add ( gpr_avl  avl,
void *  key,
void *  value 
)

return a new tree with (key, value) added to avl.

implicitly unrefs avl to allow easy chaining. if key exists in avl, the new tree's key entry updated (i.e. a duplicate is not created)

GPRAPI gpr_avl gpr_avl_create ( const gpr_avl_vtable vtable)

create an immutable AVL tree

GPRAPI void* gpr_avl_get ( gpr_avl  avl,
void *  key 
)

lookup key, and return the associated value.

does not mutate avl. returns NULL if key is not found.

GPRAPI int gpr_avl_is_empty ( gpr_avl  avl)

Return 1 if avl is empty, 0 otherwise.

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.

GPRAPI gpr_avl gpr_avl_ref ( gpr_avl  avl)

add a reference to an existing tree - returns the tree as a convenience

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.

GPRAPI void gpr_avl_unref ( gpr_avl  avl)

remove a reference to a tree - destroying it if there are no references left