-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructs.h
More file actions
62 lines (54 loc) · 1.45 KB
/
structs.h
File metadata and controls
62 lines (54 loc) · 1.45 KB
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
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright (c) 2024, Manolache Maria-Catalina 313CA
*/
#ifndef STRUCTS_H
#define STRUCTS_H
typedef struct dll_node_t {
void *data;
struct dll_node_t *next;
struct dll_node_t *prev;
} dll_node_t;
typedef struct dll_t {
dll_node_t *head;
dll_node_t *tail;
unsigned int size;
unsigned int data_size;
} dll_t;
typedef struct queue_t {
// dimensiunea maxima a cozii
unsigned int max_size;
// dimensiunea cozii
unsigned int size;
// dimensiunea in bytes a tipului de date stocat in coada
unsigned int data_size;
// indexul de la care se vor efectua operatiile de front si dequeue
unsigned int read_idx;
// indexul de la care se vor efectua operatiile de enqueue
unsigned int write_idx;
// bufferul ce stocheaza elementele cozii
void **buff;
} queue_t;
typedef struct hashtable_t {
// vector de liste dublu inlantuite
dll_t **buckets;
// nr. total de noduri existente curent in toate bucket-urile
unsigned int size;
// nr. de bucket-uri
unsigned int hmax;
// pointer la o functie pentru a calcula valoarea hash asociata cheilor
unsigned int (*hash_function)(void *);
// pointer la o functie pentru a compara doua chei
int (*compare_function)(void *, void *);
// pointer la o functie pentru a elibera memoria ocupata de cheie si
// valoare
void (*key_val_free_function)(void *);
} hashtable_t;
typedef struct info {
void *key;
void *value;
} info;
typedef struct doc_t {
void *doc_name;
void *doc_content;
} doc_t;
#endif /* STRUCTS_H */