casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SDDOnLine.h
Go to the documentation of this file.
00001 //# SDDOnLine.h: a class which encapsulates on-line SDD data files at the 140ft
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_SDDONLINE_H
00030 #define NRAO_SDDONLINE_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 140ft
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 SDDOnLine {
00071 public:
00072     SDDOnLine();
00073     SDDOnLine(const String& sddFileName);
00074     SDDOnLine(const SDDOnLine& other);
00075 
00076     ~SDDOnLine();
00077 
00078     // attach to two new files
00079     void attach(const String& sddFileName);
00080 
00081     // the things we need from the SDDFile
00082     // The index rep for a specific rownr
00083     const SDDIndexRep& index(uInt rownr) const;
00084 
00085     // The header for a specific rownr
00086     const SDDHeader& header(uInt rownr) const;
00087 
00088     // The data array for a specific rownr
00089     Bool getData(Array<Float>& data, uInt rownr) const;
00090 
00091     // The timeStamp for a particular row
00092     Int timeStamp(uInt rownr) const;
00093 
00094     // the offStamp for a particular row
00095     Int offStamp(uInt rownr) const;
00096 
00097     // This just sees if there is a need to sync
00098     Bool needToSync() const;
00099 
00100     // sync with what is on disk, return the number of rows 
00101     Int sync();
00102 
00103     uInt nrow() { return nrow_p; }
00104 
00105 private:
00106     SDDOnLine operator=(const SDDOnLine&);
00107 
00108     Block<Int> timeStamp_p;
00109     SimpleOrderedMap<uInt, Int> offMap_p;
00110 
00111     String sddFileName_p;
00112     SDDFile *sddFile_p;
00113 
00114     uInt nrow_p;
00115 
00116     Block<uInt> rowMap_p;
00117 
00118     void init();
00119     void appendMaps(uInt startSDDEntry);
00120 };
00121 
00122 #endif