-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCat2Map.cpp
48 lines (39 loc) · 1.1 KB
/
Cat2Map.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
#define BOOST_ALL_DYN_LINK
#include <boost/program_options.hpp>
#include "Cat2Map.hpp"
namespace po = boost::program_options;
int main(int ac, char* av[])
{
try
{
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("input-file,f", po::value< std::string >(), "input file");
po::positional_options_description p;
p.add("input-file", -1);
po::variables_map vm;
po::store(po::command_line_parser(ac, av).options(desc).positional(p).run(), vm);
po::notify(vm);
if (vm.count("help"))
{
std::cout << desc << "\n";
return 0;
}
else if (vm.count("input-file"))
{
Cat2Map c2m(vm["input-file"].as< std::string >());
c2m.accumulate();
c2m.writeMaps();
}
else
{
std::cout<<":( No arguments passed. Please type Cat2Map --help"<<std::endl;
}
}
catch(std::exception& e)
{
std::cerr << e.what() << std::endl;
}
return 0;
}