]>
Commit | Line | Data |
---|---|---|
379397bf BN |
1 | /* |
2 | * Copyright (c) 2007 Silicon Graphics, Inc. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it would be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | ||
19 | #ifndef _BTREE_H | |
20 | #define _BTREE_H | |
21 | ||
22 | ||
23 | struct btree_root; | |
24 | ||
25 | void | |
26 | btree_init( | |
27 | struct btree_root **root); | |
28 | ||
29 | void | |
30 | btree_destroy( | |
31 | struct btree_root *root); | |
32 | ||
33 | int | |
34 | btree_is_empty( | |
35 | struct btree_root *root); | |
36 | ||
37 | void * | |
38 | btree_lookup( | |
39 | struct btree_root *root, | |
40 | unsigned long key); | |
41 | ||
42 | void * | |
43 | btree_find( | |
44 | struct btree_root *root, | |
45 | unsigned long key, | |
46 | unsigned long *actual_key); | |
47 | ||
48 | void * | |
49 | btree_peek_prev( | |
50 | struct btree_root *root, | |
51 | unsigned long *key); | |
52 | ||
53 | void * | |
54 | btree_peek_next( | |
55 | struct btree_root *root, | |
56 | unsigned long *key); | |
57 | ||
58 | void * | |
59 | btree_lookup_next( | |
60 | struct btree_root *root, | |
61 | unsigned long *key); | |
62 | ||
63 | void * | |
64 | btree_lookup_prev( | |
65 | struct btree_root *root, | |
66 | unsigned long *key); | |
67 | ||
68 | int | |
69 | btree_insert( | |
70 | struct btree_root *root, | |
71 | unsigned long key, | |
72 | void *value); | |
73 | ||
74 | void * | |
75 | btree_delete( | |
76 | struct btree_root *root, | |
77 | unsigned long key); | |
78 | ||
79 | int | |
80 | btree_update_key( | |
81 | struct btree_root *root, | |
82 | unsigned long old_key, | |
83 | unsigned long new_key); | |
84 | ||
85 | int | |
86 | btree_update_value( | |
87 | struct btree_root *root, | |
88 | unsigned long key, | |
89 | void *new_value); | |
90 | ||
91 | void | |
92 | btree_clear( | |
93 | struct btree_root *root); | |
94 | ||
95 | #ifdef BTREE_STATS | |
96 | void | |
97 | btree_print_stats( | |
98 | struct btree_root *root, | |
99 | FILE *f); | |
100 | #endif | |
101 | ||
102 | #endif /* _BTREE_H */ |