-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
66 lines (55 loc) · 1.91 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
#include <iostream>
#include <string>
#include <time.h>
#include <chrono>
#include <boost/program_options.hpp>
#include "AppSettings.h"
#include "SignalGenerator.h"
#include "SignalFilter.h"
namespace po = boost::program_options;
using namespace std;
int main(int argc, char** argv) {
//parsing options
po::options_description desc("General options");
string settingsFilename;
desc.add_options()
("help,h","Show help")
("settings,s",po::value<string>(&settingsFilename),"Settings file name");
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if(vm.count("help") || !vm.size()) {
cout << desc << "\n";
return 1;
}
//loading settings from file
AppSettings settings;
settings.load(settingsFilename);
//generate starting data
SignalGenerator generator(&settings);
cout<<"generates start"<<endl;
auto startTime = chrono::high_resolution_clock::now();
if(settings.mode == "bin")
generator.generate_to_file_binary();
else if(settings.mode == "csv")
generator.generate_to_file_csv();
else
cout<<"unknown mode"<<endl;
auto endTime = chrono::high_resolution_clock::now();
cout<<"generates done"<<endl;
cout<<"generation time "<<chrono::duration_cast<chrono::milliseconds>(endTime - startTime).count()<<"\n";
//filter generated data
SignalFilter filter(&settings);
cout<<"filter start"<<endl;
startTime = chrono::high_resolution_clock::now();
if(settings.mode == "bin")
filter.filter_from_file_binary();
else if(settings.mode == "csv")
filter.filter_from_file_csv();
else
cout<<"unknown mode"<<endl;
endTime = chrono::high_resolution_clock::now();
cout<<"filter done"<<endl;
cout<<"filter time "<<chrono::duration_cast<chrono::milliseconds>(endTime - startTime).count()<<"\n";
return 0;
}