CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
Args Class Reference

Public Member Functions

 Args ()
 
 Args ()
 
 Args ()
 
 Args ()
 
std::vector< std::string > arguments () const
 
std::vector< std::string > arguments () const
 
std::vector< std::string > arguments () const
 
std::vector< std::string > arguments () const
 
std::string command () const
 
std::string command () const
 
std::string command () const
 
std::string command () const
 
void defineOption (const std::string &fOption, const std::string &fComment="")
 
void defineOption (const std::string &fOption, const std::string &fComment="")
 
void defineOption (const std::string &fOption, const std::string &fComment="")
 
void defineOption (const std::string &fOption, const std::string &fComment="")
 
void defineParameter (const std::string &fParameter, const std::string &fComment="")
 
void defineParameter (const std::string &fParameter, const std::string &fComment="")
 
void defineParameter (const std::string &fParameter, const std::string &fComment="")
 
void defineParameter (const std::string &fParameter, const std::string &fComment="")
 
std::string getParameter (const std::string &fKey)
 
std::string getParameter (const std::string &fKey)
 
std::string getParameter (const std::string &fKey)
 
std::string getParameter (const std::string &fKey)
 
bool optionIsSet (const std::string &fOption) const
 
bool optionIsSet (const std::string &fOption) const
 
bool optionIsSet (const std::string &fOption) const
 
bool optionIsSet (const std::string &fOption) const
 
void parse (int nArgs, char *fArgs[])
 
void parse (int nArgs, char *fArgs[])
 
void parse (int nArgs, char *fArgs[])
 
void parse (int nArgs, char *fArgs[])
 
void printOptionsHelp () const
 
void printOptionsHelp () const
 
void printOptionsHelp () const
 
void printOptionsHelp () const
 
 ~Args ()
 
 ~Args ()
 
 ~Args ()
 
 ~Args ()
 

Private Attributes

std::vector< std::string > mArgs
 
std::map< std::string,
std::string > 
mComments
 
std::vector< std::string > mOptions
 
std::vector< std::string > mParameters
 
std::map< std::string,
std::string > 
mParsed
 
std::string mProgramName
 

Detailed Description

Definition at line 46 of file hcalCalibrationsCopy.cc.

Constructor & Destructor Documentation

Args::Args ( )
inline

Definition at line 48 of file hcalCalibrationsCopy.cc.

48 {};
Args::~Args ( )
inline

Definition at line 49 of file hcalCalibrationsCopy.cc.

49 {};
Args::Args ( )
inline

Definition at line 43 of file hcalDeleteObject.cc.

43 {};
Args::~Args ( )
inline

Definition at line 44 of file hcalDeleteObject.cc.

44 {};
Args::Args ( )
inline

Definition at line 43 of file hcalIovTool.cc.

43 {};
Args::~Args ( )
inline

Definition at line 44 of file hcalIovTool.cc.

44 {};
Args::Args ( )
inline

Definition at line 33 of file hcalPublishConditions.cc.

33 {};
Args::~Args ( )
inline

Definition at line 34 of file hcalPublishConditions.cc.

34 {};

Member Function Documentation

std::vector<std::string> Args::arguments ( ) const
std::vector<std::string> Args::arguments ( ) const
std::vector<std::string> Args::arguments ( ) const
std::vector< std::string > Args::arguments ( ) const

Definition at line 569 of file hcalCalibrationsCopy.cc.

References mArgs.

Referenced by main().

569 {return mArgs;}
std::vector< std::string > mArgs
std::string Args::command ( ) const
std::string Args::command ( ) const
std::string Args::command ( ) const
std::string Args::command ( ) const

Definition at line 564 of file hcalCalibrationsCopy.cc.

References mProgramName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by printHelp().

564  {
565  int ipos = mProgramName.rfind ('/');
566  return std::string (mProgramName, ipos+1);
567 }
std::string mProgramName
void Args::defineOption ( const std::string &  fOption,
const std::string &  fComment = "" 
)
void Args::defineOption ( const std::string &  fOption,
const std::string &  fComment = "" 
)
void Args::defineOption ( const std::string &  fOption,
const std::string &  fComment = "" 
)
void Args::defineOption ( const std::string &  fOption,
const std::string &  fComment = "" 
)

Definition at line 513 of file hcalCalibrationsCopy.cc.

References mComments, and mOptions.

Referenced by main().

513  {
514  mOptions.push_back (fOption);
515  mComments [fOption] = fComment;
516 }
std::map< std::string, std::string > mComments
std::vector< std::string > mOptions
void Args::defineParameter ( const std::string &  fParameter,
const std::string &  fComment = "" 
)
void Args::defineParameter ( const std::string &  fParameter,
const std::string &  fComment = "" 
)
void Args::defineParameter ( const std::string &  fParameter,
const std::string &  fComment = "" 
)
void Args::defineParameter ( const std::string &  fParameter,
const std::string &  fComment = "" 
)

Definition at line 518 of file hcalCalibrationsCopy.cc.

References mComments, and mParameters.

Referenced by main().

