-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMetroNetMain.cpp
31 lines (30 loc) · 945 Bytes
/
MetroNetMain.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
#include "MetroNet.h"
#include "MetroNetImporter.h"
#include <iostream>
#include <fstream>
int main(int argc, char *argv[]) {
if (argc != 3 && argc != 4) {
std::cerr << "use: metronet.xml passengers.xml (-l)\n";
return -1;
}
else if (argc == 4 && argv[3] == std::string("-l")){
MetroNet net;
MetroNetImporter::importMetroNet(argv[1], std::cerr, net);
MetroNetImporter::importPassengers(argv[2], std::cerr, net);
net.runSimulation(std::cout, true);
}
else
{
std::ofstream operationLog, errorLog;
MetroNet net;
errorLog.open("_output/MetroNetErrorLog.txt");
MetroNetImporter::importMetroNet(argv[1], errorLog, net);
MetroNetImporter::importPassengers(argv[2], errorLog, net);
operationLog.open("_output/MetroNetOperationLog.txt");
net.runSimulation(operationLog);
errorLog.close();
operationLog.close();
net.writeToASCII();
}
return 0;
}