5 Struct HASH_TABLE
gullradriel edited this page 2026-10-09 00:55:18 +02:00

HASH_TABLE

Module: HASH TABLES: classic or trie tree hash_tables

structure of a hash table

#include "n_hash.h"

Public Attributes

Name
size_t size
size of the hash table
size_t seed
table's seed
HASH_NODE * root
HASH_TRIE mode: Start of tree.
size_t nb_keys
total number of used keys in the table
unsigned int mode
hashing mode, murmurhash and classic HASH_MURMUR, or HASH_TRIE
LIST ()(struct HASH_TABLE *table, int(*node_is_matching)(HASH_NODE *node)) ht_search
search elements given an expression
int(*)(struct HASH_TABLE *table, const char *key) ht_remove
remove given's key node from the table
int(*)(struct HASH_TABLE *table, const char *key, char *val) ht_put_string_ptr
put an char *string pointer
int(*)(struct HASH_TABLE *table, const char *key, char *val) ht_put_string
put an char *string
int(*)(struct HASH_TABLE *table, const char *key, void *ptr, void(*destructor)(void *ptr), void *(*duplicator)(void *ptr)) ht_put_ptr
put a a pointer
int(*)(struct HASH_TABLE *table, const char *key, int64_t val) ht_put_int
put an integer
int(*)(struct HASH_TABLE *table, const char *key, double val) ht_put_double
put a double
void(*)(struct HASH_TABLE *table) ht_print
print table
int(*)(struct HASH_TABLE *table, const char *key, char **val) ht_get_string
get a char *string from a key's node
int(*)(struct HASH_TABLE *table, const char *key, void **val) ht_get_ptr
get a pointer from a key's node
HASH_NODE ()(struct HASH_TABLE *table, const char *key) ht_get_node
get HASH_NODE at 'key' from table
int(*)(struct HASH_TABLE *table, const char *key, int64_t *val) ht_get_int
get an int from a key's node
int(*)(struct HASH_TABLE *table, const char *key, double *val) ht_get_double
get a double from a key's node
LIST ** hash_table
HASH_CLASSIC mode: preallocated hash table.
int(*)(struct HASH_TABLE *table) empty_ht
empty a hash table.
int(*)(struct HASH_TABLE **table) destroy_ht
destroy a hash table
size_t alphabet_offset
HASH_TRIE mode: offset to deduce to individual key digits.
size_t alphabet_length
HASH_TRIE mode: size of the alphabet.

Public Attributes Documentation

variable size

size_t size;

size of the hash table

variable seed

size_t seed;

table's seed

variable root

HASH_NODE * root;

HASH_TRIE mode: Start of tree.

variable nb_keys

size_t nb_keys;

total number of used keys in the table

variable mode

unsigned int mode;

hashing mode, murmurhash and classic HASH_MURMUR, or HASH_TRIE

LIST *(*)(struct HASH_TABLE *table, int(*node_is_matching)(HASH_NODE *node)) ht_search;

search elements given an expression

variable ht_remove

int(*)(struct HASH_TABLE *table, const char *key) ht_remove;

remove given's key node from the table

variable ht_put_string_ptr

int(*)(struct HASH_TABLE *table, const char *key, char *val) ht_put_string_ptr;

put an char *string pointer

variable ht_put_string

int(*)(struct HASH_TABLE *table, const char *key, char *val) ht_put_string;

put an char *string

variable ht_put_ptr

int(*)(struct HASH_TABLE *table, const char *key, void *ptr, void(*destructor)(void *ptr), void *(*duplicator)(void *ptr)) ht_put_ptr;

put a a pointer

variable ht_put_int

int(*)(struct HASH_TABLE *table, const char *key, int64_t val) ht_put_int;

put an integer

variable ht_put_double

int(*)(struct HASH_TABLE *table, const char *key, double val) ht_put_double;

put a double

variable ht_print

void(*)(struct HASH_TABLE *table) ht_print;

print table

variable ht_get_string

int(*)(struct HASH_TABLE *table, const char *key, char **val) ht_get_string;

get a char *string from a key's node

variable ht_get_ptr

int(*)(struct HASH_TABLE *table, const char *key, void **val) ht_get_ptr;

get a pointer from a key's node

variable ht_get_node

HASH_NODE *(*)(struct HASH_TABLE *table, const char *key) ht_get_node;

get HASH_NODE at 'key' from table

variable ht_get_int

int(*)(struct HASH_TABLE *table, const char *key, int64_t *val) ht_get_int;

get an int from a key's node

variable ht_get_double

int(*)(struct HASH_TABLE *table, const char *key, double *val) ht_get_double;

get a double from a key's node

variable hash_table

LIST ** hash_table;

HASH_CLASSIC mode: preallocated hash table.

variable empty_ht

int(*)(struct HASH_TABLE *table) empty_ht;

empty a hash table.

char *strings are also freed

variable destroy_ht

int(*)(struct HASH_TABLE **table) destroy_ht;

destroy a hash table

variable alphabet_offset

size_t alphabet_offset;

HASH_TRIE mode: offset to deduce to individual key digits.

variable alphabet_length

size_t alphabet_length;

HASH_TRIE mode: size of the alphabet.