GRPC C++  1.39.1
Data Structures | Typedefs | Functions
avl.h File Reference
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>

Go to the source code of this file.

Data Structures

struct  grpc_avl_node
 internal node of an AVL tree More...
 
struct  grpc_avl_vtable
 vtable for the AVL tree The optional user_data is propagated from the top level grpc_avl_XXX API. More...
 
struct  grpc_avl
 "pointer" to an AVL tree - this is a reference counted object - use grpc_avl_ref to add a reference, grpc_avl_unref when done with a reference More...
 

Typedefs

typedef struct grpc_avl_node grpc_avl_node
 internal node of an AVL tree More...
 
typedef 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. More...
 
typedef 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_unref when done with a reference More...
 

Functions

grpc_avl grpc_avl_create (const grpc_avl_vtable *vtable)
 Create an immutable AVL tree. More...
 
grpc_avl grpc_avl_ref (grpc_avl avl, void *user_data)
 Add a reference to an existing tree - returns the tree as a convenience. More...
 
void grpc_avl_unref (grpc_avl avl, void *user_data)
 Remove a reference to a tree - destroying it if there are no references left. More...
 
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. More...
 
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. More...
 
void * grpc_avl_get (grpc_avl avl, void *key, void *user_data)
 Lookup key, and return the associated value. More...
 
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. More...
 
int grpc_avl_is_empty (grpc_avl avl)
 Return 1 if avl is empty, 0 otherwise. More...
 

Typedef Documentation

◆ grpc_avl

typedef 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_unref when done with a reference

◆ grpc_avl_node

typedef struct grpc_avl_node grpc_avl_node

internal node of an AVL tree

◆ grpc_avl_vtable

vtable for the AVL tree The optional user_data is propagated from the top level grpc_avl_XXX API.

From the same API call, multiple vtable functions may be called multiple times.

Function Documentation

◆ grpc_avl_add()

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.

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). The optional user_data will be passed to vtable functions.

◆ grpc_avl_create()

grpc_avl grpc_avl_create ( const grpc_avl_vtable vtable)

Create an immutable AVL tree.

◆ grpc_avl_get()

void* grpc_avl_get ( grpc_avl  avl,
void *  key,
void *  user_data 
)

Lookup key, and return the associated value.

Does not mutate avl. Returns NULL if key is not found. The optional user_data will be passed to vtable functions.

◆ grpc_avl_is_empty()

int grpc_avl_is_empty ( grpc_avl  avl)

Return 1 if avl is empty, 0 otherwise.

◆ grpc_avl_maybe_get()

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.

The optional user_data will be passed to vtable functions.

◆ grpc_avl_ref()

grpc_avl grpc_avl_ref ( grpc_avl  avl,
void *  user_data 
)

Add a reference to an existing tree - returns the tree as a convenience.

The optional user_data will be passed to vtable functions.

◆ grpc_avl_remove()

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.

The optional user_data will be passed to vtable functions.

◆ grpc_avl_unref()

void grpc_avl_unref ( grpc_avl  avl,
void *  user_data 
)

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

The optional user_data will be passed to vtable functions.