CMS 3D CMS Logo

Defaults_Text.h
Go to the documentation of this file.
1 //
2 //
3 // File: hitfit/Defaults_Text.h
4 // Purpose: A lightweight implementation of the Defaults interface
5 // that uses simple text files.
6 // Created: Jul, 2000, sss.
7 //
8 // Create instances of these objects passing in the name of a file.
9 // Each line of the file should contain a parameter setting like
10 //
11 // NAME = VALUE
12 //
13 // Anything following a `;' or `#' is stried off; leading and trailing
14 // spaces on VALUE are also removed. Blank lines are ignored.
15 //
16 // You can also pass an argument list to the constructor. After the
17 // defaults file is read, the argument list will be scanned, to possibly
18 // override some of the parameter settings. An argument of the form
19 //
20 // --NAME=VALUE
21 //
22 // is equivalent to the parameter setting
23 //
24 // NAME=VALUE
25 //
26 // while
27 //
28 // --NAME
29 //
30 // is equivalent to
31 //
32 // NAME=1
33 //
34 // and
35 //
36 // --noNAME
37 //
38 // is equivalent to
39 //
40 // NAME=0
41 //
42 // CMSSW File : interface/Defaults_Text.h
43 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
44 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
45 //
46 
67 #ifndef HITFIT_DEFAULTS_TEXT_H
68 #define HITFIT_DEFAULTS_TEXT_H
69 
70 #include <string>
71 #include <iosfwd>
73 
74 namespace hitfit {
75 
76  class Defaults_Textrep;
77 
117  class Defaults_Text : public Defaults
118  //
119  // Purpose: A lightweight implementation of the Defaults interface
120  // that uses simple text files.
121  //
122  {
123  public:
124  // Constructor, destructor.
125 
132  Defaults_Text(std::string def_file);
133 
142  Defaults_Text(std::string def_file, int argc, char** argv);
143 
147  ~Defaults_Text() override;
148 
149  // Test to see if parameter NAME exists.
157  bool exists(std::string name) const override;
158 
159  // Get the value of NAME as an integer.
166  int get_int(std::string name) const override;
167 
168  // Get the value of NAME as a boolean.
175  bool get_bool(std::string name) const override;
176 
177  // Get the value of NAME as a float.
185  double get_float(std::string name) const override;
186 
187  // Get the value of NAME as a string.
194  std::string get_string(std::string name) const override;
195 
196  // Dump out all parameters.
205  friend std::ostream& operator<<(std::ostream& s, const Defaults_Text& def);
206 
207  private:
208  // The internal representation.
213  };
214 
215 } // namespace hitfit
216 
217 #endif // not HITFIT_DEFAULTS_TEXT_H
cmsBatch.argv
argv
Definition: cmsBatch.py:279
hitfit
Definition: Base_Constrainer.h:43
hitfit::Defaults_Text::get_string
std::string get_string(std::string name) const override
Definition: Defaults_Text.cc:416
dir2webdir.argc
argc
Definition: dir2webdir.py:39
hitfit::Defaults_Text::_rep
Defaults_Textrep * _rep
Definition: Defaults_Text.h:212
Defaults.h
Define an abstract interface for getting parameter settings.
hitfit::Defaults_Textrep
The internal representation for a Defaults_Text object.
Definition: Defaults_Text.cc:102
hitfit::Defaults_Text::get_float
double get_float(std::string name) const override
Definition: Defaults_Text.cc:383
alignCSCRings.s
s
Definition: alignCSCRings.py:92
hitfit::Defaults_Text
A lightweight implementation of the Defaults interface that uses simple ASCII text files.
Definition: Defaults_Text.h:117
hitfit::Defaults_Text::Defaults_Text
Defaults_Text(std::string def_file)
Constructor, create a Default_Text object from an ASCII text file. Pass an empty string to skip readi...
Definition: Defaults_Text.cc:320
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hitfit::Defaults_Text::~Defaults_Text
~Defaults_Text() override
Destructor.
Definition: Defaults_Text.cc:346
hitfit::Defaults_Text::exists
bool exists(std::string name) const override
Definition: Defaults_Text.cc:354
hitfit::Defaults
Define an interface for getting parameter settings.
Definition: Defaults.h:57
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hitfit::Defaults_Text::operator<<
friend std::ostream & operator<<(std::ostream &s, const Defaults_Text &def)
Definition: Defaults_Text.cc:430
spu::def
int def(FILE *, FILE *, int)
Definition: SherpackUtilities.cc:14
hitfit::Defaults_Text::get_bool
bool get_bool(std::string name) const override
Definition: Defaults_Text.cc:397
hitfit::Defaults_Text::get_int
int get_int(std::string name) const override
Definition: Defaults_Text.cc:369