24int main(
int argc,
char** argv)
26 bpo::variables_map vm;
27 bpo::options_description opt_general(
"Usage:\n " + std::string(argv[0]) +
29 " Tool will decode the GBTx data for SAMPA 0\n"
30 "Commands / Options");
31 bpo::options_description opt_hidden(
"");
32 bpo::options_description opt_all;
33 bpo::positional_options_description opt_pos;
36 auto add_option = opt_general.add_options();
37 add_option(
"help,h",
"Print this help message");
38 add_option(
"verbose,v", bpo::value<uint32_t>()->default_value(0),
"Select verbosity level [0 = no output]");
39 add_option(
"version",
"Print version information");
40 add_option(
"input-file,i", bpo::value<std::string>()->required(),
"Specifies input file.");
41 add_option(
"output-file,o", bpo::value<std::string>(),
"Specify output file prefix (defaults to (dirname+basename) of input-file)");
42 add_option(
"timebins,t", bpo::value<uint32_t>()->default_value(0),
"Number of timebins to decode [0 = complete file]");
43 add_option(
"debug,d", bpo::value<uint32_t>()->default_value(0),
"Select debug output level [0 = no debug output]");
44 add_option(
"stream,s", bpo::value<uint32_t>()->default_value(0),
"Stream to decode [default = 0]");
45 add_option(
"link,l", bpo::value<uint32_t>()->default_value(0),
"GBT link to decode [default = 0]");
46 add_option(
"json",
"Output results as json (if applicable)");
48 opt_all.add(opt_general).add(opt_hidden);
49 bpo::store(bpo::command_line_parser(argc, argv).options(opt_all).positional(opt_pos).run(), vm);
51 if (vm.count(
"help") || argc == 1) {
52 std::cout << opt_general << std::endl;
56 if (vm.count(
"version")) {
62 }
catch (bpo::error& e) {
63 std::cerr <<
"ERROR: " << e.what() << std::endl
65 std::cerr << opt_general << std::endl;
67 }
catch (std::exception& e) {
68 std::cerr << e.what() <<
", application will now exit" << std::endl;
73 vm[
"input-file"].as<std::string>(),
74 vm[
"timebins"].as<uint32_t>(),
75 vm[
"link"].as<uint32_t>(),
76 vm[
"stream"].as<uint32_t>(),
77 vm[
"debug"].as<uint32_t>(),
78 vm[
"verbose"].as<uint32_t>(),
79 vm.count(
"output-file") ? vm[
"output-file"].as<std::string>() :
"");
static void processFile(const std::string_view inputFile, uint32_t timeBins=0, uint32_t linkMask=0, uint32_t stream=0, uint32_t debugLevel=0, uint32_t verbosity=0, const std::string_view outputFilePrefix="")