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 987 of file orsa_file.cc.

00987 { }


Member Function Documentation

void Read (  )  [virtual]

Implements ReadFile.

Definition at line 989 of file orsa_file.cc.

References Observation::date, Observation::dec, Observation::designation, File::file, 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.

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

Here is the call graph for this function:

void Open (  )  [inherited]

void Close (  )  [inherited]

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

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

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:


Member Data Documentation

std::vector<Observation> obs

Definition at line 246 of file orsa_file.h.

Referenced by RWOFile::Read().

std::string filename [protected, inherited]

FILE_TYPE file [protected, inherited]

FILE_STATUS status [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Thu Feb 14 21:41:45 2008 for liborsa by  doxygen 1.5.5