-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
107 lines (90 loc) · 2.93 KB
/
main.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <iostream>
#include <string>
#include "estruturas.h"
#include "construcao.h"
#include "interface.h"
#include "Timer.cpp"
using namespace std;
#define RATINGS "minirating.csv"
#define MOVIES "movie.csv"
#define TAGS "tag.csv"
#define KILO 1000
#define MEGA 1000000
int main()
{
database db;
trie_tree movies_trie;
hashtable movies_hash(10, POLINOMIAL, QUADRATIC);
hashtable users_hash(10, POLINOMIAL, QUADRATIC);
bool end_app = true;
movie mtest;
date dtest;
rating rtest;
user utest;
tag ttest;
ctrl_stats.monitorate_trie(movies_trie);
ctrl_stats.monitorate_movies_hash(movies_hash);
ctrl_stats.monitorate_users_hash(users_hash);
// fase de construcao das estruturas
cout << "Fase de construcao das estruturas:" << endl << endl;;
ctrl_stats.start_timer();
//movies_trie = construct_trietree_from(MOVIES);
cout << "Lendo arquivo de filmes. " << "Criando arvore trie." << endl;
ctrl_stats.print_time_stats();
ctrl_stats.print_size_stats_of("movies_trie");
//movies_hash = construct_hashtable_from(MOVIES);
cout << "\nLendo arquivo de filmes. " << "Criando hashtable." << endl;
ctrl_stats.print_time_stats();
ctrl_stats.print_size_stats_of("movies_hash");
//users_hash = construct_hashtable_from(RATINGS);
cout << "\nLendo arquivo de ratings. " << "Criando hashtable." << endl;
ctrl_stats.print_time_stats();
ctrl_stats.print_size_stats_of("users_hash");
cout << "\nLendo arquivo de tags. " << "Criando arvore trie." << endl;
ctrl_stats.print_time_stats();
ctrl_stats.print_total_time_stats();
// trecho de debug
cout << endl;
db.read_csv(RATINGS, false);
ctrl_stats.print_status_message(READING_RATINGS);
ctrl_stats.print_time_stats();
db.read_csv_movie(MOVIES, false);
ctrl_stats.print_status_message(READING_MOVIES);
ctrl_stats.print_time_stats();
db.read_csv(TAGS, false);
ctrl_stats.print_status_message(READING_TAGS);
ctrl_stats.print_time_stats();
ctrl_stats.print_total_time_stats();
cout << "Memoria usada: " << db.get_memory_used(KILO) << " KB" << endl;
/*
rtest.timestamp.year = 1997;
rtest.timestamp.month = 05;
rtest.timestamp.day = 02;
rtest.timestamp.hour = 11;
rtest.timestamp.minutes = 35;
rtest.timestamp.seconds = 59;
*/
cout << endl;
print_movie_header();
mtest = extract_movie_from("12,\"One(1997)\",\"Adventure|Children|Fantasy|Porn\"");
mtest.rating_sum = 5332.114;
mtest.rating_count = 1234;
print_movie(mtest);
cout << endl << endl;
dtest = extract_date_from("1999-12-25 12:32:59");
print_date(dtest);
cout << endl << endl;
//rtest = extract_rating_from("48644,7067,4.5,2004-01-26 03:58:10");
//print_rating(rtest);
cout << endl << endl;
//ttest = extract_tag_from("18,4141,\"Mark Waters\",2009-04-24 18:19:40");
//print_tag(ttest);
cout << endl << endl;
// fase de pesquisa
cout << "Fase de pesquisa: " << endl;
while (!end_app)
{
//queries
}
return 0;
}