2 #include "StationParser.h"
9 SeismicStationList::SeismicStationList()
13 SeismicStationList::~SeismicStationList()
17 void SeismicStationList::ReadList(
const std::string filename)
19 ifstream infile(filename.c_str());
24 parser.ParseFile(infile);
25 for (
unsigned int i = 0; i < parser.Stationnames.size(); ++i)
28 cout <<
"Working on file " << parser.Stationnames.at(i) << endl;
30 boost::shared_ptr<SeismicDataComp> CurrentStation(
33 CurrentStation->ReadData(parser.Stationnames.at(i));
35 if (parser.HasLatLong.at(i))
38 CurrentStation->SetStLo(parser.Longitudes.at(i));
39 CurrentStation->SetStLa(parser.Latitudes.at(i));
41 StationList.push_back(CurrentStation);
46 throw(
"File not found: " + filename);
50 void SeismicStationList::WriteList(
const std::string filename)
52 ofstream outfile(filename.c_str());
54 for (tseiscompvector::iterator CurrentStation = StationList.begin(); CurrentStation
55 != StationList.end(); CurrentStation++)
58 outfile << CurrentStation->get()->GetName();
59 outfile << setfill(
' ') << setw(15) << resetiosflags(ios::fixed);
60 outfile << CurrentStation->get()->GetStLo() <<
" ";
61 outfile << setfill(
' ') << setw(15) << resetiosflags(ios::fixed);
62 outfile << CurrentStation->get()->GetStLa();
67 void SeismicStationList::WriteAllData()
71 for (tseiscompvector::iterator CurrentStation = StationList.begin(); CurrentStation
72 != StationList.end(); CurrentStation++)
73 CurrentStation->get()->WriteBack();