A lightweight implementation of the Defaults interface that uses simple ASCII text files. More...
#include <Defaults_Text.h>
Public Member Functions | |
Defaults_Text (std::string def_file) | |
Constructor, create a Default_Text object from an ASCII text file. Pass an empty string to skip reading a file. More... | |
Defaults_Text (std::string def_file, int argc, char **argv) | |
Constructor, create a Default_Text object from an ASCII text file and argument list. More... | |
bool | exists (std::string name) const override |
bool | get_bool (std::string name) const override |
double | get_float (std::string name) const override |
int | get_int (std::string name) const override |
std::string | get_string (std::string name) const override |
~Defaults_Text () override | |
Destructor. More... | |
Public Member Functions inherited from hitfit::Defaults | |
Defaults () | |
virtual | ~Defaults () |
Private Attributes | |
Defaults_Textrep * | _rep |
Friends | |
std::ostream & | operator<< (std::ostream &s, const Defaults_Text &def) |
A lightweight implementation of the Defaults interface that uses simple ASCII text files.
Create instances of these objects passing in the name of a file. Each line of the file should contain a parameter setting like
name = value
Anything following a ‘;’ or ‘#’ is stried off; leading and trailing whitespaces on value are also removed. Blank lines are ignored.
User can also pass an argument list to the constructor. After the default ASCII input file is read, the argument list will be scanned, to possibly override some of the parameter settings. An argument of the form
–name=value
is equivalent to the parameter setting
name = value
while
–name
is equivalent to
name = 1
and
–noname
is equivalent to
name = 0.
Definition at line 117 of file Defaults_Text.h.
hitfit::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 reading a file.
def_file | The ASCII text file to read. Pass an empty string to skip reading a file. |
Definition at line 320 of file Defaults_Text.cc.
hitfit::Defaults_Text::Defaults_Text | ( | std::string | def_file, |
int | argc, | ||
char ** | argv | ||
) |
Constructor, create a Default_Text object from an ASCII text file and argument list.
def_file | The ASCII text file to read. Pass an empty string to skip reading a file. |
argc | The length of the argument list. |
argv | The argument list. |
Definition at line 332 of file Defaults_Text.cc.
|
override |
|
overridevirtual |
Test to see if parameter name exists.
name | The name of the parameter. |
Implements hitfit::Defaults.
Definition at line 354 of file Defaults_Text.cc.
References Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.
Referenced by hitfit::EtaDepResolution::Read().
|
overridevirtual |
Get the value of name as boolean.
name | The name of the parameter. |
Implements hitfit::Defaults.
Definition at line 397 of file Defaults_Text.cc.
References Skims_PA_cff::name, and heppy_batch::val.
|
overridevirtual |
Get the value of name as a floating-point of type double.
name | The name of the parameter. |
Implements hitfit::Defaults.
Definition at line 383 of file Defaults_Text.cc.
References Skims_PA_cff::name.
Referenced by hitfit::EtaDepResolution::Read().
|
overridevirtual |
Get the value of name as integer.
name | The name of the parameter. |
Implements hitfit::Defaults.
Definition at line 369 of file Defaults_Text.cc.
References Skims_PA_cff::name.
|
overridevirtual |
Get the value of name as a string.
name | The name of the parameter. |
Implements hitfit::Defaults.
Definition at line 416 of file Defaults_Text.cc.
References Skims_PA_cff::name.
Referenced by hitfit::METTranslatorBase< pat::MET >::METTranslatorBase(), and hitfit::EtaDepResolution::Read().
|
friend |
Output stream operator. Print out all parameters' names and their values.
s | The output stream to write. |
def | The instance to print. |
Definition at line 430 of file Defaults_Text.cc.
|
private |
The internal representation.
Definition at line 212 of file Defaults_Text.h.
Referenced by ~Defaults_Text().