-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashtable_r.h
51 lines (31 loc) · 1 KB
/
hashtable_r.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _HASHTABLE_H_
#define _HASHTABLE_H_
#include <stddef.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include "pattern.h"
typedef struct _hash_en{
struct _hash_en *next;
void *payload;
int key;
} hash_en;
typedef struct {
int capacity;
int numberofelements;
hash_en **tab;
} hash_tab;
hash_tab* createhash_tab(int capacity);
void freehash_tab(hash_tab* hashTable);
int insertEntry(hash_tab* hashTable, hash_en* r, int key);
size_t getNumRules(const hash_tab* t);
bool hasKey(const hash_tab* t, const int key);
int hashKey(size_t capacity, pattern* p);
void printTableRules(const hash_tab* t);
void printTableStates(const hash_tab* t);
void printTablePattern(const hash_tab* t);
void printTableTransitions(const hash_tab* t);
bool existState(const hash_tab* t,const pattern* p,const int key);
const rule* getRule(const hash_tab *t,const pattern* p,const int key);
const statef* getState(const hash_tab *t,const pattern* p,const int key);
#endif