ROSS
Functions | Variables
avl_tree.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "avl_tree.h"

Go to the source code of this file.

Functions

void avlDestroy (AvlTree t)
 
int avlGetHeight (AvlTree t)
 
int avlSearch (AvlTree t, tw_event *key)
 
void avlSanityCheck (AvlTree root)
 
static void avlFixHeight (AvlTree t)
 
static void avlRotate (AvlTree *root, int d)
 
static void avlRebalance (AvlTree *t)
 
void avlInsert (AvlTree *t, tw_event *key)
 
void avlPrintKeys (AvlTree t)
 
tw_eventavlDeleteMin (AvlTree *t)
 
tw_eventavlDelete (AvlTree *t, tw_event *key)
 
AvlTree avl_alloc (void)
 
void avl_free (AvlTree t)
 

Variables

tw_pepe
 

Function Documentation

AvlTree avl_alloc ( void  )

Definition at line 300 of file avl_tree.c.

References tw_pe::avl_list_head, g_tw_avl_node_count, g_tw_pe, avlNode::next, tw_error(), and TW_LOC.

Referenced by avlInsert().

Here is the call graph for this function:

Here is the caller graph for this function:

void avl_free ( AvlTree  t)

Definition at line 316 of file avl_tree.c.

References AVL_EMPTY, tw_pe::avl_list_head, and g_tw_pe.

Referenced by avlDelete(), avlDeleteMin(), and avlDestroy().

Here is the caller graph for this function:

tw_event* avlDelete ( AvlTree t,
tw_event key 
)

Definition at line 251 of file avl_tree.c.

References AVL_EMPTY, avl_free(), avlDelete(), avlDeleteMin(), avlRebalance(), avlNode::child, tw_event::event_id, tw_event::recv_ts, tw_event::send_pe, tw_error(), TW_LOC, and TW_STIME_CMP.

Referenced by avlDelete(), and tw_hash_remove().

Here is the call graph for this function:

Here is the caller graph for this function:

tw_event* avlDeleteMin ( AvlTree t)

Definition at line 226 of file avl_tree.c.

References AVL_EMPTY, avl_free(), avlDeleteMin(), avlRebalance(), avlNode::child, and avlNode::key.

Referenced by avlDelete(), and avlDeleteMin().

Here is the call graph for this function:

Here is the caller graph for this function:

void avlDestroy ( AvlTree  t)

Definition at line 15 of file avl_tree.c.

References AVL_EMPTY, avl_free(), avlDestroy(), and avlNode::child.

Referenced by avlDestroy().

Here is the call graph for this function:

Here is the caller graph for this function:

static void avlFixHeight ( AvlTree  t)
static

Definition at line 87 of file avl_tree.c.

References AVL_EMPTY, avlGetHeight(), avlNode::child, avlNode::height, and ROSS_MAX.

Referenced by avlRebalance(), and avlRotate().

Here is the call graph for this function:

Here is the caller graph for this function:

int avlGetHeight ( AvlTree  t)

Definition at line 28 of file avl_tree.c.

References AVL_EMPTY, and avlNode::height.

Referenced by avlFixHeight(), avlRebalance(), and avlSanityCheck().

Here is the caller graph for this function:

void avlInsert ( AvlTree t,
tw_event key 
)

Definition at line 163 of file avl_tree.c.

References avl_alloc(), AVL_EMPTY, avlInsert(), avlRebalance(), tw_event::event_id, g_tw_avl_node_count, tw_event::recv_ts, tw_event::send_pe, tw_error(), TW_LOC, tw_printf(), and TW_STIME_CMP.

Referenced by avlInsert(), and tw_hash_insert().

Here is the call graph for this function:

Here is the caller graph for this function:

void avlPrintKeys ( AvlTree  t)

Definition at line 214 of file avl_tree.c.

References AVL_EMPTY, avlPrintKeys(), and avlNode::child.

Referenced by avlPrintKeys().

Here is the call graph for this function:

Here is the caller graph for this function:

static void avlRebalance ( AvlTree t)
static

Definition at line 129 of file avl_tree.c.

References AVL_EMPTY, avlFixHeight(), avlGetHeight(), and avlRotate().

Referenced by avlDelete(), avlDeleteMin(), and avlInsert().

Here is the call graph for this function:

Here is the caller graph for this function:

static void avlRotate ( AvlTree root,
int  d 
)
static

Definition at line 106 of file avl_tree.c.

References avlFixHeight(), and avlNode::child.

Referenced by avlRebalance().

Here is the call graph for this function:

Here is the caller graph for this function:

void avlSanityCheck ( AvlTree  root)

Definition at line 72 of file avl_tree.c.

References AVL_EMPTY, avlGetHeight(), avlSanityCheck(), avlNode::child, avlNode::height, and ROSS_MAX.

Referenced by avlSanityCheck().

Here is the call graph for this function:

Here is the caller graph for this function:

int avlSearch ( AvlTree  t,
tw_event key 
)

Definition at line 40 of file avl_tree.c.

References AVL_EMPTY, avlSearch(), avlNode::child, tw_event::event_id, avlNode::key, tw_event::recv_ts, tw_event::send_pe, and TW_STIME_CMP.

Referenced by avlSearch().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

tw_pe* pe