casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SDD12mOnLine.h
Go to the documentation of this file.
00001 //# SDD12mOnLine.h: a class which encapsulates on-line SDD data files at the 12-m
00002 //# Copyright (C) 1999
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_SDD12MONLINE_H
00030 #define NRAO_SDD12MONLINE_H
00031 
00032 //#! Includes go here
00033 #include <casa/aips.h>
00034 #include <nrao/SDD/SDDFile.h>
00035 #include <nrao/SDD/SDDIndex.h>
00036 #include <casa/BasicSL/String.h>
00037 #include <casa/Containers/SimOrdMap.h>
00038 #include <casa/Containers/OrderedPair.h>
00039 #include <casa/Containers/Block.h>
00040 
00041 #include <casa/namespace.h>
00042 // <summary>
00043 // a class for accessing on-line SDD data files at the 12-m
00044 // </summary>
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 //   <li> SDDFile
00053 //   <li> SDDIndex
00054 //   <li> SDDHeader
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 // </etymology>
00059 //
00060 // <synopsis>
00061 // </synopsis>
00062 //
00063 // <example>
00064 // </example>
00065 //
00066 // <motivation>
00067 // </motivation>
00068 //
00069 
00070 class SDD12mOnLine {
00071 public:
00072     SDD12mOnLine();
00073     SDD12mOnLine(const String& dataFileName, const String& gainFileName);
00074     SDD12mOnLine(const SDD12mOnLine& other);
00075 
00076     ~SDD12mOnLine();
00077 
00078     // attach to two new files
00079     void attach(const String& dataFileName, const String& gainFileName);
00080 
00081     // the things we need from the SDDFiles
00082     // The index rep for a specific rownr
00083     const SDDIndexRep& index(uInt rownr) const;
00084 
00085     // The header for a specific rownr
00086     // values will be correctly modified for OTF data here
00087     // for HSOURCE, VSOURCE, AZ, EL, and UTIME
00088     const SDDHeader& header(uInt rownr) const;
00089 
00090     // The data array for a specific rownr
00091     Bool getData(Array<Float>& data, uInt rownr) const;
00092 
00093     // The timeStamp for a particular row
00094     Int timeStamp(uInt rownr) const;
00095 
00096     // the gainStamp for a particular row
00097     Int gainStamp(uInt rownr) const;
00098 
00099     // the offStamp for a particular row
00100     Int offStamp(uInt rownr) const;
00101 
00102     // The OTF offset for a particular row
00103     // For non-otf data, these should return appropriate values
00104     // 0 for time, ra, dec and the actual AZ and EL for az el
00105     Float time(uInt rownr) const;
00106     Float raOffset(uInt rownr) const;
00107     Float decOffset(uInt rownr) const;
00108     Float az(uInt rownr) const;
00109     Float el(uInt rownr) const;
00110 
00111     // This returns the full range of ra values appropriate for the scan number
00112     // associated with this row
00113     Float raRange(uInt rownr) const;
00114 
00115     // This just sees if there is a need to sync
00116     Bool needToSync() const;
00117 
00118     // sync with what is on disk, return the number of rows 
00119     Int sync();
00120 
00121     uInt nrow() { return nrow_p; }
00122 
00123 private:
00124     SDD12mOnLine operator=(const SDD12mOnLine&);
00125 
00126     Block<Int> timeStamp_p;
00127     SimpleOrderedMap<uInt, Int> offMap_p;
00128     SimpleOrderedMap<uInt, Int> gainMap_p;
00129 
00130     String dataFileName_p, gainFileName_p;
00131     SDDFile *dataFile_p, *gainFile_p;
00132 
00133     uInt nrow_p;
00134 
00135     PtrBlock<SDDFile*> fileMap_p;
00136     Block< OrderedPair<uInt, uInt> > rowMap_p;
00137 
00138     void init();
00139     void appendMaps(uInt startDataEntry, uInt startGainEntry);
00140 };
00141 
00142 #endif