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