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 41 of file hcalDeleteObject.cc.

Constructor & Destructor Documentation

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 {};
Args::Args ( )
inline

Definition at line 48 of file hcalCalibrationsCopy.cc.

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

Definition at line 49 of file hcalCalibrationsCopy.cc.

49 {};

Member Function Documentation

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

Definition at line 189 of file hcalDeleteObject.cc.

References mArgs.

Referenced by main().

189 {return mArgs;}
std::vector< std::string > mArgs
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

Definition at line 184 of file hcalDeleteObject.cc.

References mProgramName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by printHelp().

184  {
185  int ipos = mProgramName.rfind ('/');
186  return std::string (mProgramName, ipos+1);
187 }
std::string mProgramName
std::string Args::command ( ) const
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 133 of file hcalDeleteObject.cc.

References mComments, and mOptions.

Referenced by main().

133  {
134  mOptions.push_back (fOption);
135  mComments [fOption] = fComment;
136 }
std::map< std::string, std::string > mComments
std::vector< std::string > mOptions
void Args::defineOption ( const std::string &  fOption,
const std::string &  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 = "" 
)

Definition at line 138 of file hcalDeleteObject.cc.

References mComments, and mParameters.

Referenced by main().

138  {
139  mParameters.push_back (fParameter);
140  mComments [fParameter] = fComment;
141 }
std::map< std::string, std::string > mComments
std::vector< std::string > mParameters
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)

Definition at line 195 of file hcalDeleteObject.cc.

References mParsed, and optionIsSet().

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

195  {
196  if (optionIsSet (fKey)) return mParsed [fKey];
197  return "";
198 }
std::map< std::string, std::string > mParsed
bool optionIsSet(const std::string &fOption) const
std::string Args::getParameter ( const std::string &  fKey)
bool Args::optionIsSet ( const std::string &  fOption) const
bool Args::optionIsSet ( const std::string &  fOption) const

Definition at line 191 of file hcalDeleteObject.cc.

References mParsed.

Referenced by getParameter(), and main().

191  {
192  return mParsed.find (fOption) != mParsed.end ();
193 }
std::map< std::string, std::string > mParsed
bool Args::optionIsSet ( const std::string &  fOption) const
bool Args::optionIsSet ( const std::string &  fOption) const
void Args::parse ( int  nArgs,
char *  fArgs[] 
)
void Args::parse ( int  nArgs,
char *  fArgs[] 
)

Definition at line 143 of file hcalDeleteObject.cc.

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

Referenced by main().

143  {
144  if (nArgs <= 0) return;
145  mProgramName = std::string (fArgs [0]);
146  int iarg = 0;
147  while (++iarg < nArgs) {
148  std::string arg (fArgs [iarg]);
149  if (arg [0] != '-') mArgs.push_back (arg);
150  else {
151  if (std::find (mOptions.begin(), mOptions.end (), arg) != mOptions.end ()) {
152  mParsed [arg] = "";
153  }
154  if (std::find (mParameters.begin(), mParameters.end (), arg) != mParameters.end ()) {
155  if (iarg >= nArgs) {
156  std::cerr << "ERROR: Parameter " << arg << " has no value specified. Ignore parameter." << std::endl;
157  }
158  else {
159  mParsed [arg] = std::string (fArgs [++iarg]);
160  }
161  }
162  }
163  }
164 }
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::parse ( int  nArgs,
char *  fArgs[] 
)
void Args::parse ( int  nArgs,
char *  fArgs[] 
)
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const

Definition at line 166 of file hcalDeleteObject.cc.

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

Referenced by printHelp().

166  {
167  char buffer [1024];
168  std::cout << "Parameters:" << std::endl;
169  for (unsigned i = 0; i < mParameters.size (); i++) {
170  std::map<std::string, std::string>::const_iterator it = mComments.find (mParameters [i]);
171  std::string comment = it != mComments.end () ? it->second : "uncommented";
172  sprintf (buffer, " %-8s <value> : %s", (mParameters [i]).c_str(), comment.c_str());
173  std::cout << buffer << std::endl;
174  }
175  std::cout << "Options:" << std::endl;
176  for (unsigned i = 0; i < mOptions.size (); i++) {
177  std::map<std::string, std::string>::const_iterator it = mComments.find (mOptions [i]);
178  std::string comment = it != mComments.end () ? it->second : "uncommented";
179  sprintf (buffer, " %-8s : %s", (mOptions [i]).c_str(), comment.c_str());
180  std::cout << buffer << std::endl;
181  }
182 }
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
void Args::printOptionsHelp ( ) const
void Args::printOptionsHelp ( ) const

Member Data Documentation

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

Definition at line 57 of file hcalDeleteObject.cc.

Referenced by arguments(), and parse().

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

Definition at line 59 of file hcalDeleteObject.cc.

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

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

Definition at line 55 of file hcalDeleteObject.cc.

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

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

Definition at line 56 of file hcalDeleteObject.cc.

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

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

Definition at line 58 of file hcalDeleteObject.cc.

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

std::string Args::mProgramName
private

Definition at line 54 of file hcalDeleteObject.cc.

Referenced by command(), and parse().