本文整理汇总了C++中Options::addUsage方法的典型用法代码示例。如果您正苦于以下问题:C++ Options::addUsage方法的具体用法?C++ Options::addUsage怎么用?C++ Options::addUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::addUsage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: commandline_opts
bool commandline_opts (int argc, char** argv) {
#ifdef HAVE_MPI
//Grid& gd = Grid::Instance();
//if (gd.rk == 0) {
#endif
cout << endl << "codeare " << VERSION ;
#ifdef GIT_SHA1
cout << " [" << GIT_SHA1 << "]";
#endif
cout << endl;
#ifdef HAVE_MPI
// }
#endif
std::stringstream intrinsics;
#ifdef __MMX__
intrinsics << "MMX ";
#endif
#ifdef __SSE__
intrinsics << "SSE ";
#endif
#ifdef __SSE2__
intrinsics << "SSE2 ";
#endif
#ifdef __SSSE3__
intrinsics << "SSSE3 ";
#endif
#ifdef __AVX__
intrinsics << "AVX ";
#endif
#ifdef __AVX2__
intrinsics << "AVX2 ";
#endif
#ifdef __FMA__
intrinsics << "FMA ";
#endif
#ifdef __FMA4__
intrinsics << "FMA4 ";
#endif
Options opt;
opt.addUsage ("Copyright (C) 2010-2014");
opt.addUsage ("Kaveh Vahedipour<[email protected]>");
opt.addUsage ("NYU School of Medicine");
opt.addUsage (intrinsics.str().c_str());
opt.addUsage ("Usage:");
opt.addUsage ("codeare -c <configuration_file> -b <base_dir> [OPTIONS]");
opt.addUsage ("");
opt.addUsage (" -n, --name Remote service name (optional)");
opt.addUsage (" -d, --debug Debug level 0-40 (default: 0)");
opt.addUsage (" -b, --base Base directory of files");
opt.addUsage (" (default: current directory, i.e. '.'");
opt.addUsage (" -c, --config Configuration XML file name (default: codeare.xml");
opt.addUsage (" -i, --infile Binary data input file name");
opt.addUsage (" (optional: May be assigned in configuration)");
opt.addUsage (" -o, --outfile Binary data output file name");
opt.addUsage (" (optional: May be assigned in configuration)");
opt.addUsage ("");
opt.addUsage (" -h, --help Print this help screen");
opt.addUsage ("");
opt.setFlag ("help" , 'h');
opt.setOption ("name" , 'n');
opt.setOption ("debug" , 'd');
opt.setOption ("config", 'c');
opt.setOption ("base" , 'b');
opt.setOption ("infile", 'i');
opt.processCommandArgs(argc, argv);
// Help screen
if (/* !(opt.hasOptions()) ||*/ opt.getFlag("help")) {
opt.printUsage();
return false;
}
// Debug level
char* tmp = opt.getValue("debug");
debug = (tmp && atoi(tmp) >= 0 && atoi(tmp) <= 40) ? tmp : ZERO;
// Remote service's CORBA name default "" if specified, remote access is assumed
tmp = opt.getValue("name");
name = (tmp && strcmp(tmp,EMPTY)) ? tmp : 0;
// Base directory for data
tmp = opt.getValue("base");
base_dir = (tmp && strcmp(tmp,EMPTY)) ? tmp : CURRENT;
// Configuration file, default: config.xml
tmp = opt.getValue("config");
config = (tmp && strcmp(tmp,EMPTY)) ? tmp : (char*) "config.xml";
// Input file specified in command line
infile = opt.getValue("infile");
config_file_uri = base_dir;
config_file_uri += "/";
//.........这里部分代码省略.........
示例2: init
bool init (int argc, char** argv) {
#ifdef HAVE_MPI
//Grid& gd = Grid::Instance();
#endif
// if (gd.rk == 0) {
cout << endl;
#ifdef REMOTE
cout << "codeare remote client " << VERSION << endl;
#else
cout << "codeare local client " << VERSION << endl;
#endif
#ifdef GIT_COMMIT
cout << "Commit " << GIT_COMMIT << " [" << GIT_COMMIT_DATE << "]" << endl;
#endif
// }
Options *opt = new Options();
opt->addUsage ("Copyright (C) 2010-2012");
opt->addUsage ("Kaveh Vahedipour<[email protected]>");
opt->addUsage ("Juelich Research Centre");
opt->addUsage ("Medical Imaging Physics");
opt->addUsage ("");
opt->addUsage ("Usage:");
#ifdef REMOTE
opt->addUsage ("rclient -n <servicename> -t <test> [OPTIONS]");
#else
opt->addUsage ("lclient -t <test> [OPTIONS]");
#endif
opt->addUsage ("");
#ifdef REMOTE
opt->addUsage (" -n, --name Remote service name (for example: ReconService)");
#endif
opt->addUsage (" -t, --test Test case (default: DummyRecon. Just connectivity test)");
opt->addUsage (" -v, --verbose Debug level 0-40 (default: 0)");
opt->addUsage (" -b, --base Base directory of approved files.");
opt->addUsage (" -c, --config Configuration XML (NuFFT, CGSENSE).");
opt->addUsage (" -d, --data Incoming binary data in HDF5 format.");
opt->addUsage (" -p, --pulses Pulses (Only excitation).");
opt->addUsage ("");
opt->addUsage (" -h, --help Print this help screen");
opt->addUsage ("");
opt->setFlag ("help" ,'h');
opt->setFlag ("pulses" ,'p');
#ifdef REMOTE
opt->setOption ("name" , 'n');
#endif
opt->setOption ("test" , 't');
opt->setOption ("verbose", 'v');
opt->setOption ("config" , 'c');
opt->setOption ("data" , 'd');
opt->setOption ("base" , 'b');
opt->processCommandArgs(argc, argv);
if ( !(opt->hasOptions()) || opt->getFlag("help")) {
opt->printUsage();
delete opt;
return false;
}
verbose = (opt->getValue("verbose" ) &&
atoi(opt->getValue("verbose")) >= 0 &&
atoi(opt->getValue("verbose")) <= 40) ? opt->getValue("verbose") : (char*) "0";
name = (opt->getValue("name") &&
opt->getValue("name") != (char*)"") ? opt->getValue( "name") : (char*) "codeare" ;
base = (opt->getValue("base") &&
opt->getValue("base") != (char*)"") ? opt->getValue( "base") : (char*) "";
data = (opt->getValue("data") &&
opt->getValue("data") != (char*)"") ? opt->getValue( "data") : (char*) "";
config = (opt->getValue("config") &&
opt->getValue("config") != (char*)"") ? opt->getValue( "config") : (char*) "";
test = (opt->getValue("test" ) &&
opt->getValue("test" ) != (char*)"") ? opt->getValue( "test") : (char*) "DummyRecon";
delete opt;
return true;
}