Program Listing for File bstree_node.h

Return to documentation for file (rcsw/ds/bstree_node.h)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcsw/ds/bstree.h"

/*******************************************************************************
 * RCSW Private Functions
 ******************************************************************************/
BEGIN_C_DECLS

RCSW_LOCAL struct bstree_node *bstree_node_create(const struct bstree * tree,
                                       struct bstree_node * parent,
                                       void * key_in, void * data_in,
                                       size_t node_size);

RCSW_LOCAL int bstree_node_destroy(const struct bstree * tree,
                         struct bstree_node *node);

RCSW_LOCAL struct bstree_node *bstree_node_alloc(const struct bstree * tree,
                                      size_t node_size);

RCSW_LOCAL void bstree_node_dealloc(const struct bstree * tree,
                         struct bstree_node *node);

RCSW_LOCAL void *bstree_node_datablock_alloc(const struct bstree * tree);

RCSW_LOCAL void bstree_node_datablock_dealloc(const struct bstree* tree,
                                   dptr_t* datablock);

RCSW_LOCAL int bstree_traverse_nodes_preorder(struct bstree * tree,
                                   struct bstree_node * node,
                                   int (*cb)(const struct bstree * tree,
                                             struct bstree_node * node));

RCSW_LOCAL int bstree_traverse_nodes_inorder(struct bstree * tree,
                                  struct bstree_node * node,
                                  int (*cb)(const struct bstree * tree,
                                            struct bstree_node * node));

RCSW_LOCAL int bstree_traverse_nodes_postorder(struct bstree * tree,
                                    struct bstree_node * node,
                                    int (*cb)(const struct bstree * tree,
                                              struct bstree_node * node));

RCSW_LOCAL void bstree_node_rotate_left(struct bstree * tree,
                             struct bstree_node *node);

RCSW_LOCAL void bstree_node_rotate_right(struct bstree * tree,
                              struct bstree_node *node);

RCSW_LOCAL int bstree_node_print(const struct bstree * tree,
                      const struct bstree_node * node);


RCSW_LOCAL struct bstree_node* bstree_node_successor(const struct bstree* tree,
                                                     const struct bstree_node* node) RCSW_PURE;

/*******************************************************************************
 * API Functions
 ******************************************************************************/
RCSW_API size_t bstree_node_height(const struct bstree* tree,
                                   const struct bstree_node * node) RCSW_PURE;

END_C_DECLS

/* \endcond */