本文整理汇总了C++中ArgParser::showOpeValues方法的典型用法代码示例。如果您正苦于以下问题:C++ ArgParser::showOpeValues方法的具体用法?C++ ArgParser::showOpeValues怎么用?C++ ArgParser::showOpeValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArgParser
的用法示例。
在下文中一共展示了ArgParser::showOpeValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/**main
* gets the command line arguments, set parameters accordingly and triggers the data acquisition to generate CSV files.
* Input data are contained in a RINEX observation or navigation file containing header and epoch data.
* The output is a CSV (Comma Separated Values) text data file. This type of files can be used to import data to some available
* application (like MS Excel).
* A detailed definition of the RINEX format can be found in the document "RINEX: The Receiver Independent Exchange
* Format Version 2.10" from Werner Gurtner; Astronomical Institute; University of Berne. An updated document exists
* also for Version 3.01.
*
*@param argc the number of arguments passed from the command line
*@param argv the array of arguments passed from the command line
*@return the exit status according to the following values and meaning::
* - (0) no errors have been detected
* - (1) an error has been detected in arguments
* - (2) error when opening the input file
* - (3) error when reading, setting or printing header data
* - (4) error in data filtering parameters
* - (5) there were format errors in epoch data or no epoch data exist
* - (6) error when creating output file
* - (7) inconsistent data in RINEX VERSION header record
*/
int main(int argc, char* argv[]) {
int anInt; //a general purpose int variable
string aStr; //a general purpose string variable
string fileName;
double aDouble; //a general purpose double variable
/**The main process sequence follows:*/
/// 1- Defines and sets the error logger object
Logger log("LogFile.txt", string(), string(argv[0]) + MYVER + string(" START"));
/// 2- Setups the valid options in the command line. They will be used by the argument/option parser
TOT = parser.addOption("-t", "--totime=TOT", "TOT", "Select epochs before the given date and time (comma separated yyyy,mm,dd,hh,mm,sec", "");
SELSAT = parser.addOption("-s", "--selsat", "SELSAT", "Select system-satellite from input (comma separated list of sys-prn, like G01,G02)", "");
SELOBS2 = parser.addOption("-p", "--selobs2", "SELOBS2", "Select system-observable (ver.2.10 notation) from input (comma separated list, like C1,L1,L2)", "");
SELOBS3 = parser.addOption("-o", "--selobs", "SELOBS3", "Select system-observable (ver.3.01 notation) from input (comma separated list, like GC1C,GL1C)", "");
LOGLEVEL = parser.addOption("-l", "--llevel", "LOGLEVEL", "Maximum level to log (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)", "INFO");
HELP = parser.addOption("-h", "--help", "HELP", "Show usage data and stops", false);
FROMT = parser.addOption("-f", "--fromtime=FROMT", "FROMT", "Select epochs from the given date and time (comma separated yyyy,mm,dd,hh,mm,sec", "");
/// 3- Setups the default values for operators in the command line
INRINEX = parser.addOperator("RINEX.DAT");
/// 4- Parses arguments in the command line extracting options and operators
try {
parser.parseArgs(argc, argv);
} catch (string error) {
parser.usage("Argument error: " + error, CMDLINE);
log.severe(error);
return 1;
}
log.info(parser.showOptValues());
log.info(parser.showOpeValues());
if (parser.getBoolOpt(HELP)) {
//help info has been requested
parser.usage("Parses and read the given observation RINEX file generating a CSV ot TXT file with the requested characteristics", CMDLINE);
return 0;
}
/// 5- Sets logging level stated in option. Default level is INFO
log.setLevel(parser.getStrOpt(LOGLEVEL));
/// 7 - Set 1st and last epoch time tags (if selected from / to epochs time)
TimeIntervalParams timeInterval;
int week, year, month, day, hour, minute;
double tow, second;
aStr = parser.getStrOpt(FROMT);
if (!aStr.empty()) {
if (sscanf(aStr.c_str(), "%d,%d,%d,%d,%d,%lf", &year, &month, &day, &hour, &minute, &second) != 6) {
log.severe("Cannot state 'from time' for the time interval");
return 1;
}
setWeekTow (year, month, day, hour, minute, second, week, tow);
timeInterval.fromTimeTag = getSecsGPSEphe(week, tow);
timeInterval.fromTime = true;
} else timeInterval.fromTime = false;
aStr = parser.getStrOpt(TOT);
if (!aStr.empty()) {
if (sscanf(aStr.c_str(), "%d,%d,%d,%d,%d,%lf", &year, &month, &day, &hour, &minute, &second) != 6) {
log.severe("Cannot state 'to time' for the time interval");
return 1;
}
setWeekTow (year, month, day, hour, minute, second, week, tow);
timeInterval.toTimeTag = getSecsGPSEphe(week, tow);
timeInterval.toTime = true;
} else timeInterval.toTime = false;
/// 7- Opens the RINEX input file passed as operator
FILE* inFile;
fileName = parser.getOperator(INRINEX);
if ((inFile = fopen(fileName.c_str(), "r")) == NULL) {
log.severe("Cannot open file " + fileName);
return 2;
}
/// 8- Create a RINEX object and extract header data from the RINEX input file
RinexData rinex(RinexData::VTBD, &log);
char fileType = ' ';
char sysId = ' ';
try {
rinex.readRinexHeader(inFile);
if (!rinex.getHdLnData(RinexData::INFILEVER, aDouble, fileType, sysId)) {
log.severe("This RINEX input file version cannot be processed");
fclose(inFile);
return 3;
}
} catch (string error) {
log.severe(error);
//.........这里部分代码省略.........