// Copyright 2012-2013 Jan de Cuveland #include "Parameters.hpp" #include namespace po = boost::program_options; void Parameters::parse_options(int argc, char* argv[]) { po::options_description desc("Allowed options"); desc.add_options()("version,V", "print version string")( "help,h", "produce help message")( "client-index,c", po::value(&_client_index), "index of this executable in the list of processor tasks")( "analyze-pattern,a", po::value(&_analyze)->implicit_value(true), "enable/disable pattern check")( "dump-timslices,d", po::value(&_dump)->implicit_value(true), "enable/disable timeslice dump")( "skip-timeslices,f", po::value(&_skipTSs), "number of first timeslice to be imported. default: 0")( "number-timeslices,n", po::value(&_limitTS), "number of timeslices to be imported. -1 for unlimited. default: -1")( "mc-size,m", po::value(&_MCSize), "applies only to offline unpacking as a time base. mc-size as set in flib.conf when archive was captured. default: 1250")( "shm-identifier,s", po::value(&_shm_identifier), "shared memory identifier used for receiving timeslices")( "input-archive,i", po::value(&_input_archive), "name of an input file archive to read")( "output-archive,o", po::value(&_output_archive), "name of an output file archive to write"); po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { std::cout << desc << std::endl; exit(EXIT_SUCCESS); } if (vm.count("version")) { std::cout << "tsclient, version 0.0" << std::endl; exit(EXIT_SUCCESS); } int input_sources = vm.count("shm-identifier") + vm.count("input-archive"); if (input_sources == 0) throw ParametersException("no input source specified"); if (input_sources > 1) throw ParametersException("more than one input source specified"); if (_limitTS == 0) throw ParametersException("number-timeslices, n must not be zero. use negative value to disable limit and strictly positive value to limit number of timeslices"); }