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 // $Id: Defaults_Text.h,v 1.1 2011/05/26 09:46:53 mseidel Exp $
3 //
4 // File: hitfit/Defaults_Text.h
5 // Purpose: A lightweight implementation of the Defaults interface
6 // that uses simple text files.
7 // Created: Jul, 2000, sss.
8 //
9 // Create instances of these objects passing in the name of a file.
10 // Each line of the file should contain a parameter setting like
11 //
12 // NAME = VALUE
13 //
14 // Anything following a `;' or `#' is stried off; leading and trailing
15 // spaces on VALUE are also removed. Blank lines are ignored.
16 //
17 // You can also pass an argument list to the constructor. After the
18 // defaults file is read, the argument list will be scanned, to possibly
19 // override some of the parameter settings. An argument of the form
20 //
21 // --NAME=VALUE
22 //
23 // is equivalent to the parameter setting
24 //
25 // NAME=VALUE
26 //
27 // while
28 //
29 // --NAME
30 //
31 // is equivalent to
32 //
33 // NAME=1
34 //
35 // and
36 //
37 // --noNAME
38 //
39 // is equivalent to
40 //
41 // NAME=0
42 //
43 // CMSSW File : interface/Defaults_Text.h
44 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
45 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
46 //
47 
48 
69 #ifndef HITFIT_DEFAULTS_TEXT_H
70 #define HITFIT_DEFAULTS_TEXT_H
71 
72 #include <string>
73 #include <iosfwd>
75 
76 
77 namespace hitfit {
78 
79 
80 class Defaults_Textrep;
81 
82 
123  : public Defaults
124 //
125 // Purpose: A lightweight implementation of the Defaults interface
126 // that uses simple text files.
127 //
128 {
129 public:
130  // Constructor, destructor.
131 
138  Defaults_Text (std::string def_file);
139 
148  Defaults_Text (std::string def_file, int argc, char** argv);
149 
153  ~Defaults_Text ();
154 
155  // Test to see if parameter NAME exists.
163  virtual bool exists (std::string name) const;
164 
165  // Get the value of NAME as an integer.
172  virtual int get_int (std::string name) const;
173 
174  // Get the value of NAME as a boolean.
181  virtual bool get_bool (std::string name) const;
182 
183  // Get the value of NAME as a float.
191  virtual double get_float (std::string name) const;
192 
193  // Get the value of NAME as a string.
200  virtual std::string get_string (std::string name) const;
201 
202  // Dump out all parameters.
211  friend std::ostream& operator<< (std::ostream& s, const Defaults_Text& def);
212 
213 private:
214  // The internal representation.
219 };
220 
221 
222 } // namespace hitfit
223 
224 
225 #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
tuple argc
Definition: dir2webdir.py:41
virtual int get_int(std::string name) const
Defaults_Textrep * _rep
Define an interface for getting parameter settings.
Definition: Defaults.h:62
JetCorrectorParameters::Definitions def
Definition: classes.h:12
virtual bool get_bool(std::string name) const