25 #ifndef OMPI_RB_TREE_H
26 #define OMPI_RB_TREE_H
28 #include "ompi_config.h"
30 #include "ompi/constants.h"
32 #include "ompi/class/ompi_free_list.h"
OMPI_DECLSPEC int ompi_rb_tree_destroy(ompi_rb_tree_t *tree)
frees all the nodes on the tree
Definition: ompi_rb_tree.c:268
ompi_rb_tree_nodecolor_t color
the node color
Definition: ompi_rb_tree.h:50
OMPI_DECLSPEC int ompi_rb_tree_init(ompi_rb_tree_t *tree, ompi_rb_tree_comp_fn_t comp)
the function creates a new tree
Definition: ompi_rb_tree.c:70
OMPI_DECLSPEC int ompi_rb_tree_delete(ompi_rb_tree_t *tree, void *key)
deletes a node based on its key
Definition: ompi_rb_tree.c:217
ompi_rb_tree_node_t * root_ptr
a pointer to the root of the tree
Definition: ompi_rb_tree.h:72
ompi_rb_tree_nodecolor_t
red and black enum
Definition: ompi_rb_tree.h:42
int(* ompi_rb_tree_comp_fn_t)(void *key1, void *key2)
the compare function typedef.
Definition: ompi_rb_tree.h:62
node data structure
Definition: ompi_rb_tree.h:47
ompi_rb_tree_comp_fn_t comp
the compare function
Definition: ompi_rb_tree.h:74
OMPI_DECLSPEC void ompi_rb_tree_destruct(opal_object_t *object)
the destruct function.
Definition: ompi_rb_tree.c:60
OMPI_DECLSPEC int ompi_rb_tree_size(ompi_rb_tree_t *tree)
returns the size of the tree
Definition: ompi_rb_tree.c:531
size_t tree_size
the size of the tree
Definition: ompi_rb_tree.h:76
struct ompi_rb_tree_node_t * right
the right child - can be nill
Definition: ompi_rb_tree.h:53
static void * ompi_rb_tree_find(ompi_rb_tree_t *tree, void *key)
finds a value in the tree based on the passed key
Definition: ompi_rb_tree.h:167
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_rb_tree_node_t)
declare the tree node as a class
OMPI_DECLSPEC void ompi_rb_tree_construct(opal_object_t *object)
the construct function.
Definition: ompi_rb_tree.c:48
OMPI_DECLSPEC void * ompi_rb_tree_find_with(ompi_rb_tree_t *tree, void *key, ompi_rb_tree_comp_fn_t compfn)
finds a value in the tree based on the passed key using passed compare function
Definition: ompi_rb_tree.c:174
void * value
a pointer to the value
Definition: ompi_rb_tree.h:55
struct ompi_rb_tree_node_t * parent
the parent node, can be NULL
Definition: ompi_rb_tree.h:51
ompi_rb_tree_node_t * nill
the nill sentinal node
Definition: ompi_rb_tree.h:73
void * key
a pointer to the key
Definition: ompi_rb_tree.h:54
Definition: ompi_free_list.h:39
Definition: ompi_free_list.h:62
Base object.
Definition: opal_object.h:182
int(* ompi_rb_tree_condition_fn_t)(void *)
this function is used for the ompi_rb_tree_traverse function.
Definition: ompi_rb_tree.h:91
the data structure that holds all the needed information about the tree.
Definition: ompi_rb_tree.h:67
ompi_free_list_t free_list
the free list to get the memory from
Definition: ompi_rb_tree.h:75
ompi_free_list_item_t super
the parent class
Definition: ompi_rb_tree.h:49
opal_object_t parent
the parent class
Definition: ompi_rb_tree.h:68
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
OMPI_DECLSPEC int ompi_rb_tree_insert(ompi_rb_tree_t *tree, void *key, void *value)
inserts a node into the tree
Definition: ompi_rb_tree.c:110
void(* ompi_rb_tree_action_fn_t)(void *, void *)
this function is uused for the user to perform any action on the passed values.
Definition: ompi_rb_tree.h:98
struct ompi_rb_tree_node_t * left
the left child - can be nill
Definition: ompi_rb_tree.h:52
OMPI_DECLSPEC int ompi_rb_tree_traverse(ompi_rb_tree_t *tree, ompi_rb_tree_condition_fn_t cond, ompi_rb_tree_action_fn_t action)
traverses the entire tree, performing the cond function on each of the values and if it returns one i...
Definition: ompi_rb_tree.c:439