|
PULSAR
2.0.0
Parallel Ultra-Light Systolic Array Runtime
|
Dependency-free hash table. More...
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <assert.h>#include <limits.h>#include "icl_hash.h"Go to the source code of this file.
Functions | |
| icl_hash_t * | icl_hash_create (int nbuckets, unsigned int(*hash_function)(void *), int(*hash_key_compare)(void *, void *)) |
| Creates a new hash table. More... | |
| void * | icl_hash_find (icl_hash_t *ht, void *key) |
| Searches for an entry in a hash table. More... | |
| icl_entry_t * | icl_hash_insert (icl_hash_t *ht, void *key, void *data) |
| Inserts an item into a hash table. More... | |
| icl_entry_t * | icl_hash_update_insert (icl_hash_t *ht, void *key, void *data, void **olddata) |
| Replaces an entry in a hash table with a given entry. More... | |
| int | icl_hash_delete (icl_hash_t *ht, void *key, void(*free_key)(void *), void(*free_data)(void *)) |
| Frees one hash table entry located by a key. Key and data are freed using functions. More... | |
| int | icl_hash_destroy (icl_hash_t *ht, void(*free_key)(void *), void(*free_data)(void *)) |
| Destroys a hash table. Keys and data are freed using functions. More... | |
| int | icl_hash_dump (FILE *stream, icl_hash_t *ht) |
| Dumps the hash table's contents to the given file pointer. More... | |
Dependency-free hash table.
PULSAR Runtime http://icl.utk.edu/pulsar/ Copyright (C) 2012-2015 University of Tennessee.
Definition in file icl_hash.c.
| icl_hash_t* icl_hash_create | ( | int | nbuckets, |
| unsigned int(*)(void *) | hash_function, | ||
| int(*)(void *, void *) | hash_key_compare | ||
| ) |
Creates a new hash table.
| nbuckets | – The number of buckets to create. |
| hash_function | – The pointer to the hashing function. |
| hash_key_compare | – The pointer to the hash key comparison function. |
Definition at line 71 of file icl_hash.c.
| int icl_hash_delete | ( | icl_hash_t * | ht, |
| void * | key, | ||
| void(*)(void *) | free_key, | ||
| void(*)(void *) | free_data | ||
| ) |
Frees one hash table entry located by a key. Key and data are freed using functions.
| ht | – The hash table. |
| key | – The key of the item to be deleted. |
| free_key | – The pointer to the function that frees the key. |
| free_data | – The pointer to the function that frees the data. |
| 0 | on success. |
| -1 | on failure. |
Definition at line 234 of file icl_hash.c.
| int icl_hash_destroy | ( | icl_hash_t * | ht, |
| void(*)(void *) | free_key, | ||
| void(*)(void *) | free_data | ||
| ) |
Destroys a hash table. Keys and data are freed using functions.
| ht | – The hash table to destroy. |
| free_key | – The pointer to function that frees the keys. |
| free_data | – The pointer to function that frees the data. |
| 0 | on success. |
| -1 | on failure. |
Definition at line 282 of file icl_hash.c.
| int icl_hash_dump | ( | FILE * | stream, |
| icl_hash_t * | ht | ||
| ) |
Dumps the hash table's contents to the given file pointer.
| stream | – The file to dump the hash table to. |
| ht | – The hash table to be dumped. |
| 0 | on success. |
| -1 | on failure. |
Definition at line 323 of file icl_hash.c.
| void* icl_hash_find | ( | icl_hash_t * | ht, |
| void * | key | ||
| ) |
Searches for an entry in a hash table.
| ht | – The hash table to be searched. |
| key | – The key of the item to search for. |
Definition at line 109 of file icl_hash.c.
| icl_entry_t* icl_hash_insert | ( | icl_hash_t * | ht, |
| void * | key, | ||
| void * | data | ||
| ) |
Inserts an item into a hash table.
| ht | – The hash table. |
| key | – The key of the new item. |
| data | – The pointer to the new item's data. |
Definition at line 135 of file icl_hash.c.
| icl_entry_t* icl_hash_update_insert | ( | icl_hash_t * | ht, |
| void * | key, | ||
| void * | data, | ||
| void ** | olddata | ||
| ) |
Replaces an entry in a hash table with a given entry.
| ht | – The hash table. |
| key | – The key of the new item. |
| data | – The pointer to the new item's data. |
| olddata | – The pointer to the old item's data (set upon return). |
Definition at line 174 of file icl_hash.c.