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 ()
 
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
 
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="")
 
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
 
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
 
 ~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 40 of file hcalDeleteObject.cc.

Constructor & Destructor Documentation

Args::Args ( )
inline

Definition at line 42 of file hcalDeleteObject.cc.

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

Definition at line 43 of file hcalDeleteObject.cc.

43 {};
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

Definition at line 188 of file hcalDeleteObject.cc.

References mArgs.

Referenced by main().

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

Definition at line 183 of file hcalDeleteObject.cc.

References mProgramName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by printHelp().

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

References mComments, and mOptions.

Referenced by main().

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

Definition at line 137 of file hcalDeleteObject.cc.

References mComments, and mParameters.

Referenced by main().

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

Definition at line 194 of file hcalDeleteObject.cc.

References mParsed, and optionIsSet().

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

194  {
195  if (optionIsSet (fKey)) return mParsed [fKey];
196  return "";
197 }
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 190 of file hcalDeleteObject.cc.

References mParsed.

Referenced by getParameter(), and main().

190  {
191  return mParsed.find (fOption) != mParsed.end ();
192 }
std::map< std::string, std::string > mParsed
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 142 of file hcalDeleteObject.cc.

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

Referenced by main().

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

Definition at line 165 of file hcalDeleteObject.cc.

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

Referenced by printHelp().

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

Member Data Documentation

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

Definition at line 56 of file hcalDeleteObject.cc.

Referenced by arguments(), and parse().

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

Definition at line 58 of file hcalDeleteObject.cc.

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

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

Definition at line 54 of file hcalDeleteObject.cc.

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

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

Definition at line 55 of file hcalDeleteObject.cc.

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

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

Definition at line 57 of file hcalDeleteObject.cc.

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

std::string Args::mProgramName
private

Definition at line 53 of file hcalDeleteObject.cc.

Referenced by command(), and parse().