CNeuralConfig.cpp
Go to the documentation of this file.00001 #include <fstream>
00002 #include <algorithm>
00003 #include <CFatalException.h>
00004 #include "CNeuralConfig.h"
00005 using namespace std;
00006 void CNeuralConfig::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 CNeuralConfig::GetData(std::ifstream &instream)
00017 {
00018 CNeuralConfigLexer lexer(instream);
00019 CNeuralConfigParser parser(lexer);
00020 parser.configfile();
00021 seglength= parser.seglength;
00022 maxinit= parser.maxinit;
00023 hiddenlayers= parser.hiddenlayers;
00024 maxit= parser.maxit;
00025 mu= parser.mu;
00026 }
00027
00028 void CNeuralConfig::WriteData(string filename)
00029 {
00030 ofstream confout(filename.c_str());
00031 WriteData(confout);}
00032
00033 void CNeuralConfig::WriteData(std::ofstream &outstream)
00034 {
00035 outstream << "seglength" << "=" ;
00036 outstream << seglength << endl;
00037 outstream << "maxinit" << "=" ;
00038 outstream << maxinit << endl;
00039 outstream << "hiddenlayers" << "=" ;
00040 outstream << hiddenlayers << endl;
00041 outstream << "maxit" << "=" ;
00042 outstream << maxit << endl;
00043 outstream << "mu" << "=" ;
00044 outstream << mu << endl;
00045 }
00046