#include <orsa_file.h>
Inheritance diagram for LocationFile:
Public Member Functions | |
LocationFile () | |
void | Read () |
Vector | ObsPos (const std::string, const Date &) |
void | Open () |
void | Close () |
virtual std::string | GetFileName () const |
virtual void | SetFileName (std::string name_in) |
virtual void | SetFileName (char *name_in) |
Public Attributes | |
std::map< std::string, Location > | locations |
std::list< std::string > | codes |
Protected Attributes | |
std::string | filename |
FILE_TYPE | file |
FILE_STATUS | status |
Definition at line 200 of file orsa_file.h.
LocationFile | ( | ) |
void Read | ( | ) | [virtual] |
Implements ReadFile.
Definition at line 1059 of file orsa_file.cc.
References LocationFile::codes, File::file, orsa::FromUnits(), GETS_FILE, LocationFile::locations, Location::lon, Location::name, ReadFile::Open(), orsa::OPEN_R, ORSA_ERROR, orsa::pi, Location::pxy, Location::pz, orsa::REARTH, orsa::remove_leading_trailing_spaces(), REWIND_FILE, and File::status.
01059 { 01060 01061 Open(); 01062 01063 if (status != OPEN_R) { 01064 ORSA_ERROR("Status error!"); 01065 return; 01066 } 01067 01068 string obscode,longitude,pos_xy,pos_z,name; 01069 01070 char line[300]; 01071 01072 Location dummy_loc; 01073 01074 // dummy_loc.present = true; 01075 01076 REWIND_FILE(file); 01077 01078 string stag, spre="<pre>", spreend="</pre>"; 01079 char tag[256]; 01080 01081 // reach <pre> and skip header 01082 while (GETS_FILE(line,300,file) != 0) { 01083 sscanf(line,"%s",tag); 01084 stag = tag; 01085 if (stag == spre) { 01086 // skip another line (header) and break; 01087 GETS_FILE(line,300,file); 01088 break; 01089 } 01090 } 01091 01092 while (GETS_FILE(line,300,file) != 0) { 01093 01094 sscanf(line,"%s",tag); 01095 stag = tag; 01096 // cerr << "stag: " << stag << endl; 01097 if (stag == spreend) break; 01098 01099 if (strlen(line) < 30) continue; 01100 01101 obscode.assign(line,0,3); 01102 longitude.assign(line,4,8); 01103 pos_xy.assign(line,13,7); 01104 pos_z.assign(line,21,8); 01105 name.assign(line,30,strlen(line)-30-1); // the last -1 is set to avoid the '\n' character in the name 01106 01107 remove_leading_trailing_spaces(longitude); 01108 remove_leading_trailing_spaces(pos_xy); 01109 remove_leading_trailing_spaces(pos_z); 01110 remove_leading_trailing_spaces(name); 01111 01112 // set zero values, for locations like SOHO, HST... 01113 dummy_loc.lon = dummy_loc.pxy = dummy_loc.pz = 0.0; 01114 01115 if (longitude.size()) dummy_loc.lon = (pi/180.0) * atof(longitude.c_str()); 01116 if (pos_xy.size()) dummy_loc.pxy = FromUnits(atof(pos_xy.c_str()),REARTH); 01117 if (pos_z.size()) dummy_loc.pz = FromUnits(atof(pos_z.c_str()), REARTH); 01118 // 01119 dummy_loc.name = name; 01120 01121 locations[obscode] = dummy_loc; 01122 01123 codes.push_back(obscode); 01124 } 01125 01126 }
Here is the call graph for this function:
Referenced by orsa::Compute_Gauss(), orsa::Compute_TestMethod(), and orsa::PropagatedSky_J2000().
void Open | ( | ) | [inherited] |
Definition at line 60 of file orsa_file.cc.
References orsa::CLOSE, File::file, File::filename, OPEN_FILE, orsa::OPEN_R, OPEN_READ, ORSA_ERROR, and File::status.
Referenced by SWIFTFile::AsteroidsInFile(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), and AstorbFile::Read().
00060 { 00061 if (status != CLOSE) return; 00062 00063 file = OPEN_FILE(filename.c_str(),OPEN_READ); 00064 00065 if (file == 0) { 00066 ORSA_ERROR("Can't open file %s",filename.c_str()); 00067 } else { 00068 status = OPEN_R; 00069 } 00070 }
void Close | ( | ) | [inherited] |
Definition at line 115 of file orsa_file.cc.
References orsa::CLOSE, CLOSE_FILE, File::file, and File::status.
Referenced by SWIFTFile::AsteroidsInFile(), ReadWriteFile::Open(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), Config::read_from_file(), File::SetFileName(), OrsaFile::Write(), OrsaConfigFile::Write(), Config::write_to_file(), and File::~File().
virtual std::string GetFileName | ( | ) | const [inline, virtual, inherited] |
Definition at line 99 of file orsa_file.h.
References File::filename.
Referenced by OrsaFile::Read().
00099 { return filename; }
virtual void SetFileName | ( | std::string | name_in | ) | [inline, virtual, inherited] |
Definition at line 101 of file orsa_file.h.
References File::Close(), orsa::CLOSE, File::filename, and File::status.
Referenced by OrsaConfigFile::OrsaConfigFile(), and File::SetFileName().
Here is the call graph for this function:
virtual void SetFileName | ( | char * | name_in | ) | [inline, virtual, inherited] |
Definition at line 106 of file orsa_file.h.
References File::SetFileName().
00106 { 00107 std::string n = name_in; 00108 SetFileName (n); 00109 }
Here is the call graph for this function:
std::list<std::string> codes |
std::string filename [protected, inherited] |
Definition at line 112 of file orsa_file.h.
Referenced by File::GetFileName(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), and File::SetFileName().
FILE_TYPE file [protected, inherited] |
Definition at line 113 of file orsa_file.h.
Referenced by SWIFTFile::AsteroidsInFile(), File::Close(), File::File(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), OrsaFile::Write(), and OrsaConfigFile::Write().
FILE_STATUS status [protected, inherited] |
Definition at line 114 of file orsa_file.h.
Referenced by File::Close(), File::File(), Mercury5IntegrationFile::Mercury5IntegrationFile(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), File::SetFileName(), OrsaFile::Write(), and OrsaConfigFile::Write().