CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/TopQuarkAnalysis/TopHitFit/interface/Defaults_Text.h

Go to the documentation of this file.
00001 //
00002 // $Id: Defaults_Text.h,v 1.1 2011/05/26 09:46:53 mseidel Exp $
00003 //
00004 // File: hitfit/Defaults_Text.h
00005 // Purpose: A lightweight implementation of the Defaults interface
00006 //          that uses simple text files.
00007 // Created: Jul, 2000, sss.
00008 //
00009 // Create instances of these objects passing in the name of a file.
00010 // Each line of the file should contain a parameter setting like
00011 //
00012 //   NAME = VALUE
00013 //
00014 // Anything following a `;' or `#' is stried off; leading and trailing
00015 // spaces on VALUE are also removed.  Blank lines are ignored.
00016 //
00017 // You can also pass an argument list to the constructor.  After the
00018 // defaults file is read, the argument list will be scanned, to possibly
00019 // override some of the parameter settings.  An argument of the form
00020 //
00021 //   --NAME=VALUE
00022 //
00023 // is equivalent to the parameter setting
00024 //
00025 //     NAME=VALUE
00026 //
00027 // while
00028 //
00029 //   --NAME
00030 //
00031 // is equivalent to
00032 //
00033 //   NAME=1
00034 //
00035 // and
00036 //
00037 //   --noNAME
00038 //
00039 // is equivalent to
00040 //
00041 //   NAME=0
00042 //
00043 // CMSSW File      : interface/Defaults_Text.h
00044 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
00045 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
00046 //
00047 
00048 
00069 #ifndef HITFIT_DEFAULTS_TEXT_H
00070 #define HITFIT_DEFAULTS_TEXT_H
00071 
00072 #include <string>
00073 #include <iosfwd>
00074 #include "TopQuarkAnalysis/TopHitFit/interface/Defaults.h"
00075 
00076 
00077 namespace hitfit {
00078 
00079 
00080 class Defaults_Textrep;
00081 
00082 
00122 class Defaults_Text
00123   : public Defaults
00124 //
00125 // Purpose: A lightweight implementation of the Defaults interface
00126 //          that uses simple text files.
00127 //
00128 {
00129 public:
00130   // Constructor, destructor.
00131 
00138   Defaults_Text (std::string def_file);
00139 
00148   Defaults_Text (std::string def_file, int argc, char** argv);
00149 
00153   ~Defaults_Text ();
00154 
00155   // Test to see if parameter NAME exists.
00163   virtual bool exists (std::string name) const;
00164 
00165   // Get the value of NAME as an integer.
00172   virtual int get_int (std::string name) const;
00173 
00174   // Get the value of NAME as a boolean.
00181   virtual bool get_bool (std::string name) const;
00182 
00183   // Get the value of NAME as a float.
00191   virtual double get_float (std::string name) const;
00192 
00193   // Get the value of NAME as a string.
00200   virtual std::string get_string (std::string name) const;
00201 
00202   // Dump out all parameters.
00211   friend std::ostream& operator<< (std::ostream& s, const Defaults_Text& def);
00212 
00213 private:
00214   // The internal representation.
00218   Defaults_Textrep* _rep;
00219 };
00220 
00221 
00222 } // namespace hitfit
00223 
00224 
00225 #endif // not HITFIT_DEFAULTS_TEXT_H