#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=" \t", 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 11 of file CommandLineParser.h.
anonymous enum |
CommandLineParser::CommandLineParser | ( | const std::string & | usage, |
unsigned int | optionsType = kEventContOpt |
||
) |
Definition at line 20 of file CommandLineParser.cc.
References optutl::VariableMapCont::addOption(), assert(), ecal_dqm_sourceclient-live_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 753 of file CommandLineParser.cc.
References _getSectionFiles(), optutl::VariableMapCont::boolValue(), gather_cfg::cout, cmsRelvalreport::exit, lut2db_cfg::filename, optutl::VariableMapCont::integerValue(), kEventContOpt, m_optionsType, m_printOptions, match(), download_sqlite_cfg::outputFile, printOptionValues(), removeEnding(), optutl::VariableMapCont::stringValue(), optutl::VariableMapCont::stringVector(), and GlobalPosition_Frontier_DevDB_cff::tag.
Referenced by fwlite::EventContainer::EventContainer().
|
private |
Definition at line 709 of file CommandLineParser.cc.
References assert(), cmsHarvester::loop, pileupDistInMC::num, and vertexPlots::section.
Referenced by _finishDefaultOptions().
|
private |
Definition at line 606 of file CommandLineParser.cc.
References assert(), ecal_dqm_sourceclient-live_cfg::cerr, mps_check::command, optutl::VariableMapCont::doubleVector(), lut2db_cfg::filename, optutl::VariableMapCont::hasOption(), recoMuon::in, optutl::VariableMapCont::integerVector(), optutl::VariableMapCont::kDoubleVector, relval_steps::key, optutl::VariableMapCont::kIntegerVector, kSpaces, optutl::VariableMapCont::kStringVector, geometryCSVtoXML::line, optutl::VariableMapCont::lowercaseString(), source, split(), and optutl::VariableMapCont::stringVector().
Referenced by parseArguments().
|
private |
Definition at line 423 of file CommandLineParser.cc.
References optutl::VariableMapCont::_valueHasBeenModified(), assert(), ecal_dqm_sourceclient-live_cfg::cerr, 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, split(), and relativeConstraints::value.
Referenced by _setVariablesFromFile(), and parseArguments().
|
private |
Definition at line 545 of file CommandLineParser.cc.
References _setVariableFromString(), ecal_dqm_sourceclient-live_cfg::cerr, cmsRelvalreport::exit, plotBeamSpotDB::first, recoMuon::in, kSpaces, geometryCSVtoXML::line, position, and source.
|
inline |
Definition at line 53 of file CommandLineParser.h.
References m_fullArgVec.
Referenced by fwlite::EventContainer::~EventContainer().
|
static |
Definition at line 246 of file CommandLineParser.cc.
References kSpaces, and removeLeadingAndTrailingSpaces().
void CommandLineParser::help | ( | ) |
Definition at line 143 of file CommandLineParser.cc.
References gather_cfg::cout, cmsRelvalreport::exit, m_argv0, m_usageString, and printOptionValues().
Referenced by main(), and parseArguments().
void CommandLineParser::parseArguments | ( | int | argc, |
char ** | argv, | ||
bool | allowArgs = false |
||
) |
Definition at line 71 of file CommandLineParser.cc.
References _runVariableCommandFromString(), _setVariableFromString(), dir2webdir::argc, ecal_dqm_sourceclient-live_cfg::cerr, cmsRelvalreport::exit, plotBeamSpotDB::first, help(), cmsHarvester::loop, optutl::VariableMapCont::lowercaseString(), m_argv0, m_fullArgVec, and m_printOptions.
Referenced by main().
void CommandLineParser::printOptionValues | ( | ) |
Definition at line 271 of file CommandLineParser.cc.
References gather_cfg::cout, idDealer::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, optutl::VariableMapCont::m_variableDescriptionMap, and relativeConstraints::value.
Referenced by _finishDefaultOptions(), and help().
|
static |
|
static |
Definition at line 233 of file CommandLineParser.cc.
References input, and position.
Referenced by _finishDefaultOptions().
|
static |
Definition at line 211 of file CommandLineParser.cc.
References kSpaces.
Referenced by findCommand().
|
inline |
Definition at line 50 of file CommandLineParser.h.
References m_printOptions, and reco::print().
|
static |
Definition at line 158 of file CommandLineParser.cc.
References kSpaces, plotBeamSpotDB::last, match(), and removeComment().
Referenced by _runVariableCommandFromString(), and _setVariableFromString().
|
friend |
|
static |
Definition at line 18 of file CommandLineParser.h.
Referenced by _runVariableCommandFromString(), _setVariablesFromFile(), findCommand(), removeLeadingAndTrailingSpaces(), and split().
|
private |
Definition at line 132 of file CommandLineParser.h.
Referenced by help(), and parseArguments().
|
private |
Definition at line 131 of file CommandLineParser.h.
Referenced by argVec(), and parseArguments().
|
private |
Definition at line 135 of file CommandLineParser.h.
Referenced by _finishDefaultOptions(), and CommandLineParser().
|
private |
Definition at line 134 of file CommandLineParser.h.
Referenced by _finishDefaultOptions(), parseArguments(), and setPrintOptoins().
|
private |
Definition at line 133 of file CommandLineParser.h.
Referenced by help().