-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
49 lines (42 loc) · 1.64 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
// #######################################################################################
// ## ##
// ## This main.cpp file WILL BE REPLACED during the marking procedure. ##
// ## Therefore all of your implementation code MUST be in the Navigation class, ##
// ## or any other new classes that you create and use inside of the Navigation class. ##
// ## ##
// #######################################################################################
#include "Navigation.h"
#include <iostream>
#include <iomanip>
#include "ACW_Wrapper.h"
static void executeACW() {
ACW_Wrapper wrapper("log.txt");
// Build Navigation
wrapper.startTimer();
Navigation nav;
if (nav.BuildNetwork("Places.csv", "Links.csv")) {
const auto elapsed = wrapper.stopTimer();
std::cout << std::fixed << std::setprecision(1) << "BuildNetwork - " << elapsed << " microseconds" << std::endl;
}
else {
std::cout << "\n*** Error *** BuildNetwork" << std::endl;
}
// Process commands
std::ifstream fin("commands.txt");
while (!fin.eof()) {
std::string command;
std::getline(fin, command);
wrapper.startTimer();
if (nav.ProcessCommand(command)) {
const auto elapsed = wrapper.stopTimer();
std::cout << command << std::fixed << std::setprecision(1) << " - " << elapsed << " microseconds" << std::endl;
}
else {
std::cout << "\n*** Error *** " << command << std::endl;
}
}
}
int main(int, char**) {
executeACW();
system("PAUSE");
}