-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
43 lines (41 loc) · 932 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
34
35
36
37
38
39
40
41
42
43
#include <main.h>
#include <optionsparser.h>
#include <speciesdemo.h>
int main(int argc, char **argv)
{
Data::File::metas_t metas;
metas.filename = FIXT_CSV_FILE_SPECIES;
metas.skip = 1;
metas.delimiter = COMA;
cmd_options_t cmdopts;
ui_t rcopt;
try
{
auto *op = new OptionsParser(argc, argv);
rcopt = op->parse(cmdopts);
delete op;
}
catch (const bpo::error &ex)
{
std::cerr << ex.what() << std::endl;
return EXIT_FAILURE;
}
if (rcopt == EXIT_FAILURE)
return 1;
if (argc >= 2)
{
const std::string &filename(*(argv + 1));
metas.filename = filename;
}
try
{
auto *demo = new SpeciesDemo<double>(metas, cmdopts);
demo->run();
delete demo;
}
catch (const std::invalid_argument &e)
{
std::cout << "Error " << e.what() << std::endl;
}
return 0;
}