casa
$Rev:20696$
|
00001 //# FITSMultiTable.h: View multiple FITS files as a single table 00002 //# Copyright (C) 1995,1996,1997 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: FITSMultiTable.h 20299 2008-04-03 05:56:44Z gervandiepen $ 00028 00029 #ifndef FITS_FITSMULTITABLE_H 00030 #define FITS_FITSMULTITABLE_H 00031 00032 #include <casa/aips.h> 00033 #include <fits/FITS/FITSTable.h> 00034 #include <casa/OS/Time.h> 00035 #include <casa/BasicSL/String.h> 00036 #include <casa/Arrays/Vector.h> 00037 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 00040 // <summary> 00041 // View multiple FITS files as a single table 00042 // </summary> 00043 00044 // <use visibility=local> 00045 00046 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00047 // </reviewed> 00048 00049 // <synopsis> 00050 // A FITSMultiTable is used to view a collection of FITS files on disk as a 00051 // single Table. That is, when next() is called, when one Table ends the next 00052 // is reopened until all files are exhausted. The FITS files must all have the 00053 // same description. Something clever should be done about the keywords. 00054 // </synopsis> 00055 // 00056 // <example> 00057 // </example> 00058 // 00059 // <motivation> 00060 // </motivation> 00061 // 00062 // <todo asof="yyyy/mm/dd"> 00063 // </todo> 00064 00065 class FITSMultiTable : public FITSTabular 00066 { 00067 public: 00068 // The FITS files associated with the fileNames must all have the same 00069 // description, the second argument is a function to generate the 00070 // FITSTabular If not specified, a generic FITSTable is assumed. 00071 // The returned pointer IS controlled by this object. 00072 FITSMultiTable(const Vector<String> &fileNames, 00073 FITSTabular* (*tabMaker)(const String &) = 0); 00074 ~FITSMultiTable(); 00075 00076 virtual Bool isValid() const; 00077 virtual const TableRecord &keywords() const; 00078 virtual const RecordDesc &description() const; 00079 virtual const Record &units() const; 00080 virtual const Record &displayFormats() const; 00081 virtual const Record &nulls() const; 00082 00083 virtual const String &name() const { return table_p->name(); } 00084 00085 // Only returns True when all files are exhausted. 00086 virtual Bool pastEnd() const; 00087 // When end of data is hit on the current file, the next file is opened 00088 // automatically. 00089 virtual void next(); 00090 virtual const Record ¤tRow() const; 00091 00092 // get the list of file names 00093 const Vector<String>& fileNames() const { return file_names_p;} 00094 00095 // Has the descriptor changed from when the file was opened 00096 virtual Bool hasChanged() const { return hasChanged_p;} 00097 00098 // set hasChanged to False - used after hasChanged has been checked 00099 void resetChangedFlag() { hasChanged_p = False;} 00100 00101 // A helper function to generate a list of fileNames. This function returns 00102 // all the files in "directoryName" which have the form 00103 // yyyy_mm_dd_hh:mm:ss_*.fits and which are (even partially) 00104 // in the time range specified by startTime and endTime. It is used to 00105 // generate a set of file names for use in the FITSMultiTable constructor. 00106 // If verboseStatus is True, some status messages appear on cout. 00107 // If verboseErrors is True improperly named files names (not matching the above 00108 // pattern) are named on cerrt. 00109 static Vector<String> filesInTimeRange(const String &directoryName, 00110 const Time &startTime, const Time &endTime, 00111 Bool verboseErrors = False, 00112 Bool verboseStatus = False); 00113 // return the time as found in the given string using the form given above 00114 // There are no sanity checks in this subroutine 00115 static Time timeFromFile(const String &fileName); 00116 00117 private: 00118 // Undefined and inaccessible 00119 FITSMultiTable(); 00120 FITSMultiTable(const FITSMultiTable &other); 00121 FITSMultiTable &operator=(const FITSMultiTable &other); 00122 00123 FITSTabular *table_p; 00124 00125 Vector<String> file_names_p; 00126 uInt nfiles_p; 00127 uInt which_file_p; 00128 Bool hasChanged_p; 00129 00130 Record row_p; 00131 00132 FITSTabular* defaultMaker(const String& fileName); 00133 }; 00134 00135 00136 } //# NAMESPACE CASA - END 00137 00138 #endif