GPLIB++
CCalcRecConf.cpp
Go to the documentation of this file.
1 #include <fstream>
2 #include <algorithm>
3  #include <CFatalException.h>
4 #include "CCalcRecConf.h"
5 using namespace std;
6 void CCalcRecConf::GetData(string filename)
7 {
8 ifstream infile;
9 infile.open(filename.c_str());
10 infile.peek();
11 if (!infile)
12  throw CFatalException("No Configurationfile found !");
13  GetData(infile);infile.close();
14 }
15 
16 void CCalcRecConf::GetData(std::ifstream &instream)
17 {
18 CCalcRecConfLexer lexer(instream);
19 CCalcRecConfParser parser(lexer);
20 parser.configfile();
21 cc= parser.cc;
22 sigma= parser.sigma;
23 shift= parser.shift;
24 recmethod= parser.recmethod;
25 normalize= parser.normalize;
26 }
27 
28 void CCalcRecConf::WriteData(string filename)
29 {
30 ofstream confout(filename.c_str());
31 WriteData(confout);}
32 
33 void CCalcRecConf::WriteData(std::ofstream &outstream)
34 {
35 outstream << "cc" << "=" ;
36 outstream << cc << endl;
37 outstream << "sigma" << "=" ;
38 outstream << sigma << endl;
39 outstream << "shift" << "=" ;
40 outstream << shift << endl;
41 outstream << "recmethod" << "=" ;
42 outstream << recmethod << endl;
43 outstream << "normalize" << "=" ;
44 outstream << (normalize ? "true" : "false") << endl;
45 }
46 
void WriteData(std::ofstream &outstream)
void GetData(std::ifstream &instream)