test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
47 
68 #ifndef HITFIT_DEFAULTS_TEXT_H
69 #define HITFIT_DEFAULTS_TEXT_H
70 
71 #include <string>
72 #include <iosfwd>
74 
75 
76 namespace hitfit {
77 
78 
79 class Defaults_Textrep;
80 
81 
122  : public Defaults
123 //
124 // Purpose: A lightweight implementation of the Defaults interface
125 // that uses simple text files.
126 //
127 {
128 public:
129  // Constructor, destructor.
130 
137  Defaults_Text (std::string def_file);
138 
147  Defaults_Text (std::string def_file, int argc, char** argv);
148 
152  ~Defaults_Text ();
153 
154  // Test to see if parameter NAME exists.
162  virtual bool exists (std::string name) const;
163 
164  // Get the value of NAME as an integer.
171  virtual int get_int (std::string name) const;
172 
173  // Get the value of NAME as a boolean.
180  virtual bool get_bool (std::string name) const;
181 
182  // Get the value of NAME as a float.
190  virtual double get_float (std::string name) const;
191 
192  // Get the value of NAME as a string.
199  virtual std::string get_string (std::string name) const;
200 
201  // Dump out all parameters.
210  friend std::ostream& operator<< (std::ostream& s, const Defaults_Text& def);
211 
212 private:
213  // The internal representation.
218 };
219 
220 
221 } // namespace hitfit
222 
223 
224 #endif // not HITFIT_DEFAULTS_TEXT_H
Define an abstract interface for getting parameter settings.
friend std::ostream & operator<<(std::ostream &s, const Defaults_Text &def)
A lightweight implementation of the Defaults interface that uses simple ASCII text files...
virtual bool exists(std::string name) const
The internal representation for a Defaults_Text object.
~Defaults_Text()
Destructor.
Defaults_Text(std::string def_file)
Constructor, create a Default_Text object from an ASCII text file. Pass an empty string to skip readi...
virtual double get_float(std::string name) const
virtual std::string get_string(std::string name) const
virtual int get_int(std::string name) const
Defaults_Textrep * _rep
Define an interface for getting parameter settings.
Definition: Defaults.h:61
JetCorrectorParameters::Definitions def
Definition: classes.h:6
virtual bool get_bool(std::string name) const