-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
33 lines (27 loc) · 997 Bytes
/
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
#include "Expression.h"
#include "Valuator.h"
#include <boost/property_tree/ptree.hpp>
#include <filesystem>
#include <thread>
namespace pt = boost::property_tree;
namespace fs = std::filesystem;
int main(int argc, char *argv[]) {
const fs::path inputFolder(argv[1]);
const fs::path outputFolder(argv[2]);
if (!fs::exists(outputFolder)) {
fs::create_directory(outputFolder);
}
std::vector<std::thread> threads;
Valuator v;
for (auto const& dirEntry : fs::directory_iterator{inputFolder}) {
const std::string inputFileName = dirEntry.path().string();
fs::path outputFilePath(dirEntry.path().stem());
outputFilePath += "_result.xml";
fs::path output = outputFolder / outputFilePath;
const std::string outputFileName = output.string();
threads.push_back(std::thread(&Valuator::evaluate, &v, inputFileName, outputFileName));
}
for (std::thread& t: threads) {
t.join();
}
}