ATLAS Offline Software
hash-table.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 
45 #ifndef ALGORITHM_HASH_TABLE_H
46 #define ALGORITHM_HASH_TABLE_H
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
56 typedef struct _HashTable HashTable;
57 
63 
68 typedef struct _HashTableEntry HashTableEntry;
69 
74 typedef void *HashTableKey;
75 
80 typedef void *HashTableValue;
81 
90 };
91 
96 #define HASH_TABLE_NULL ((void *) 0)
97 
106 typedef unsigned long (*HashTableHashFunc)(HashTableKey value);
107 
115 typedef int (*HashTableEqualFunc)(HashTableKey value1, HashTableKey value2);
116 
123 
130 
144  HashTableEqualFunc equal_func);
145 
152 void hash_table_free(HashTable *hash_table);
153 
164  HashTableKeyFreeFunc key_free_func,
165  HashTableValueFreeFunc value_free_func);
166 
179 int hash_table_insert(HashTable *hash_table,
180  HashTableKey key,
182 
193  HashTableKey key);
194 
205 
214 
224 
236 
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 
252 #endif /* #ifndef ALGORITHM_HASH_TABLE_H */
253 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
hash_table_iter_next
HashTableValue hash_table_iter_next(HashTableIterator *iterator)
Using a hash table iterator, retrieve the next key.
HashTableKey
void * HashTableKey
A key to look up a value in a HashTable.
Definition: hash-table.h:74
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
_HashTableIterator::next_chain
int next_chain
Definition: hash-table.h:89
HashTable
struct _HashTable HashTable
A hash table structure.
Definition: hash-table.h:56
athena.value
value
Definition: athena.py:122
HashTableKeyFreeFunc
void(* HashTableKeyFreeFunc)(HashTableKey value)
Type of function used to free keys when entries are removed from a hash table.
Definition: hash-table.h:122
_HashTableIterator
Definition of a HashTableIterator.
Definition: hash-table.h:86
_HashTableIterator::hash_table
HashTable * hash_table
Definition: hash-table.h:87
HashTableEntry
struct _HashTableEntry HashTableEntry
Internal structure representing an entry in a hash table.
Definition: hash-table.h:68
hash_table_insert
int hash_table_insert(HashTable *hash_table, HashTableKey key, HashTableValue value)
Insert a value into a hash table, overwriting any existing entry using the same key.
hash_table_free
void hash_table_free(HashTable *hash_table)
Destroy a hash table.
hash_table_iterate
void hash_table_iterate(HashTable *hash_table, HashTableIterator *iter)
Initialise a HashTableIterator to iterate over a hash table.
HashTableValueFreeFunc
void(* HashTableValueFreeFunc)(HashTableValue value)
Type of function used to free values when entries are removed from a hash table.
Definition: hash-table.h:129
hash_table_register_free_functions
void hash_table_register_free_functions(HashTable *hash_table, HashTableKeyFreeFunc key_free_func, HashTableValueFreeFunc value_free_func)
Register functions used to free the key and value when an entry is removed from a hash table.
_HashTableIterator::next_entry
HashTableEntry * next_entry
Definition: hash-table.h:88
hash_table_num_entries
int hash_table_num_entries(HashTable *hash_table)
Retrieve the number of entries in a hash table.
hash_table_remove
int hash_table_remove(HashTable *hash_table, HashTableKey key)
Remove a value from a hash table.
hash_table_new
HashTable * hash_table_new(HashTableHashFunc hash_func, HashTableEqualFunc equal_func)
Create a new hash table.
hash_table_iter_has_more
int hash_table_iter_has_more(HashTableIterator *iterator)
Determine if there are more keys in the hash table to iterate over.
HashTableEqualFunc
int(* HashTableEqualFunc)(HashTableKey value1, HashTableKey value2)
Function used to compare two keys for equality.
Definition: hash-table.h:115
HashTableHashFunc
unsigned long(* HashTableHashFunc)(HashTableKey value)
Hash function used to generate hash values for keys used in a hash table.
Definition: hash-table.h:106
hash_table_lookup
HashTableValue hash_table_lookup(HashTable *hash_table, HashTableKey key)
Look up a value in a hash table by key.
HashTableValue
void * HashTableValue
A value stored in a HashTable.
Definition: hash-table.h:80
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37