/****************************************************************** 
 *
 * rbclass.h --
 *
 *     Header for interval red-black tree.
 *
 *
 * $Author: mstoufer $
 * $Source: /home/g2/src/projects/NetLogger/src/nlv/rbclass.h,v $
 * $RCSfile: rbclass.h,v $
 * $Revision: 1.1.1.1 $
 * $Locker:  $
 * $Date: 2000/12/05 19:52:33 $
 *
 ****************************************************************** 
 */
#ifndef NLV_RBTREE_INCLUDED
#define NLV_RBTREE_INCLUDED

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>

/*========= DATA =====================================================*/
#define T Nlv_rb
typedef struct T *T;

/* Data type for tree */
typedef struct Nlv_Interval {
  double low, high;
  double max;
} Nlv_Interval;

/* Red-Black tree description */
typedef enum { BLACK, RED } nodeColor;

typedef struct Node_ {
    struct Node_ *left;         /* left child */
    struct Node_ *right;        /* right child */
    struct Node_ *parent;       /* parent */
    nodeColor color;            /* node color (BLACK, RED) */
    Nlv_Interval data;          /* data stored in node */
} Node;

#define NIL &sentinel           /* All leaves are sentinels */
extern Node sentinel;

/*========= FUNCTIONS ================================================*/

T     Nlv_rbNew();
Node *Nlv_rbInsertNode (T, Nlv_Interval data);
void  Nlv_rbDeleteNode (T, Node *z);
Node *Nlv_rbFindNode   (T, Nlv_Interval data);
void  Nlv_rbDumpInorder(T, FILE *output );

#endif
