-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
41 lines (32 loc) · 1.14 KB
/
main.cpp
File metadata and controls
41 lines (32 loc) · 1.14 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
//
// Created by luise on 4/29/2020.
//
#include <iostream>
#include "FileReader.h"
#include "NetworkFile.h"
#include "Algorithm.h"
#include "MissingFilesException.h"
using namespace std;
int main(int argc,char * argv[]){
try {
// if argument counter != 2,throw custom exception
if (argc != 1)
throw MissingFilesException{};
else{
// FileReader will store the names of all files and create a set of 3 output files per input file
auto * newFiles = new FileReader();
// Iterate through input files & create a NetworkFile object that holds corresponding output files
for(auto i = newFiles->getInputFiles().begin(), j = newFiles->getOutputFiles().begin(); i != newFiles->getInputFiles().end(); ++i){
Algorithm<string> * analyze = new NetworkFile<string>(*i, *j++, *j++, *j++);
analyze->compute();
delete analyze;
}
delete newFiles;
}
}
// catches custom exception message
catch (MissingFilesException& e) {
cout << MissingFilesException::what() << endl;
}
return 0;
}