#include <CMTStationList.h>
Collaboration diagram for CMTStationList:

Public Member Functions | |
| tStationList & | GetList () |
| Access to the complete vector of Stations. | |
| void | GetData (const std::string filename) |
| Read a list of filenames and the associated data in those files to fill the list. | |
| void | WriteList (const std::string filename="station.list") |
| Write the names of the sites in the current list to a file. | |
| void | WriteAllData () |
| Write the data of each station to an individual file. | |
| const std::vector< tindexvector > & | GetComFreqIndices () |
| Get a vector that for each site contains the indices to the common frequencies. | |
| const trealdata & | GetCommonFrequencies () |
| Get a vector with frequencies that are common to all sites. | |
| CMTStation & | at (int loc) |
| Get a reference to a site at a given index. | |
| CMTStationList () | |
| virtual | ~CMTStationList () |
Definition at line 11 of file CMTStationList.h.
| CMTStationList::CMTStationList | ( | ) |
| CMTStationList::~CMTStationList | ( | ) | [virtual] |
| tStationList& CMTStationList::GetList | ( | ) | [inline] |
Access to the complete vector of Stations.
Definition at line 23 of file CMTStationList.h.
Referenced by main(), and PrintComponent().
| void CMTStationList::GetData | ( | const std::string | filename | ) |
Read a list of filenames and the associated data in those files to fill the list.
Definition at line 20 of file CMTStationList.cpp.
References CMTStation::GetData(), StationParser::HasLatLong, StationParser::Latitudes, StationParser::Longitudes, CMTStation::SetLatitude(), CMTStation::SetLongitude(), StationParser::stationfile(), and StationParser::Stationnames.
Referenced by main(), and PromptAndReadStationFile().
00021 { 00022 ifstream infile(filename.c_str()); 00023 00024 00025 if (infile) 00026 { 00027 StationLexer lexer(infile); 00028 StationParser parser(lexer); 00029 parser.stationfile(); 00030 for (unsigned int i = 0; i < parser.Stationnames.size(); ++i) 00031 { 00032 cout << "Working on file " << parser.Stationnames.at(i) << endl; 00033 try 00034 { 00035 CMTStation CurrentStation; 00036 CurrentStation.GetData(parser.Stationnames.at(i)); 00037 if (parser.HasLatLong.at(i)) 00038 { 00039 CurrentStation.SetLongitude(parser.Longitudes.at(i)); 00040 CurrentStation.SetLatitude(parser.Latitudes.at(i)); 00041 } 00042 StationData.push_back(CurrentStation); 00043 } 00044 catch(ANTLRException& e) 00045 { 00046 cerr << "File " << parser.Stationnames.at(i) << " not found !" << endl; 00047 } 00048 } 00049 } 00050 else 00051 { 00052 throw CFatalException("File not found: " +filename); 00053 } 00054 FindCommon(); 00055 }
Here is the call graph for this function:

| void CMTStationList::WriteList | ( | const std::string | filename = "station.list" |
) |
Write the names of the sites in the current list to a file.
Definition at line 62 of file CMTStationList.cpp.
Referenced by main().
00063 { 00064 ofstream outfile(filename.c_str()); 00065 for (vector<CMTStation>::iterator CurrentStation = StationData.begin(); CurrentStation != StationData.end(); CurrentStation++) 00066 { 00067 outfile << CurrentStation->GetName(); 00068 outfile << setfill(' ') << setw(15) <<resetiosflags(ios::fixed); 00069 outfile << CurrentStation->GetLongitude() << " "; 00070 outfile << setfill(' ') << setw(15) <<resetiosflags(ios::fixed); 00071 outfile << CurrentStation->GetLatitude(); 00072 outfile << endl; 00073 } 00074 }
| void CMTStationList::WriteAllData | ( | ) |
Write the data of each station to an individual file.
Definition at line 76 of file CMTStationList.cpp.
00077 { 00078 for (std::vector<CMTStation>::iterator CurrentStation = StationData.begin(); CurrentStation != StationData.end(); CurrentStation++) 00079 CurrentStation->WriteBack(); 00080 }
| const std::vector<tindexvector>& CMTStationList::GetComFreqIndices | ( | ) | [inline] |
Get a vector that for each site contains the indices to the common frequencies.
Definition at line 31 of file CMTStationList.h.
Referenced by main(), and PrintComponent().
| const trealdata& CMTStationList::GetCommonFrequencies | ( | ) | [inline] |
Get a vector with frequencies that are common to all sites.
Definition at line 33 of file CMTStationList.h.
Referenced by main(), and PromptAndReadFreqIndex().
| CMTStation & CMTStationList::at | ( | int | loc | ) |
Get a reference to a site at a given index.
Definition at line 57 of file CMTStationList.cpp.
Referenced by main(), and PrintComponent().
1.5.1