CRLSConfig.cpp
Go to the documentation of this file.00001 #include <fstream>
00002 #include <algorithm>
00003 #include <CFatalException.h>
00004 #include "CRLSConfig.h"
00005 using namespace std;
00006 void CRLSConfig::GetData(string filename)
00007 {
00008 ifstream infile;
00009 infile.open(filename.c_str());
00010 infile.peek();
00011 if (!infile)
00012 throw CFatalException("No Configurationfile found !");
00013 GetData(infile);infile.close();
00014 }
00015
00016 void CRLSConfig::GetData(std::ifstream &instream)
00017 {
00018 CRLSConfigLexer lexer(instream);
00019 CRLSConfigParser parser(lexer);
00020 parser.configfile();
00021 delta= parser.delta;
00022 filterlength= parser.filterlength;
00023 shift= parser.shift;
00024 lambda= parser.lambda;
00025 }
00026
00027 void CRLSConfig::WriteData(string filename)
00028 {
00029 ofstream confout(filename.c_str());
00030 WriteData(confout);}
00031
00032 void CRLSConfig::WriteData(std::ofstream &outstream)
00033 {
00034 outstream << "delta" << "=" ;
00035 outstream << delta << endl;
00036 outstream << "filterlength" << "=" ;
00037 outstream << filterlength << endl;
00038 outstream << "shift" << "=" ;
00039 outstream << shift << endl;
00040 outstream << "lambda" << "=" ;
00041 outstream << lambda << endl;
00042 }
00043