-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTree.h
46 lines (34 loc) · 1.02 KB
/
Tree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef TREE_H
#define TREE_H
#include <iostream>
using namespace std;
// debug message
static const char ALLOCATE[] = " - Allocating]\n";
static const char TREE[] = "[Tree ";
template <class Whatever>
struct TNode;
template <class Whatever>
class Tree {
friend struct TNode<Whatever>;
long occupancy;
TNode<Whatever> * root;
unsigned long tree_count;
static int debug;
public:
Tree (void): occupancy (0), root (NULL) {
static long counter;
tree_count = ++counter;
if (debug) {
cerr << TREE << tree_count << ALLOCATE;
}
}
~Tree (void);
static void Set_Debug_On (void);
static void Set_Debug_Off (void);
unsigned long Insert (const Whatever &);
unsigned long Lookup (Whatever &) const;
unsigned long Remove (Whatever &);
ostream & Write (ostream &) const;
};
#include "Tree.c"
#endif