Mescal
Loading...
Searching...
No Matches
type_hash.h
1#ifndef TYPE_HASH_H
2#define TYPE_HASH_H
3
4#include "alloc.h"
5#include "error.h"
6#include "type_basic.h"
7#include <stdbool.h>
8#include <stdio.h>
9#include <stdlib.h>
10
11//#define DEBUG_HASH
12//#undef DEBUG_HASH
13
14typedef struct {
15 uint size;
17 uint inserts;
19 uint* table;
20 uint(*hash_func)(
21 uint, uint);
22 bool (*comp)(
23 uint, uint);
25
26hash_table* create_hash_table(
27 uchar init,
28 uint(*hash_func)(
29 uint, uint),
30 bool (*comp)(
31 uint, uint)
32);
33
34void delete_hash_table(hash_table* ht
35);
36
37uint hash_table_insert(hash_table* ht,
38 uint index
39);
40
41// typedef struct {
42// uint* elem; //!< An element: a permutation of
43// {0,...,n-1}. uint num; //!< Index of the element in
44// the future monoid. uint pred_ele; //!< The preceding
45// element of the state. uint pred_lab; //!< The preceding
46// letter of the state. uint* next; //!< Array of size
47// size_alpha containing the transitions, one for each letter.
48// } mor_elem;
49
50// typedef struct {
51// uint nb_elems;
52// uint nb_states;
53// uint nb_letters;
54// uint size;
55// uint* permuts; //!< size * nb_states.
56// uint* next; //!< size * nb_letters.
57// uint* pred_ele; //!< size.
58// uint* pred_lab; //!< size.
59// } mor_object;
60
61// int comp_mor_elem(uint e1, uint e2, void* param);
62
63// uint hash_mor_elem(uint i, uint size, void* param);
64
65// mor_object* mor_object_init(uint nb_states, uint nb_letters, uchar init);
66
67// void mor_object_free(mor_object* M);
68
69// void mor_object_grow(mor_object* M //!< The morphism object.
70// );
71
72#endif // TYPE_HASH_H
Macros and functions to help memory allocation.
Macros for displaying error messages.
Definition type_hash.h:14
bool(* comp)(uint, uint)
Comparison function for the values in the hash table.
Definition type_hash.h:22
uint collisions
Number of collisions in the hash table.
Definition type_hash.h:18
uint * table
Pointer to the hash table.
Definition type_hash.h:19
uint num_elements
Number of elements in the hash table.
Definition type_hash.h:16
uint size
Size of the hash table.
Definition type_hash.h:15
uint(* hash_func)(uint, uint)
Hash function to compute the index for a given key.
Definition type_hash.h:20
Basic types.