goe2j.cpp
Go to the documentation of this file.00001 #include <iostream>
00002 #include <iterator>
00003 #include "MTStationList.h"
00004 #include "Util.h"
00005
00006 using namespace std;
00007 using namespace gplib;
00008
00009 int main(int argc, char* argv[])
00010 {
00011 string version = "$Id: goe2j.cpp 1842 2010-04-09 14:30:17Z mmoorkamp $";
00012 cout << endl << endl;
00013 cout << "Program " << version << endl;
00014 cout << " Convert edi files to .mtt and .j format." << endl;
00015 cout
00016 << " Input is a file that contains the names of the edi files to convert."
00017 << endl;
00018 cout << " For each file two new files in .j and .mtt format are written."
00019 << endl;
00020 cout << endl << endl;
00021 MTStationList MTSites;
00022 string infilename;
00023 if (argc > 1)
00024 {
00025 infilename = argv[1];
00026 }
00027 else
00028 {
00029 infilename = AskFilename("Input Filename: ");
00030 }
00031
00032 MTSites.GetData(infilename);
00033 for (unsigned int i = 0; i < MTSites.GetList().size(); ++i)
00034 {
00035 cout << "Writing site " << MTSites.GetList().at(i).GetName();
00036 MTSites.at(i).WriteAsMtt(MTSites.GetList().at(i).GetName());
00037 MTSites.at(i).WriteAsJ(MTSites.GetList().at(i).GetName());
00038 cout << " ... done" << endl;
00039 }
00040 if (!MTSites.GetList().empty())
00041 {
00042 cout << "Common frequencies: ";
00043 copy(MTSites.GetCommonFrequencies().begin(),
00044 MTSites.GetCommonFrequencies().end(), ostream_iterator<double> (
00045 cout, " "));
00046 for (unsigned int j = 0; j < MTSites.GetCommonFrequencies().size(); ++j)
00047 cout << MTSites.GetCommonFrequencies().at(j) << " ";
00048 cout << endl;
00049 MTSites.WriteList(infilename + "_mtt");
00050 }
00051 else
00052 {
00053 cout << "Could not find any files !" << std::endl;
00054 }
00055 }
00056