CMS 3D CMS Logo

Public Member Functions | Private Attributes

Args Class Reference

List of all members.

Public Member Functions

 Args ()
 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::vector< std::string > arguments () const
std::string command () 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 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="")
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)
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
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 parse (int nArgs, char *fArgs[])
void printOptionsHelp () const
void printOptionsHelp () const
void printOptionsHelp () const
void printOptionsHelp () const
void printOptionsHelp () const
 ~Args ()
 ~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 71 of file HcalPedestalValidator.cc.


Constructor & Destructor Documentation

Args::Args ( ) [inline]

Definition at line 73 of file HcalPedestalValidator.cc.

{};
Args::~Args ( ) [inline]

Definition at line 74 of file HcalPedestalValidator.cc.

{};
Args::Args ( ) [inline]

Definition at line 48 of file hcalCalibrationsCopy.cc.

{};
Args::~Args ( ) [inline]

Definition at line 49 of file hcalCalibrationsCopy.cc.

{};
Args::Args ( ) [inline]

Definition at line 43 of file hcalDeleteObject.cc.

{};
Args::~Args ( ) [inline]

Definition at line 44 of file hcalDeleteObject.cc.

{};
Args::Args ( ) [inline]

Definition at line 43 of file hcalIovTool.cc.

{};
Args::~Args ( ) [inline]

Definition at line 44 of file hcalIovTool.cc.

{};
Args::Args ( ) [inline]

Definition at line 33 of file hcalPublishConditions.cc.

{};
Args::~Args ( ) [inline]

Definition at line 34 of file hcalPublishConditions.cc.

{};

Member Function Documentation

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

Definition at line 262 of file HcalPedestalValidator.cc.

References mArgs.

Referenced by main().

{return mArgs;}
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
std::string Args::command ( ) const
std::string Args::command ( ) const
std::string Args::command ( ) const
std::string Args::command ( ) const
std::string Args::command ( ) const

Definition at line 257 of file HcalPedestalValidator.cc.

References mProgramName.

Referenced by printHelp().

                               {
  int ipos = mProgramName.rfind ('/');
  return std::string (mProgramName, ipos+1);
}
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 207 of file HcalPedestalValidator.cc.

References mComments, and mOptions.

Referenced by main().

                                                                            {
  mOptions.push_back (fOption);
  mComments [fOption] = fComment;
}
void Args::defineOption ( const std::string &  fOption,
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 212 of file HcalPedestalValidator.cc.

References mComments, and mParameters.

Referenced by main().

                                                                                  {   mParameters.push_back (fParameter);
  mComments [fParameter] = fComment;
}
void Args::defineParameter ( const std::string &  fParameter,
const std::string &  fComment = "" 
)
void Args::defineParameter ( const std::string &  fParameter,
const std::string &  fComment = "" 
)
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 268 of file HcalPedestalValidator.cc.

References mParsed, and optionIsSet().

Referenced by main().

                                                   {
  if (optionIsSet (fKey)) return mParsed [fKey];
  return "";
}
std::string Args::getParameter ( const std::string &  fKey)
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 264 of file HcalPedestalValidator.cc.

References mParsed.

Referenced by getParameter(), and main().

                                                      {
  return mParsed.find (fOption) != mParsed.end ();
}
bool Args::optionIsSet ( const std::string &  fOption) const
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[] 
)
void Args::parse ( int  nArgs,
char *  fArgs[] 
)

Definition at line 216 of file HcalPedestalValidator.cc.

References cmsCodeRulesChecker::arg, ExpressReco_HICollisions_FallBack::cerr, spr::find(), mArgs, mOptions, mParameters, mParsed, and mProgramName.

Referenced by main().

                                           {
  if (nArgs <= 0) return;
  mProgramName = std::string (fArgs [0]);
  int iarg = 0;
  while (++iarg < nArgs) {
    std::string arg (fArgs [iarg]);
    if (arg [0] != '-') mArgs.push_back (arg);
    else {
      if (std::find (mOptions.begin(), mOptions.end (), arg) !=  mOptions.end ()) {
        mParsed [arg] = "";
      }
      if (std::find (mParameters.begin(), mParameters.end (), arg) !=  mParameters.end ()) {
        if (iarg >= nArgs) {
          std::cerr << "ERROR: Parameter " << arg << " has no value specified. Ignore parameter." << std::endl;
        }
        else {
          mParsed [arg] = std::string (fArgs [++iarg]);
        }
      }
    }
  }
}
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const

Definition at line 239 of file HcalPedestalValidator.cc.

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

Referenced by main(), and printHelp().

                                   {
  char buffer [1024];
  std::cout << "Parameters:" << std::endl;
  for (unsigned i = 0; i < mParameters.size (); i++) {
    std::map<std::string, std::string>::const_iterator it = mComments.find (mParameters [i]);
    std::string comment = it != mComments.end () ? it->second : "uncommented";
    sprintf (buffer, "  %-8s <value> : %s", (mParameters [i]).c_str(),  comment.c_str());
    std::cout << buffer << std::endl;
  }
  std::cout << "Options:" << std::endl;
  for (unsigned i = 0; i < mOptions.size (); i++) {
    std::map<std::string, std::string>::const_iterator it = mComments.find (mOptions [i]);
    std::string comment = it != mComments.end () ? it->second : "uncommented";
    sprintf (buffer, "  %-8s  : %s", (mOptions [i]).c_str(),  comment.c_str());
    std::cout << buffer << std::endl;
  }
}
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const

Member Data Documentation

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

Definition at line 87 of file HcalPedestalValidator.cc.

Referenced by arguments(), and parse().

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

Definition at line 89 of file HcalPedestalValidator.cc.

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

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

Definition at line 85 of file HcalPedestalValidator.cc.

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

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

Definition at line 86 of file HcalPedestalValidator.cc.

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

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

Definition at line 88 of file HcalPedestalValidator.cc.

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

std::string Args::mProgramName [private]

Definition at line 84 of file HcalPedestalValidator.cc.

Referenced by command(), and parse().