518  {
519  mParameters.push_back (fParameter);
520  mComments [fParameter] = fComment;
521 }
std::map< std::string, std::string > mComments
std::vector< std::string > mParameters
std::string Args::getParameter ( const std::string &  fKey)
std::string Args::getParameter ( const std::string &  fKey)
std::string Args::getParameter ( const std::string &  fKey)
std::string Args::getParameter ( const std::string &  fKey)

Definition at line 575 of file hcalCalibrationsCopy.cc.

References mParsed, and optionIsSet().

Referenced by Mixins._Parameterizable::hasParameter(), and main().

575  {
576  if (optionIsSet (fKey)) return mParsed [fKey];
577  return "";
578 }
std::map< std::string, std::string > mParsed
bool optionIsSet(const std::string &fOption) const
bool Args::optionIsSet ( const std::string &  fOption) const
bool Args::optionIsSet ( const std::string &  fOption) const
bool Args::optionIsSet ( const std::string &  fOption) const
bool Args::optionIsSet ( const std::string &  fOption) const

Definition at line 571 of file hcalCalibrationsCopy.cc.

References mParsed.

Referenced by getParameter(), and main().

571  {
572  return mParsed.find (fOption) != mParsed.end ();
573 }
std::map< std::string, std::string > mParsed
void Args::parse ( int  nArgs,
char *  fArgs[] 
)
void Args::parse ( int  nArgs,
char *  fArgs[] 
)
void Args::parse ( int  nArgs,
char *  fArgs[] 
)
void Args::parse ( int  nArgs,
char *  fArgs[] 
)

Definition at line 523 of file hcalCalibrationsCopy.cc.

References dtNoiseDBValidation_cfg::cerr, spr::find(), mArgs, mOptions, mParameters, mParsed, mProgramName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by main().

523  {
524  if (nArgs <= 0) return;
525  mProgramName = std::string (fArgs [0]);
526  int iarg = 0;
527  while (++iarg < nArgs) {
528  std::string arg (fArgs [iarg]);
529  if (arg [0] != '-') mArgs.push_back (arg);
530  else {
531  if (std::find (mOptions.begin(), mOptions.end (), arg) != mOptions.end ()) {
532  mParsed [arg] = "";
533  }
534  if (std::find (mParameters.begin(), mParameters.end (), arg) != mParameters.end ()) {
535  if (iarg >= nArgs) {
536  std::cerr << "ERROR: Parameter " << arg << " has no value specified. Ignore parameter." << std::endl;
537  }
538  else {
539  mParsed [arg] = std::string (fArgs [++iarg]);
540  }
541  }
542  }
543  }
544 }
std::string mProgramName
std::vector< std::string > mOptions
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
A arg
Definition: Factorize.h:36
std::vector< std::string > mParameters
std::vector< std::string > mArgs
std::map< std::string, std::string > mParsed
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const

Definition at line 546 of file hcalCalibrationsCopy.cc.

References comment, gather_cfg::cout, i, mComments, mOptions, mParameters, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by printHelp().

546  {
547  char buffer [1024];
548  std::cout << "Parameters:" << std::endl;
549  for (unsigned i = 0; i < mParameters.size (); i++) {
550  std::map<std::string, std::string>::const_iterator it = mComments.find (mParameters [i]);
551  std::string comment = it != mComments.end () ? it->second : "uncommented";
552  sprintf (buffer, " %-8s <value> : %s", (mParameters [i]).c_str(), comment.c_str());
553  std::cout << buffer << std::endl;
554  }
555  std::cout << "Options:" << std::endl;
556  for (unsigned i = 0; i < mOptions.size (); i++) {
557  std::map<std::string, std::string>::const_iterator it = mComments.find (mOptions [i]);
558  std::string comment = it != mComments.end () ? it->second : "uncommented";
559  sprintf (buffer, " %-8s : %s", (mOptions [i]).c_str(), comment.c_str());
560  std::cout << buffer << std::endl;
561  }
562 }
int i
Definition: DBlmapReader.cc:9
std::map< std::string, std::string > mComments
std::vector< std::string > mOptions
std::vector< std::string > mParameters
tuple cout
Definition: gather_cfg.py:121
#define comment(par)
Definition: vmac.h:161

Member Data Documentation

std::vector< std::string > Args::mArgs
private

Definition at line 62 of file hcalCalibrationsCopy.cc.

Referenced by arguments(), and parse().

std::map< std::string, std::string > Args::mComments
private

Definition at line 64 of file hcalCalibrationsCopy.cc.

Referenced by defineOption(), defineParameter(), and printOptionsHelp().

std::vector< std::string > Args::mOptions
private

Definition at line 60 of file hcalCalibrationsCopy.cc.

Referenced by defineOption(), parse(), and printOptionsHelp().

std::vector< std::string > Args::mParameters
private

Definition at line 61 of file hcalCalibrationsCopy.cc.

Referenced by defineParameter(), parse(), and printOptionsHelp().

std::map< std::string, std::string > Args::mParsed
private

Definition at line 63 of file hcalCalibrationsCopy.cc.

Referenced by getParameter(), optionIsSet(), and parse().

std::string Args::mProgramName
private

Definition at line 59 of file hcalCalibrationsCopy.cc.

Referenced by command(), and parse().