13 bool NamedParameterBase::IveSaidItOnce=0;
15 std::string NamedParameterBase::_defaultFile =
"";
16 std::istream* NamedParameterBase::_defaultStreamPtr = &std::cin;
19 bool NamedParameterBase::setDefaultInputFile(
const std::string& fname){
24 bool NamedParameterBase::setDefaultInputStream(std::istream& str){
26 _defaultStreamPtr = &str;
32 bool NamedParameterBase::reloadFile(
const std::string&
id){
34 success |= (bool) getFlist()->reloadFile(
id);
36 success |= setFromParsedFile();
40 NamedParameterBase::NamedParameterBase(
const std::string& name_in
46 , _gotInitialised(false)
55 cout <<
"INFO in constructor of NamedParameterBase:" 56 <<
"\n > For parameter named: \"" <<
_name <<
"\"" 57 <<
"\n > You did not provide a filename." 58 <<
"\n > I'll read from stdin. This is completely OK," 59 <<
"\n > but if there is no input from stdin ending in EOF," 60 <<
"\n > the program will stall after this message." 61 <<
"\n > If you find yourself in this situation, press Ctr-d." 62 <<
"\n > In future, run the program as ./program < inputFile.txt" 63 <<
"\n > even if inputFile.txt is just an empty dummy file." 64 <<
"\n > This message is only printed once." 76 , _gotInitialised(other._gotInitialised)
77 , _quiet(other._quiet)
82 cout <<
"WARNING in destructor of NamedParameterBase:" 83 <<
"\n > Hello. My name is \"" <<
_name <<
"\"." 84 <<
"\n > I'm being destroyed, and" 85 <<
"\n > I never even got initialised." 86 <<
"\n > Did you do that deliberatly?" 109 cout <<
"SERIOUS ERROR IN NamedParameterBase::read(std::istream& is)" 110 <<
"\n > call to ParsedParameterFileList::getParsedFile" 111 <<
"\n > return 0 pointer. This is bad. Let's see how long" 112 <<
"\n > I'll last..." << endl;
121 cout <<
"SERIOUS ERROR IN NamedParameterBase::read(const std::string&)" 122 <<
"\n > with string value = " << fname <<
"." 123 <<
"\n > Call to ParsedParameterFileList::getParsedFile" 124 <<
"\n > return 0 pointer. This is bad. Let's see how long" 125 <<
"\n > I'll last..." << endl;
135 cout <<
"WARNING in NamedParameterBase::setFromParsedFile():" 136 <<
"\n No ParsedParameterFile attached!." << endl;
159 std::string str =
name() +
"\t" + str_in;
bool setPPF(ParsedParameterFile *ppF_in=0)
static std::istream * _defaultStreamPtr
virtual const std::string & name() const
virtual bool setFromParsedFile()
virtual ~NamedParameterBase()
static std::string removeTrailingBlanks(const std::string &s)
ParsedParameterFile * _ppF
NamedParameterStream & operator>>(NamedParameterStream &eam, std::string &ing)
static std::string _defaultFile
virtual bool setFromParsedLine(const ParsedParameterLine &line)=0
static ParsedParameterFileList * getFlist()
static std::string removeLeadingBlanks(const std::string &s)
const ParsedParameterLine & find(const std::string &name) const
static ParsedParameterFileList * getMe()
static bool IveSaidItOnce
bool setFromInitString(const std::string &str)
bool setFromInitStringNoName(const std::string &str_in)
ParsedParameterFile * getParsedFile(const std::string &fname)
NamedParameterBase(const std::string &name_in="", const char *fname=0, VERBOSITY=VERBOSE)