/** * @file RadxAppParms.cc */ #include #include #include #include using std::vector; using std::string; using std::pair; //------------------------------------------------------------------ RadxAppParms::RadxAppParms() : RadxAppParams(), _inputs(), _isFileList(false), _outputAllFields(false), _ok(false) { } //------------------------------------------------------------------ RadxAppParms::RadxAppParms(const std::string &fileName, bool expandEnv) : RadxAppParams(), _inputs(), _isFileList(false), _outputAllFields(false), _ok(true) { TDRP_warn_if_extra_params(FALSE); char **x = NULL; int envs; if (expandEnv) { envs = 1; } else { envs = 0; } if (RadxAppParams::load(fileName.c_str(), x, envs, false) == 1) { LOG(ERROR) << "Loading RadxApp params from " << fileName; _ok = false; } TDRP_warn_if_extra_params(TRUE); _inputs = RadxAppConfig(*this); if (_inputs._primaryGroup.isClimo) { LOG(ERROR) << "The primary path cannot be climo data"; exit(-1); } _outputAllFields = output_all_fields; for (int i=0; i &fileList, bool expandEnv) : RadxAppParams(), _inputs(), _isFileList(true), _fileList(fileList), _ok(true) { TDRP_warn_if_extra_params(FALSE); char **x = NULL; int envs; if (expandEnv) { envs = 1; } else { envs = 0; } if (RadxAppParams::load(fileName.c_str(), x, envs, false) == 1) { LOG(ERROR) << "Loading RadxApp params from " << fileName; _ok = false; } TDRP_warn_if_extra_params(TRUE); _inputs = RadxAppConfig(*this); if (_inputs._primaryGroup.isClimo) { LOG(ERROR) << "The primary path cannot be climo data"; exit(-1); } _outputAllFields = output_all_fields; for (int i=0; i= argc-1) { LOG(ERROR) << "Need a mode param with --print_params option"; return false; } string mode = argv[i+1]; if (mode == "short") { printMode = PRINT_SHORT; expandEnv = 0; } else if (mode == "norm") { printMode = PRINT_NORM; expandEnv = 0; } else if (mode == "long") { printMode = PRINT_LONG; expandEnv = 0; } else if (mode == "verbose") { printMode = PRINT_VERBOSE; expandEnv = 0; } else if (mode == "shortexpandEnv") { printMode = PRINT_SHORT; expandEnv = 1; } else if (mode == "normexpandEnv") { printMode = PRINT_NORM; expandEnv = 1; } else if (mode == "longexpandEnv") { printMode = PRINT_LONG; expandEnv = 1; } else if (mode == "verboseexpandEnv") { printMode = PRINT_VERBOSE; expandEnv = 1; } else { LOG(ERROR) << "Unknown print mode " << mode; printMode = NO_PRINT; expandEnv = 0; } return true; } } return false; } //------------------------------------------------------------------ void RadxAppParms::printParams(tdrp_print_mode_t mode) { RadxAppParams::print(stdout, mode); } //------------------------------------------------------------------ void RadxAppParms::printHelp(void) { std::cout << "RadxAppParms options:\n" << " [-print_operators] Print out all binary and unary operators\n" << " [-interval yyyymmddhhmmss yyyymmddhhmmss] Archive mode\n"; RadxAppParams::usage(std::cout); } //------------------------------------------------------------------ bool RadxAppParms::isSetParams(int argc, char **argv, std::string &fileName) { for (int i=0; i &files) { files.clear(); for (int i=0; i