Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

hash.h File Reference


Detailed Description

Dictionary implementation via closed hash Copyright 1998-2001 Russell Leighton

#include "errors.h"
#include "util.h"

Go to the source code of this file.

Data Structures

struct  aw_hash32_entry_t
struct  aw_hash32_t
struct  aw_hash64_entry_t
struct  aw_hash64_t
struct  aw_hashString_entry_t
struct  aw_hashString_t

Defines

#define AW_HASH_NULL_KEY   0

Functions

void aw_hash32_clear (aw_hash32_t *ht)
 Reset hash.

void aw_hash32_delete (u_int32_t key, aw_hash32_t *ht)
 Delete user_pointer associated with key.

void aw_hash32_destroy (aw_hash32_t *ht)
 Free Hash.

void * aw_hash32_fetch (u_int32_t key, const aw_hash32_t *ht)
 Return user_pointer associated with key.

int32_t aw_hash32_incr (u_int32_t key, int32_t incr, aw_hash32_t *ht)
 interpret the user pointer as a 32bit signed int and increment by 'incr'

int aw_hash32_insert (u_int32_t key, void *user_pointer, aw_hash32_t *ht)
 Associated key with user_pointer in ht.

aw_hash32_t * aw_hash32_make (u_int32_t nentries)
 Create closed hash table using 32bit keys.

void aw_hash32_map (aw_hash32_t *ht, void *user_pointer, void(*eval)(void *user_pointer, u_int32_t key, void *valuer_ptr))
 eval( user_pointer, key, value_ptr ) for all elements

void aw_hash32_thin (aw_hash32_t *ht, void *user_pointer, u_int32_t(*eval)(void *user_pointer, void *valuer_ptr))
 free the memory for those nodes that eval( user_pointer, value_ptr ) returns non-zero

void aw_hash64_clear (aw_hash64_t *ht)
 Reset hash.

void aw_hash64_delete (u_int64_t key, aw_hash64_t *ht)
 Delete user_pointer associated with key.

void aw_hash64_destroy (aw_hash64_t *ht)
 Free Hash.

void * aw_hash64_fetch (u_int64_t key, const aw_hash64_t *ht)
 Return user_pointer associated with key.

int32_t aw_hash64_incr (u_int64_t key, int32_t incr, aw_hash64_t *ht)
 interpret the user pointer as a 32bit signed int and increment by 'incr'

int aw_hash64_insert (u_int64_t key, void *user_pointer, aw_hash64_t *ht)
 Associated key with user_pointer in ht.

aw_hash64_t * aw_hash64_make (u_int32_t nentries)
 Create closed hash table using 64bit keys.

void aw_hash64_map (aw_hash64_t *ht, void *user_pointer, void(*eval)(void *user_pointer, u_int64_t key, void *valuer_ptr))
 eval( user_pointer, key, value_ptr ) for all elements

void aw_hash64_thin (aw_hash64_t *ht, void *user_pointer, u_int32_t(*eval)(void *user_pointer, void *valuer_ptr))
 free the memory for those nodes that eval( user_pointer, value_ptr ) returns non-zero

void aw_hashString_clear (aw_hashString_t *ht)
 Reset hash.

void aw_hashString_delete (const byte_t *key, aw_hashString_t *ht)
 Delete user_pointer associated with key.

void aw_hashString_destroy (aw_hashString_t *ht)
 Free Hash.

void * aw_hashString_fetch (const byte_t *key, const aw_hashString_t *ht)
 Return user_pointer associated with key.

int aw_hashString_insert (const byte_t *key, void *user_pointer, aw_hashString_t *ht)
 Associated key with user_pointer in ht.

aw_hashString_t * aw_hashString_make (u_int32_t nentries)
 Create closed hash table using 32bit keys.

void aw_hashString_map (aw_hashString_t *ht, void *user_pointer, void(*eval)(void *user_pointer, byte_t *key, void *valuer_ptr))
 eval( user_pointer, key, value_ptr ) for all elements

void aw_hashString_thin (aw_hashString_t *ht, void *user_pointer, u_int32_t(*eval)(void *user_pointer, void *valuer_ptr))
 free the memory for those nodes that eval( user_pointer, value_ptr ) returns non-zero


Define Documentation

#define AW_HASH_NULL_KEY   0
 


Function Documentation

void aw_hash32_clear (  aw_hash32_t *  ht  ) 
 

Reset hash.

aw_hash32_clear

Parameters:
ht Hash table

void aw_hash32_delete (  u_int32_t  key,
aw_hash32_t *  ht
) 
 

Delete user_pointer associated with key.

aw_hash32_delete

Parameters:
key Key
ht Hash table

void aw_hash32_destroy (  aw_hash32_t *  ht  ) 
 

Free Hash.

aw_hash32_destroy

Parameters:
ht Hash table

void* aw_hash32_fetch (  u_int32_t  key,
const aw_hash32_t *  ht
) 
 

Return user_pointer associated with key.

aw_hash32_fetch

Parameters:
key Key
ht Hash table
Returns:
User stored pointer

int32_t aw_hash32_incr (  u_int32_t  key,
int32_t  incr,
aw_hash32_t *  ht
) 
 

interpret the user pointer as a 32bit signed int and increment by 'incr'

aw_hash32_incr

Parameters:
key Key
incr amount to increment (may be neg for decr)
ht Hash table
Returns:
0 on success

int aw_hash32_insert (  u_int32_t  key,
void *  user_pointer,
aw_hash32_t *  ht
) 
 

Associated key with user_pointer in ht.

aw_hash32_insert

Parameters:
key Key
user_pointer Value to associate with key
ht Hash table
Returns:
0 on success

