This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
67 lines (62 loc) · 2.87 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
/**
* @file main.cpp
* @brief Point of entry of the program.
*/
#include "src/CSVClasses.hpp"
#include "src/CSVClassesPerUC.hpp"
#include "src/CSVStudentsClasses.hpp"
#include "src/ClassesPerUC.hpp"
#include "src/StudentsClasses.hpp"
#include "src/Lesson.hpp"
#include "src/ClassSchedule.hpp"
#include "src/Student.hpp"
#include "src/Runtime.hpp"
#include "src/Utils.hpp"
#include <iostream>
#include <string>
int main(int argc, char** argv) {
bool done_cpu = false;
bool done_sc = false;
bool done_c = false;
if (argc != 7) {
std::cerr << "USAGE: The program takes three files, with their specific flags prepending them. Example:\n\n"
<< " schdulEd -cpu classes_per_uc.csv -c classes.csv -sc students_classes.csv\n\n"
<< "Where '-cpu' is the flag that specifies a CSV file which contains the list of classes per each UC\n"
<< "Where '-c' is the flag that specifies a CSV file which contains the list of classes an their schedules\n"
<< "Where '-sc' is the flag that specifies a CSV file which contains the list of students and their association with each class\n\n"
<< "DISCLAIMER: This program is tested for Linux only. As such, it only takes Linux-compatible CSV files on Linux. It might work on Windows, but that is untested.\n"
<< std::endl;
std::exit(1);
}
CSVClasses c;
CSVClassPerUC cpu;
CSVStudentsClasses sc;
for (int i = 1; i < argc; i+=2) {
if (std::string(argv[i]) == std::string("-cpu")) {
done_cpu = std::string(argv[i+1]) != "-c" && std::string(argv[i+1]) != "-sc";
cpu = CSVClassPerUC(argv[i+1]);
}
if (std::string(argv[i]) == std::string("-c")) {
done_c = std::string(argv[i+1]) != "-cpu" && std::string(argv[i+1]) != "-sc";
c = CSVClasses(argv[i+1]);
}
if (std::string(argv[i]) == std::string("-sc")) {
done_sc = std::string(argv[i+1]) != "-cpu" && std::string(argv[i+1]) != "-c";
sc = CSVStudentsClasses(argv[i+1]);
}
}
if (done_c && done_sc && done_cpu) {
Runtime rt(sc, cpu, c);
rt.run();
} else {
std::cerr << "USAGE: The program takes three files, with their specific flags prepending them. Example:\n\n"
<< " schdulEd -cpu classes_per_uc.csv -c classes.csv -sc students_classes.csv\n\n"
<< "Where '-cpu' is the flag that specifies a CSV file which contains the list of classes per each UC\n"
<< "Where '-c' is the flag that specifies a CSV file which contains the list of classes an their schedules\n"
<< "Where '-sc' is the flag that specifies a CSV file which contains the list of students and their association with each class\n\n"
<< "DISCLAIMER: This program is tested for Linux only. As such, it only takes Linux-compatible CSV files on Linux. It might work on Windows, but that is untested.\n"
<< std::endl;
std::exit(1);
}
return 0;
}