RWOFile Class Reference

AstDyS observation file, usually with a .rwo extension. More...

#include <orsa_file.h>

Inheritance diagram for RWOFile:

Inheritance graph
[legend]
Collaboration diagram for RWOFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RWOFile ()
 AstDyS observation file, usually with a .rwo extension.
void Read ()
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::vector< Observationobs

Protected Attributes

std::string filename
FILE_TYPE file
FILE_STATUS status

Detailed Description

AstDyS observation file, usually with a .rwo extension.

Definition at line 238 of file orsa_file.h.


Constructor & Destructor Documentation

RWOFile  ) 
 

AstDyS observation file, usually with a .rwo extension.

Definition at line 986 of file orsa_file.cc.

00986 { }


Member Function Documentation

void Close  )  [inherited]
 

Definition at line 114 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().

00114                    {
00115     if (status != CLOSE) {
00116       CLOSE_FILE(file);
00117       status = CLOSE;
00118     }
00119   }

virtual std::string GetFileName  )  const [inline, virtual, inherited]
 

Definition at line 99 of file orsa_file.h.

References File::filename.

Referenced by LocationFile::ObsPos(), and OrsaFile::Read().

00099 { return filename; }

void Open  )  [inherited]
 

Definition at line 59 of file orsa_file.cc.

References orsa::CLOSE, OPEN_FILE, orsa::OPEN_R, OPEN_READ, and ORSA_ERROR.

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().

00059                       {
00060     if (status != CLOSE) return;
00061     
00062     file = OPEN_FILE(filename.c_str(),OPEN_READ);
00063     
00064     if (file == 0) { 
00065       ORSA_ERROR("Can't open file %s",filename.c_str());
00066     } else {
00067       status = OPEN_R;
00068     }
00069   }

void Read  )  [virtual]
 

Implements ReadFile.

Definition at line 988 of file orsa_file.cc.

References Observation::date, Observation::dec, Observation::designation, GETS_FILE, RWOFile::obs, Observation::obscode, ReadFile::Open(), Observation::ra, orsa::remove_leading_trailing_spaces(), REWIND_FILE, Angle::SetDPS(), Date::SetGregor(), Angle::SetHMS(), and orsa::UTC.

00988                      {
00989     
00990     Open();
00991     
00992     obs.clear();
00993     
00994     REWIND_FILE(file);
00995     
00996     Observation dummy_obs;
00997     // dummy_obs.date.SetTimeScale(UTC); // checked, is UTC
00998     
00999     double y,m,d,p,s,h;
01000     
01001     char line[256];
01002     
01003     string designation;
01004     string date,ra,dec;
01005     string observatory_code;
01006     
01007     while (GETS_FILE(line,256,file) != 0) {
01008       
01009       // if (strlen(line) < 45) continue; // not a good line, maybe a comment or a white line...
01010       if (strlen(line) < 130) continue; // not a good line, maybe a comment or a white line... NOTE: radar observations are not read now, and have shorter lines
01011       if (line[0] == '!')     continue; // comment/header line
01012       
01013       designation.assign(line,1,9); 
01014       remove_leading_trailing_spaces(designation);
01015       
01016       date.assign(line,15,17);
01017       
01018       ra.assign(line,34,12);
01019       
01020       dec.assign(line,63,12);
01021       
01022       observatory_code.assign(line,114,3);
01023       remove_leading_trailing_spaces(observatory_code);
01024       
01025       dummy_obs.designation        = designation;
01026       // dummy_obs.discovery_asterisk = discovery_asterisk;
01027       // dummy_obs.obscode            = atoi(observatory_code.c_str());
01028       dummy_obs.obscode            = observatory_code;
01029       
01030       /* sscanf(magnitude.c_str(),"%lf",&tmp);
01031          dummy_obs.mag = tmp;
01032       */
01033       
01034      
01035       sscanf(date.c_str(),"%lf %lf %lf",&y,&m,&d);
01036       dummy_obs.date.SetGregor((int)y,(int)m,d,UTC);
01037       
01038       sscanf(ra.c_str(),"%lf %lf %lf",&h,&m,&s);
01039       dummy_obs.ra.SetHMS(h,m,s);
01040       
01041       sscanf(dec.c_str(),"%lf %lf %lf",&d,&p,&s);
01042       dummy_obs.dec.SetDPS(d,p,s);
01043       
01044       //check for a good observation
01045       if ((designation != "") && 
01046           (observatory_code != "") ) {
01047         obs.push_back(dummy_obs);
01048       }
01049       
01050     }
01051     
01052   }

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:

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().

00101                                                         {
00102       if (status != CLOSE) Close();
00103       filename = name_in;
00104     }

Here is the call graph for this function:


Member Data Documentation

FILE_TYPE file [protected, inherited]
 

Definition at line 113 of file orsa_file.h.

Referenced by File::Close(), and File::File().

std::string filename [protected, inherited]
 

Definition at line 112 of file orsa_file.h.

Referenced by File::GetFileName(), and File::SetFileName().

std::vector<Observation> obs
 

Definition at line 246 of file orsa_file.h.

Referenced by RWOFile::Read().

FILE_STATUS status [protected, inherited]
 

Definition at line 114 of file orsa_file.h.

Referenced by File::Close(), File::File(), and File::SetFileName().


The documentation for this class was generated from the following files:
Generated on Tue Jan 11 15:28:23 2005 for liborsa by  doxygen 1.4.0