ATLAS Offline Software
Loading...
Searching...
No Matches
trie.h
Go to the documentation of this file.
1/*
2
3Copyright (c) 2005-2008, Simon Howard
4
5Permission to use, copy, modify, and/or distribute this software
6for any purpose with or without fee is hereby granted, provided
7that the above copyright notice and this permission notice appear
8in all copies.
9
10THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
14CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
16NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 */
20
39
40#ifndef ALGORITHM_TRIE_H
41#define ALGORITHM_TRIE_H
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
50
51typedef struct _Trie Trie;
52
56
57typedef void *TrieValue;
58
62
63#define TRIE_NULL ((void *) 0)
64
72
74
80
81void trie_free(Trie *trie);
82
93
94int trie_insert(Trie *trie, char *key, TrieValue value);
95
104
105TrieValue trie_lookup(Trie *trie, char *key);
106
115
116int trie_remove(Trie *trie, char *key);
117
124
126
127#ifdef __cplusplus
128}
129#endif
130
131#endif /* #ifndef ALGORITHM_TRIE_H */
132
TrieValue trie_lookup(Trie *trie, char *key)
Look up a value from its key in a trie.
int trie_remove(Trie *trie, char *key)
Remove an entry from a trie.
int trie_insert(Trie *trie, char *key, TrieValue value)
Insert a new key-value pair into a trie.
int trie_num_entries(Trie *trie)
Find the number of entries in a trie.
void trie_free(Trie *trie)
Destroy a trie.
void * TrieValue
Value stored in a Trie.
Definition trie.h:57
Trie * trie_new(void)
Create a new trie.
struct _Trie Trie
A trie structure.
Definition trie.h:51