Project

General

Profile

Statistics
| Branch: | Revision:

cool / src / lib / GMLMIP-0.1 / rules / radixtree.h @ 7c4d2eb4

History | View | Annotate | Download (653 Bytes)

1
#ifndef RADIXTREE_HH
2
#define RADIXTREE_HH
3

    
4
#include <cstdlib>
5
#include <vector>
6

    
7
using namespace std;
8

    
9
class Radixtree {
10
        private:
11
                typedef struct nd {
12
                  struct nd *left;
13
                  struct nd *right;
14
                  nd() { left = right = NULL; };
15
                } node;
16

    
17
                int depth;
18
                node *root;
19

    
20
                void removeNodes(node* nd);
21
                int size_intern(int d, node* nd);
22

    
23
        public:
24
                Radixtree(int n) {
25
                        depth = n;
26
                        root = new node();
27
                };
28

    
29
                ~Radixtree(){ removeNodes(root); };
30

    
31
                int size() { return size_intern(depth, root); };
32
                void clear() { removeNodes(root); root = new node(); };
33
                void add_element(vector<bool>& elem);
34
                bool contains_element(vector<bool>& elem);
35
};
36

    
37
#endif