35 #ifndef _uhal_tests_DummyHardwareOptions_hpp_
36 #define _uhal_tests_DummyHardwareOptions_hpp_
39 #include <boost/program_options.hpp>
79 boost::program_options::options_description desc (
"Allowed options" );
81 (
"help,h",
"Produce this help message" )
82 (
"delay,d", boost::program_options::value<uint32_t>()->default_value ( 0 ) ,
"Reply delay for first packet (in seconds) - optional" )
83 (
"port,p", boost::program_options::value<uint16_t>() ,
"Port number to listen on - required" )
84 (
"big-endian,b",
"Include the big-endian hack (version 2 only)" )
85 (
"version,v", boost::program_options::value<uint32_t>() ,
"IPbus Major version (1 or 2) - required" )
86 (
"verbose,V",
"Produce verbose output" )
88 boost::program_options::variables_map vm;
92 boost::program_options::store ( boost::program_options::parse_command_line ( argc, argv, desc ), vm );
93 boost::program_options::notify ( vm );
95 if ( vm.count (
"help" ) )
97 std::cout <<
"Usage: " << argv[0] <<
" [OPTIONS]" << std::endl;
98 std::cout << desc << std::endl;
103 lResult.
delay = vm[
"delay"].as<uint32_t>();
104 lResult.
port = vm[
"port"].as<uint16_t>();
105 lResult.
version = vm[
"version"].as<uint32_t>();
106 lResult.
bigendian = bool ( vm.count (
"big-endian" ) );
110 log (
Error ,
"-big-endian flag does nothing with version set to 1" );
113 if ( vm.count (
"verbose" ) )
124 catch ( std::exception& e )
126 std::cerr <<
"ERROR: " << e.what() << std::endl << std::endl;
127 std::cout <<
"Usage: " << argv[0] <<
" [OPTIONS]" << std::endl;
128 std::cout << desc << std::endl;