#include <CommandLineParser.h>
Public Types | |
enum | { kEventContOpt = 1 << 0 } |
Public Types inherited from optutl::VariableMapCont | |
typedef std::vector< double > | DVec |
typedef DVec::const_iterator | DVecConstIter |
typedef DVec::iterator | DVecIter |
typedef std::vector< int > | IVec |
typedef IVec::const_iterator | IVecConstIter |
typedef IVec::iterator | IVecIter |
enum | OptionType { kNone = 0, kInteger, kDouble, kString, kBool, kIntegerVector, kDoubleVector, kStringVector, kNumOptionTypes } |
typedef std::map< std::string, bool > | SBMap |
typedef SBMap::const_iterator | SBMapConstIter |
typedef SBMap::iterator | SBMapIter |
typedef std::map< std::string, double > | SDMap |
typedef SDMap::const_iterator | SDMapConstIter |
typedef SDMap::iterator | SDMapIter |
typedef std::map< std::string, DVec > | SDVecMap |
typedef SDVecMap::const_iterator | SDVecMapConstIter |
typedef SDVecMap::iterator | SDVecMapIter |
typedef std::map< std::string, int > | SIMap |
typedef SIMap::const_iterator | SIMapConstIter |
typedef SIMap::iterator | SIMapIter |
typedef std::map< std::string, IVec > | SIVecMap |
typedef SIVecMap::const_iterator | SIVecMapConstIter |
typedef SIVecMap::iterator | SIVecMapIter |
typedef std::map< std::string, std::string > | SSMap |
typedef SSMap::const_iterator | SSMapConstIter |
typedef SSMap::iterator | SSMapIter |
typedef std::map< std::string, SVec > | SSVecMap |
typedef SSVecMap::const_iterator | SSVecMapConstIter |
typedef SSVecMap::iterator | SSVecMapIter |
typedef std::vector< std::string > | SVec |
typedef SVec::const_iterator | SVecConstIter |
typedef SVec::iterator | SVecIter |
Public Member Functions | |
void | _finishDefaultOptions (std::string tag="") |
const SVec | argVec () const |
CommandLineParser (const std::string &usage, unsigned int optionsType=kEventContOpt) | |
void | help () |
void | parseArguments (int argc, char **argv, bool allowArgs=false) |
void | printOptionValues () |
void | setPrintOptoins (bool print) |
Public Member Functions inherited from optutl::VariableMapCont | |
void | _checkKey (std::string &key, const std::string &description="") |
void | addOption (std::string key, OptionType type, const std::string &description="") |
void | addOption (std::string key, OptionType type, const std::string &description, int defaultValue) |
void | addOption (std::string key, OptionType type, const std::string &description, double defaultValue) |
void | addOption (std::string key, OptionType type, const std::string &description, const std::string &defaultValue) |
void | addOption (std::string key, OptionType type, const std::string &description, const char *defaultValue) |
void | addOption (std::string key, OptionType type, const std::string &description, bool defaultValue) |
void | addVariable (std::string key, OptionType type) |
void | addVariable (std::string key, OptionType type, int defaultValue) |
void | addVariable (std::string key, OptionType type, double defaultValue) |
void | addVariable (std::string key, OptionType type, const std::string &defaultValue) |
void | addVariable (std::string key, OptionType type, const char *defaultValue) |
void | addVariable (std::string key, OptionType type, bool defaultValue) |
bool & | boolValue (std::string key) |
double & | doubleValue (std::string key) |
DVec & | doubleVector (std::string key) |
OptionType | hasOption (std::string key) |
OptionType | hasVariable (std::string key) |
void | help () |
int & | integerValue (std::string key) |
IVec & | integerVector (std::string key) |
std::string & | stringValue (std::string key) |
SVec & | stringVector (std::string key) |
VariableMapCont () | |
Static Public Member Functions | |
static void | findCommand (const std::string &line, std::string &command, std::string &rest) |
static void | removeComment (std::string &line) |
static std::string | removeEnding (const std::string &input, const std::string &ending) |
static void | removeLeadingAndTrailingSpaces (std::string &line) |
static void | split (SVec &retval, std::string line, std::string match=" \, bool ignoreComments=true) |
Static Public Member Functions inherited from optutl::VariableMapCont | |
static void | lowercaseString (std::string &arg) |
static char | toLower (char &ch) |
Static Public Attributes | |
static const std::string | kSpaces = " \t" |
Static Public Attributes inherited from optutl::VariableMapCont | |
static const bool | kDefaultBool = false |
static const double | kDefaultDouble = 0. |
static const int | kDefaultInteger = 0 |
static const std::string | kDefaultString = "" |
static const DVec | kEmptyDVec |
static const IVec | kEmptyIVec |
static const SVec | kEmptySVec |
Private Member Functions | |
void | _getSectionFiles (const SVec &inputList, SVec &outputList, int section, int totalSection) |
bool | _runVariableCommandFromString (const std::string &arg) |
bool | _setVariableFromString (const std::string &arg, bool dontOverrideChange=false, int offset=0) |
bool | _setVariablesFromFile (const std::string &filename) |
Private Attributes | |
std::string | m_argv0 |
SVec | m_fullArgVec |
unsigned int | m_optionsType |
bool | m_printOptions |
std::string | m_usageString |
Friends | |
std::ostream & | operator<< (std::ostream &o_stream, const CommandLineParser &rhs) |
Additional Inherited Members | |
Protected Member Functions inherited from optutl::VariableMapCont | |
bool | _valueHasBeenModified (const std::string &key) |
Protected Attributes inherited from optutl::VariableMapCont | |
SBMap | m_boolMap |
SDMap | m_doubleMap |
SDVecMap | m_doubleVecMap |
SIMap | m_integerMap |
SIVecMap | m_integerVecMap |
SSMap | m_stringMap |
SSVecMap | m_stringVecMap |
SSMap | m_variableDescriptionMap |
SBMap | m_variableModifiedMap |
Definition at line 10 of file CommandLineParser.h.
anonymous enum |
CommandLineParser::CommandLineParser | ( | const std::string & | usage, |
unsigned int | optionsType = kEventContOpt |
||
) |
Definition at line 19 of file CommandLineParser.cc.
References optutl::VariableMapCont::addOption(), cms::cuda::assert(), DMR_cfg::cerr, optutl::VariableMapCont::kBool, kEventContOpt, optutl::VariableMapCont::kInteger, optutl::VariableMapCont::kString, optutl::VariableMapCont::kStringVector, and m_optionsType.
void CommandLineParser::_finishDefaultOptions | ( | std::string | tag = "" | ) |
Definition at line 583 of file CommandLineParser.cc.
References _getSectionFiles(), optutl::VariableMapCont::boolValue(), gather_cfg::cout, beamvalidation::exit(), corrVsCorr::filename, optutl::VariableMapCont::integerValue(), kEventContOpt, m_optionsType, m_printOptions, download_sqlite_cfg::outputFile, printOptionValues(), removeEnding(), optutl::VariableMapCont::stringValue(), optutl::VariableMapCont::stringVector(), and makeGlobalPositionRcd_cfg::tag.
Referenced by fwlite::EventContainer::EventContainer().
|
private |
Definition at line 545 of file CommandLineParser.cc.
References cms::cuda::assert(), crabTemplate::inputList, createfilelist::int, heppy_loop::loop, EgammaValidation_cff::num, submitPVResolutionJobs::outputList, and hgcalPlots::section.
Referenced by _finishDefaultOptions().
|
private |
Definition at line 461 of file CommandLineParser.cc.
References cms::cuda::assert(), DMR_cfg::cerr, mps_check::command, optutl::VariableMapCont::doubleVector(), corrVsCorr::filename, optutl::VariableMapCont::hasOption(), recoMuon::in, optutl::VariableMapCont::integerVector(), optutl::VariableMapCont::kDoubleVector, submitPVResolutionJobs::key, optutl::VariableMapCont::kIntegerVector, kSpaces, optutl::VariableMapCont::kStringVector, mps_splice::line, optutl::VariableMapCont::lowercaseString(), source, split(), and optutl::VariableMapCont::stringVector().
Referenced by parseArguments().
|
private |
Definition at line 313 of file CommandLineParser.cc.
References optutl::VariableMapCont::_valueHasBeenModified(), cms::cuda::assert(), DMR_cfg::cerr, createfilelist::int, optutl::VariableMapCont::lowercaseString(), optutl::VariableMapCont::m_boolMap, optutl::VariableMapCont::m_doubleMap, optutl::VariableMapCont::m_doubleVecMap, optutl::VariableMapCont::m_integerMap, optutl::VariableMapCont::m_integerVecMap, optutl::VariableMapCont::m_stringMap, optutl::VariableMapCont::m_stringVecMap, optutl::VariableMapCont::m_variableModifiedMap, HLT_IsoTrack_cff::offset, split(), and relativeConstraints::value.
Referenced by _setVariablesFromFile(), and parseArguments().
|
private |
Definition at line 413 of file CommandLineParser.cc.
References _setVariableFromString(), DMR_cfg::cerr, beamvalidation::exit(), corrVsCorr::filename, dqmdumpme::first, recoMuon::in, createfilelist::int, kSpaces, mps_splice::line, position, and source.
|
inline |
Definition at line 46 of file CommandLineParser.h.
References m_fullArgVec.
Referenced by fwlite::EventContainer::~EventContainer().
|
static |
Definition at line 184 of file CommandLineParser.cc.
References mps_check::command, kSpaces, mps_splice::line, removeLeadingAndTrailingSpaces(), and mergeAndRegister::rest.
void CommandLineParser::help | ( | ) |
Definition at line 104 of file CommandLineParser.cc.
References gather_cfg::cout, beamvalidation::exit(), m_argv0, m_usageString, and printOptionValues().
Referenced by parseArguments().
void CommandLineParser::parseArguments | ( | int | argc, |
char ** | argv, | ||
bool | allowArgs = false |
||
) |
Definition at line 45 of file CommandLineParser.cc.
References _runVariableCommandFromString(), _setVariableFromString(), dir2webdir::argc, GCPpyPlots::argv, DMR_cfg::cerr, beamvalidation::exit(), dqmdumpme::first, help(), heppy_loop::loop, optutl::VariableMapCont::lowercaseString(), m_argv0, m_fullArgVec, and m_printOptions.
void CommandLineParser::printOptionValues | ( | ) |
Definition at line 202 of file CommandLineParser.cc.
References gather_cfg::cout, makeListRunsInFiles::description, optutl::VariableMapCont::m_boolMap, optutl::VariableMapCont::m_doubleMap, optutl::VariableMapCont::m_doubleVecMap, optutl::VariableMapCont::m_integerMap, optutl::VariableMapCont::m_integerVecMap, optutl::VariableMapCont::m_stringMap, optutl::VariableMapCont::m_stringVecMap, and optutl::VariableMapCont::m_variableDescriptionMap.
Referenced by _finishDefaultOptions(), and help().
|
static |
Definition at line 149 of file CommandLineParser.cc.
References mps_splice::line, and relval_nano::location.
Referenced by split().
|
static |
Definition at line 174 of file CommandLineParser.cc.
References input, and position.
Referenced by _finishDefaultOptions().
|
static |
Definition at line 157 of file CommandLineParser.cc.
References kSpaces, and mps_splice::line.
Referenced by findCommand().
|
inline |
Definition at line 43 of file CommandLineParser.h.
References m_printOptions, and print().
|
static |
Definition at line 115 of file CommandLineParser.cc.
References kSpaces, dqmdumpme::last, mps_splice::line, and removeComment().
Referenced by _runVariableCommandFromString(), and _setVariableFromString().
|
friend |
|
static |
Definition at line 16 of file CommandLineParser.h.
Referenced by _runVariableCommandFromString(), _setVariablesFromFile(), findCommand(), removeLeadingAndTrailingSpaces(), and split().
|
private |
Definition at line 115 of file CommandLineParser.h.
Referenced by help(), and parseArguments().
|
private |
Definition at line 114 of file CommandLineParser.h.
Referenced by argVec(), and parseArguments().
|
private |
Definition at line 118 of file CommandLineParser.h.
Referenced by _finishDefaultOptions(), and CommandLineParser().
|
private |
Definition at line 117 of file CommandLineParser.h.
Referenced by _finishDefaultOptions(), parseArguments(), and setPrintOptoins().
|
private |
Definition at line 116 of file CommandLineParser.h.
Referenced by help().