-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcdHashTable.h
More file actions
69 lines (58 loc) · 2.57 KB
/
cdHashTable.h
File metadata and controls
69 lines (58 loc) · 2.57 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
63
64
65
66
67
68
69
#ifndef _CD_HASHTABLE_H_
#define _CD_HASHTABLE_H_
#include <string>
#include "utils.h"
#include "record.h"
#include "bbst.h"
//o HT POU ZHTA H ASKHSH. Tha ftiaxtei enas gia country kai enas gia disease. H domh tous einai idia omws.
//apoteleitai apo ta ekshs antikeimena:
class block_entry{ //monh lista poy periexei ton katallhlo arithmo onomatwn (basei bucketsize) kai tous deiktes sta dendra
public:
std::string * dis_name_ptr; //deikths se string poy tha filoksenhsei to diseaseID h to country
BBST * tree_ptr; //TREE NODE PTR
int currval; //isws gia to currentpatients??
int totalval; //gia allo erwthma?
block_entry();
int insert_record(record * , std::string );
~block_entry();
};
class chain_node{ //komvos alusidas sto hash table
public:
int block_size; //auto poy tha prokypsei apo th diairesh me bucketsize
block_entry * block; //dunamiko array block_size thesewn
chain_node * next; //epomenos komvos
chain_node(){};
chain_node(int );
bool insert_record(record *, std::string );
void print_contents();
~chain_node();
};
//h genikh morfh tou zhtoumenou HT poy tha klhronomhsoun ta 2 aderfia : diseaseHashTable kai countryHashTable
class cdHashTable{ //o hash table
public:
int size; //megethos pinaka (h1 h h2 analogws)
int bucksize; //to bucketSize ths ekfwnhshs
chain_node ** table; //ena dunamiko array poy periexei ta buckets
cdHashTable(){};
cdHashTable(int , int ); //constructor basei size kai bucketSize
~cdHashTable();
void print_contents(); //ektypwnei auta p exei so far
virtual int insert_record(record * ) {}; //to kathe derived class tha xeristei diaforetiko kleidi
void recordPatientExit(std::string , std::string ); //gia to antistoixo erwthma
};
class diseaseHashTable : public cdHashTable { //o hash table gia disease
public:
diseaseHashTable(int, int);
int insert_record(record * );
int total_recs_for_cat(std::string, std::string , std::string ); //gia to diseaseFrequency xwris orisma country
int total_recs_for_cat(std::string, std::string , std::string , std::string ); //gia to diseaseFrequency ME orisma country
int admissions(std::string, std::string , std::string , std::string ); //gia admissions ME country
int discharges(std::string, std::string , std::string , std::string ); //gia discharges ME country
};
class countryHashTable : public cdHashTable { //o hash table gia disease
public:
countryHashTable(int, int);
int insert_record(record * );
int topk_age_ranges(int , std::string , std::string, std::string , std::string , int *, int *, float *); //omwnymo erwthma
};
#endif