aw_hash32_t* aw_hash32_make (  u_int32_t  nentries  ) 
 

Create closed hash table using 32bit keys.

aw_hash32_make

Parameters:
nentries Initial size of table (2 times expected total is good value)

void aw_hash32_map (  aw_hash32_t *  ht,
void *  user_pointer,
void(*  eval)(void *user_pointer, u_int32_t key, void *valuer_ptr)
) 
 

eval( user_pointer, key, value_ptr ) for all elements

aw_hash32_map

Parameters:
ht Hashtable
user_pointer Pointer to object you need in the eval function
eval Pointer to function to apply to each key/ptr in table

void aw_hash32_thin (  aw_hash32_t *  ht,
void *  user_pointer,
u_int32_t(*  eval)(void *user_pointer, void *valuer_ptr)
) 
 

free the memory for those nodes that eval( user_pointer, value_ptr ) returns non-zero

aw_hash32_thin

Parameters:
ht Hashtable
user_pointer Pointer to object you need in the eval function
eval Pointer to function to apply to each key/ptr in table, if return is non-zero then delete

void aw_hash64_clear (  aw_hash64_t *  ht  ) 
 

Reset hash.

aw_hash64_clear

Parameters:
ht Hash table

void aw_hash64_delete (  u_int64_t  key,
aw_hash64_t *  ht
) 
 

Delete user_pointer associated with key.

aw_hash64_delete

Parameters:
key Key
ht Hash table

void aw_hash64_destroy (  aw_hash64_t *  ht  ) 
 

Free Hash.

aw_hash64_destroy

Parameters:
ht Hash table

void* aw_hash64_fetch (  u_int64_t  key,
const aw_hash64_t *  ht
) 
 

Return user_pointer associated with key.

aw_hash64_fetch

Parameters:
key Key
ht Hash table
Returns:
User stored pointer

int32_t aw_hash64_incr (  u_int64_t  key,
int32_t  incr,
aw_hash64_t *  ht
) 
 

interpret the user pointer as a 32bit signed int and increment by 'incr'

aw_hash64_incr

Parameters:
key Key
incr amount to increment (may be neg for decr)
ht Hash table
Returns:
0 on success

int aw_hash64_insert (  u_int64_t  key,
void *  user_pointer,
aw_hash64_t *  ht
) 
 

Associated key with user_pointer in ht.

aw_hash64_insert

Parameters:
key Key
user_pointer Value to associate with key
ht Hash table
Returns:
0 on success

aw_hash64_t* aw_hash64_make (  u_int32_t  nentries  ) 
 

Create closed hash table using 64bit keys.

aw_hash64_make

Parameters:
nentries Initial size of table (2 times expected total is good value)

void aw_hash64_map (  aw_hash64_t *  ht,
void *  user_pointer,
void(*  eval)(void *user_pointer, u_int64_t key, void *valuer_ptr)
) 
 

eval( user_pointer, key, value_ptr ) for all elements

aw_hash64_map

Parameters:
ht Hashtable
user_pointer Pointer to object you need in the eval function
eval Pointer to function to apply to each key/ptr in table

void aw_hash64_thin (  aw_hash64_t *  ht,
void *  user_pointer,
u_int32_t(*  eval)(void *user_pointer, void *valuer_ptr)
) 
 

free the memory for those nodes that eval( user_pointer, value_ptr ) returns non-zero

aw_hash64_thin

Parameters:
ht Hashtable
user_pointer Pointer to object you need in the eval function
eval Pointer to function to apply to each key/ptr in table, if return is non-zero then delete

void aw_hashString_clear (  aw_hashString_t *  ht  ) 
 

Reset hash.

aw_hashString_clear

Parameters:
ht Hash table

void aw_hashString_delete (  const byte_t *  key,
aw_hashString_t *  ht
) 
 

Delete user_pointer associated with key.

aw_hashString_delete

Parameters:
key Key
ht Hash table

void aw_hashString_destroy (  aw_hashString_t *  ht  ) 
 

Free Hash.

aw_hashString_destroy

Parameters:
ht Hash table

void* aw_hashString_fetch (  const byte_t *  key,
const aw_hashString_t *  ht
) 
 

Return user_pointer associated with key.

aw_hashString_fetch

Parameters:
key Key
ht Hash table
Returns:
User stored pointer

int aw_hashString_insert (  const byte_t *  key,
void *  user_pointer,
aw_hashString_t *  ht
) 
 

Associated key with user_pointer in ht.

aw_hashString_insert

Parameters:
key Key
user_pointer Value to associate with key
ht Hash table
Returns:
0 on success

aw_hashString_t* aw_hashString_make (  u_int32_t  nentries  ) 
 

Create closed hash table using 32bit keys.

aw_hashString_make

Parameters:
nentries Initial size of table (2 times expected total is good value)

void aw_hashString_map (  aw_hashString_t *  ht,
void *  user_pointer,
void(*  eval)(void *user_pointer, byte_t *key, void *valuer_ptr)
) 
 

eval( user_pointer, key, value_ptr ) for all elements

aw_hashString_map

Parameters:
ht Hashtable
user_pointer Pointer to object you need in the eval function
eval Pointer to function to apply to each key/ptr in table

void aw_hashString_thin (  aw_hashString_t *  ht,
void *  user_pointer,
u_int32_t(*  eval)(void *user_pointer, void *valuer_ptr)
) 
 

free the memory for those nodes that eval( user_pointer, value_ptr ) returns non-zero

aw_hashString_thin

Parameters:
ht Hashtable
user_pointer Pointer to object you need in the eval function
eval Pointer to function to apply to each key/ptr in table, if return is non-zero then delete

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)