本文整理汇总了C++中OptionParser::getStringVector方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionParser::getStringVector方法的具体用法?C++ OptionParser::getStringVector怎么用?C++ OptionParser::getStringVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionParser
的用法示例。
在下文中一共展示了OptionParser::getStringVector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseOptions
//.........这里部分代码省略.........
if (OP.fail()) {
opt.outputfile = defaults.outputfile;
}
if (opt.outputfile != "" && opt.outputfile != "STDOUT") {
opt.coutRedirected = true;
opt.cout_fs = new ofstream();
opt.cerr_fs = new ofstream();
} else {
opt.coutRedirected = false;
opt.cout_fs = NULL;
opt.cerr_fs = NULL;
}
/*****************************************
* CHECK THE GIVEN OPTIONS
*****************************************/
//opt.commandName = OP.getCommandName();
//if (!OP.checkOptions()) {
// opt.errorFlag = true;
// opt.disallowed = OP.getDisallowedOptions();
// opt.missing = OP.getMissingOptions();
// opt.ambiguous = OP.getAmbiguousOptions();
// return opt;
//}
opt.errorFlag = false;
opt.warningFlag = false;
opt.sequence= OP.getString("sequence");
if (OP.fail()) {
opt.errorMessages = "sequence not specified";
opt.errorFlag = true;
}
opt.startPos = OP.getStringVector("startPos");
if (OP.fail()) {
opt.errorMessages = "startPos not specified";
opt.errorFlag = true;
}
opt.startRegPos = OP.getString("startRegPos");
if (OP.fail()) {
opt.errorMessages = "startRegPos not specified";
opt.errorFlag = true;
}
opt.r0_start = OP.getDouble("r0_start");
if (OP.fail()) {
opt.errorMessages = "r0 not specified";
opt.errorFlag = true;
}
opt.r0_end = OP.getDouble("r0_end");
if (OP.fail()) {
opt.errorMessages = "r0 not specified";
opt.errorFlag = true;
}
opt.r0_step = OP.getDouble("r0_step");
if (OP.fail()) {
opt.errorMessages = "r0 not specified";
opt.errorFlag = true;
}
opt.r1_start = OP.getDouble("r1_start");
if (OP.fail()) {
opt.errorMessages = "r1 not specified";
opt.errorFlag = true;
}
opt.r1_end = OP.getDouble("r1_end");
if (OP.fail()) {
opt.errorMessages = "r1 not specified";
示例2: parseOptions
//.........这里部分代码省略.........
if (opt.configfile != "") {
OP.readFile(opt.configfile);
if (OP.fail()) {
opt.errorFlag = true;
opt.errorMessages += "Cannot read configuration file " + opt.configfile + "\n";
exit(1);
}
}
/*****************************************
* VERSION AND HELP
*
* --version or -v arguments print the version number
* --help prints the usage and help
*****************************************/
opt.version = OP.getBool("version");
//if (OP.fail()) {
// opt.version = OP.getBool("v");
//}
if (opt.version) {
version();
exit(0);
}
opt.help = OP.getBool("help");
// if (OP.fail()) {
// opt.help = OP.getBool("h");
// }
if (opt.help) {
help(defaults);
exit(0);
}
/*****************************************
* CHECK THE GIVEN OPTIONS
*****************************************/
if (!OP.checkOptions()) {
opt.errorFlag = true;
opt.OPerrors = OP.getErrors();
return opt;
}
opt.errorFlag = false;
opt.warningFlag = false;
/*****************************************
* CHECK THE GIVEN OPTIONS
*****************************************/
//opt.commandName = OP.getCommandName();
//if (!OP.checkOptions()) {
// opt.errorFlag = true;
// opt.disallowed = OP.getDisallowedOptions();
// opt.missing = OP.getMissingOptions();
// opt.ambiguous = OP.getAmbiguousOptions();
// return opt;
//}
opt.errorFlag = false;
opt.warningFlag = false;
opt.pdb = OP.getString("pdb");
if (OP.fail()) {
opt.errorMessages = "Option name of first pdb file \"pdb\" not specified";
opt.errorFlag = true;
}
opt.outputPdb = OP.getString("outputPdb");
if (OP.fail()) {
opt.warningMessages = "Option name of output edited pdb file \"outputPdb\" not specified";
opt.warningFlag = true;
string base = MslTools::pathTail(opt.pdb);
base = MslTools::pathRoot(base);
opt.outputPdb = base + (string)"-edited.pdb";
}
int index = 0;
while (true) {
DoF tmp;
tmp.type = OP.getString("type", index);
if (OP.fail()) {
break;
}
tmp.atomNames = OP.getStringVector("atomNames", index);
if (OP.fail()) {
break;
}
tmp.value = OP.getDouble("value", index);
if (OP.fail()) {
break;
}
opt.edits.push_back(tmp);
index++;
}
// return the Options structure
return opt;
}