casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GBTDAPFile.h
Go to the documentation of this file.
00001 //# GBTDAPFile.h: GBTDAPFile is a FITSTable holding GBT DAP info
00002 //# Copyright (C) 1999,2000
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef NRAO_GBTDAPFILE_H
00030 #define NRAO_GBTDAPFILE_H
00031 
00032 //#! Includes go here
00033 
00034 #include <casa/aips.h>
00035 #include <casa/Arrays/Vector.h>
00036 #include <casa/Quanta/MVTime.h>
00037 #include <casa/BasicSL/String.h>
00038 #include <fits/FITS/FITSTable.h>
00039 #include <casa/Containers/RecordField.h>
00040 
00041 #include <casa/namespace.h>
00042 //# Forward Declarations
00043 namespace casa { //# NAMESPACE CASA - BEGIN
00044 class Record;
00045 class CopyRecordToRecord;
00046 } //# NAMESPACE CASA - END
00047 
00048 
00049 // <summary>
00050 // </summary>
00051 
00052 // <use visibility=export>
00053 
00054 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00055 // </reviewed>
00056 
00057 // <prerequisite>
00058 // </prerequisite>
00059 //
00060 // <etymology>
00061 // </etymology>
00062 //
00063 // <synopsis>
00064 // </synopsis>
00065 //
00066 // <example>
00067 // </example>
00068 //
00069 // <motivation>
00070 // </motivation>
00071 //
00072 //
00073 // <thrown>
00074 //#! A list of exceptions thrown if errors are discovered in the function.
00075 //#! This tag will appear in the body of the header file, preceding the
00076 //#! declaration of each function which throws an exception.
00077 //    <li>
00078 //    <li>
00079 // </thrown>
00080 //
00081 // <todo asof="yyyy/mm/dd">
00082 // </todo>
00083 
00084 class GBTDAPFile : public FITSTable
00085 {
00086 public:
00087 
00088     GBTDAPFile(const String &dapfile, const MVTime &startTime);
00089     ~GBTDAPFile() {cleanup();}
00090 
00091     virtual Bool reopen(const String &dapfile, const MVTime &startTime, Bool resync);
00092     // the default reopen is a reopen with resync=True
00093     virtual Bool reopen(const String &dapfile) {return reopen(dapfile, Double(0.0), True);}
00094     virtual Bool isValid() const {return dmjd_p.isAttached();}
00095     virtual void next();
00096     virtual const Record &currentRow() const {return *currentRow_p;}
00097     virtual Bool pastEnd() const 
00098         { return (!isValid() || FITSTable::pastEnd() && currentTime_p == endOfTime_p);}
00099     virtual Int rownr() const {return row_nr_p;}
00100     virtual void move(Int torow);
00101 
00102     virtual const MVTime &currentTime() const {return currentTime_p;}
00103     virtual const MVTime &nextTime() const {return nextTime_p;}
00104 
00105     // the interval between nextTime() and currentTime()
00106     // if the currentTime is the end of the row, the interval is the last row
00107     // if there is only 1 row, the interval is zero
00108     virtual Double interval() const {return interval_p;}
00109 
00110     const String& manager() const { return manager_p;}
00111     const String& sampler() const { return sampler_p;}
00112 
00113     virtual void handleField(const String &fieldName);
00114 
00115     virtual const Record &unhandledFields()
00116     {
00117         if (!unhandledFields_p) initUnhandledFields();
00118         return *unhandledFields_p;
00119     }
00120 
00121 private:
00122     Bool timeWarningIssued_p;
00123 
00124     String manager_p, sampler_p;
00125 
00126     Record *currentRow_p;
00127 
00128     MVTime currentTime_p, nextTime_p, endOfTime_p;
00129 
00130     Double interval_p;
00131 
00132     RORecordFieldPtr<Double> dmjd_p;
00133 
00134     Int row_nr_p;
00135 
00136     Record *unhandledFields_p;
00137     CopyRecordToRecord *fieldCopier_p;
00138     Vector<Int> fieldMap_p;
00139 
00140     void cleanup();
00141     void init();
00142 
00143     void initUnhandledFields();
00144 
00145     // unavailable
00146     GBTDAPFile();
00147     GBTDAPFile(const GBTDAPFile &other);
00148     GBTDAPFile &operator=(const GBTDAPFile &other);
00149 };
00150 
00151 #endif
00152 
00153