Setting language variable to english(otherwise , is interpreted as . in numbers)
21{
23 setenv("LC_ALL", "C", 1);
24
26
28
29 std::string configv;
30 std::string oksfn;
31 std::string rdbrl;
32 std::string roksrl;
33 QMap<QString, QString> argmap;
34
35 bop::options_description options_description("Allowed options", 128);
36
37 options_description.add_options()
38 ("help,h", "Provide help message")
39
40
41
42
43 ("file,f", bop::value<std::string>(&oksfn)->default_value(oksfn),
44 "OKS database file name")
45
46
47
48
49
50
51 ;
52
53 bop::variables_map options_map;
54
55 try {
56 bop::parsed_options parsed = bop::command_line_parser(argc, argv).options(options_description).allow_unregistered().run();
57
58
59 const auto& unknown = bop::collect_unrecognized(parsed.options, bop::include_positional);
60 if(unknown.size() != 0) {
61 std::cerr << "Incorrect command line argument, unrecognized options: ";
62 for(const auto& o : unknown) {
63 std::cerr << o << " ";
64 }
65 std::cerr << std::endl;
66
67 return EXIT_FAILURE;
68 }
69
70 bop::store(parsed, options_map);
71 bop::notify(options_map);
72
73 auto display_help_message = [&options_description]()
74 {
75 std::cout
76 << "DBE: TDAQ online configuration database editor"
77 << std::endl
78 << std::endl
79 << "Usage: dbe [options]"
80 << std::endl
81 << std::endl
82 << options_description
83 << std::endl;
84 };
85
86 if(options_map.count("help")) {
87 display_help_message();
88 return EXIT_SUCCESS;
89 }
90
91 argmap.insert("f", QString::fromStdString(oksfn));
92
93
94
95
96 }
97 catch(std::exception const & e) {
98 std::cerr << "Incorrect command line argument: " << e.what() << std::endl;
99 return EXIT_FAILURE;
100 }
101
103 try
104 {
105 window->show();
106 return myapp->exec();
107 }
108 catch (std::exception const & e)
109 {
110 std::cerr << "Exception: " << e.what() << std::endl;
111 }
112 catch (...)
113 {
114 std::cerr << "Unknown Exception" << std::endl;
115 }
116
117 return EXIT_FAILURE;
118}