Files
WFR-UnitTests/iwir/coderepo/if1/wfInput.code
T
2017-04-11 15:49:55 +02:00

47 lines
1.6 KiB
Plaintext
Executable File

bool isHelp = false;
bool if1Cond = true;
bool if2Cond = true;
bool if3Cond = true;
bool if4Cond = true;
boost::program_options::options_description opts("if1 Options");
opts.add_options()
("help", "Print help message.")
("if1", boost::program_options::value<bool>(), "if1 condition")
("if2", boost::program_options::value<bool>(), "if2 condition")
("if3", boost::program_options::value<bool>(), "if3 condition")
("if4", boost::program_options::value<bool>(), "if4 condition");
boost::program_options::variables_map vm;
auto parsed = boost::program_options::command_line_parser(argc, argv).options(opts).allow_unregistered().run();
boost::program_options::store(parsed, vm);
boost::program_options::notify(vm);
if (vm.count("help")) {
std::cerr << opts << std::endl;
isHelp = true;
} else {
if (vm.count("if1")) {
if1Cond = vm["if1"].as<bool>();
}
if (vm.count("if2")) {
if2Cond = vm["if2"].as<bool>();
}
if (vm.count("if3")) {
if3Cond = vm["if3"].as<bool>();
}
if (vm.count("if4")) {
if4Cond = vm["if4"].as<bool>();
}
std::cerr << "if1 = " << if1Cond << std::endl;
std::cerr << "if2 = " << if2Cond << std::endl;
std::cerr << "if3 = " << if3Cond << std::endl;
std::cerr << "if4 = " << if4Cond << std::endl;
}
wfInput.if1cond.setValue(if1Cond);
wfInput.if2cond.setValue(if2Cond);
wfInput.if3cond.setValue(if3Cond);
wfInput.if4cond.setValue(if4Cond);
wfInput.if1Value.setValue(-1);
wfInput.if2Value.setValue(-1);
wfInput.if3Value.setValue(-1);
wfInput.if4Value.setValue(-1);