casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FITSMultiTable.h
Go to the documentation of this file.
1 //# FITSMultiTable.h: View multiple FITS files as a single table
2 //# Copyright (C) 1995,1996,1997
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef FITS_FITSMULTITABLE_H
30 #define FITS_FITSMULTITABLE_H
31 
32 #include <casacore/casa/aips.h>
34 #include <casacore/casa/OS/Time.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 // <summary>
41 // View multiple FITS files as a single table
42 // </summary>
43 
44 // <use visibility=local>
45 
46 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
47 // </reviewed>
48 
49 // <synopsis>
50 // A FITSMultiTable is used to view a collection of FITS files on disk as a
51 // single Table. That is, when next() is called, when one Table ends the next
52 // is reopened until all files are exhausted. The FITS files must all have the
53 // same description. Something clever should be done about the keywords.
54 // </synopsis>
55 //
56 // <example>
57 // </example>
58 //
59 // <motivation>
60 // </motivation>
61 //
62 // <todo asof="yyyy/mm/dd">
63 // </todo>
64 
66 {
67 public:
68  // The FITS files associated with the fileNames must all have the same
69  // description, the second argument is a function to generate the
70  // FITSTabular If not specified, a generic FITSTable is assumed.
71  // The returned pointer IS controlled by this object.
73  FITSTabular* (*tabMaker)(const String &) = 0);
75 
76  virtual Bool isValid() const;
77  virtual const TableRecord &keywords() const;
78  virtual const RecordDesc &description() const;
79  virtual const Record &units() const;
80  virtual const Record &displayFormats() const;
81  virtual const Record &nulls() const;
82 
83  virtual const String &name() const { return table_p->name(); }
84 
85  // Only returns True when all files are exhausted.
86  virtual Bool pastEnd() const;
87  // When end of data is hit on the current file, the next file is opened
88  // automatically.
89  virtual void next();
90  virtual const Record &currentRow() const;
91 
92  // get the list of file names
93  const Vector<String>& fileNames() const { return file_names_p;}
94 
95  // Has the descriptor changed from when the file was opened
96  virtual Bool hasChanged() const { return hasChanged_p;}
97 
98  // set hasChanged to False - used after hasChanged has been checked
100 
101  // A helper function to generate a list of fileNames. This function returns
102  // all the files in "directoryName" which have the form
103  // yyyy_mm_dd_hh:mm:ss_*.fits and which are (even partially)
104  // in the time range specified by startTime and endTime. It is used to
105  // generate a set of file names for use in the FITSMultiTable constructor.
106  // If verboseStatus is True, some status messages appear on cout.
107  // If verboseErrors is True improperly named files names (not matching the above
108  // pattern) are named on cerrt.
109  static Vector<String> filesInTimeRange(const String &directoryName,
110  const Time &startTime, const Time &endTime,
111  Bool verboseErrors = False,
112  Bool verboseStatus = False);
113  // return the time as found in the given string using the form given above
114  // There are no sanity checks in this subroutine
115  static Time timeFromFile(const String &fileName);
116 
117 private:
118  // Undefined and inaccessible
119  FITSMultiTable();
120  FITSMultiTable(const FITSMultiTable &other);
121  FITSMultiTable &operator=(const FITSMultiTable &other);
122 
124 
129 
131 
132  FITSTabular* defaultMaker(const String& fileName);
133 };
134 
135 
136 } //# NAMESPACE CASACORE - END
137 
138 #endif
virtual const Record & currentRow() const
Return the currentRow.
A 1-D Specialization of the Array class.
static Vector< String > filesInTimeRange(const String &directoryName, const Time &startTime, const Time &endTime, Bool verboseErrors=False, Bool verboseStatus=False)
A helper function to generate a list of fileNames.
void resetChangedFlag()
set hasChanged to False - used after hasChanged has been checked
virtual const TableRecord & keywords() const
Returns keywords which are associated with the underlying FITS files.
virtual const String & name() const
return the name
Vector< String > file_names_p
virtual const Record & nulls() const
Returns any TNULLnnn associated with a column (the field names are the column names, each field value is the TNULLnnn value for that field).
virtual const RecordDesc & description() const
Returns the description of the underlying FITS table.
static Time timeFromFile(const String &fileName)
return the time as found in the given string using the form given above There are no sanity checks in...
Description of the fields in a record object.
Definition: RecordDesc.h:105
virtual Bool isValid() const
isValid() returns False if this object isn&#39;t a valid Tabular data structure.
date and time enquiry functions, with some operations.
Definition: Time.h:88
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
virtual Bool hasChanged() const
Has the descriptor changed from when the file was opened.
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
virtual const Record & displayFormats() const
Returns any TDISPnnn associated with a column (the field names are the column names, each field value is the TDISPnnn value for that field).
virtual const String & name() const =0
return the name
virtual void next()
When end of data is hit on the current file, the next file is opened automatically.
View multiple FITS files as a single table.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual Bool pastEnd() const
Only returns True when all files are exhausted.
FITSMultiTable()
Undefined and inaccessible.
const Vector< String > & fileNames() const
get the list of file names
virtual const Record & units() const
Returns any TUNITnnn associated with a column (the field names are the column names, each field value is the TUNITnnn value for that field).
FITSMultiTable & operator=(const FITSMultiTable &other)
unsigned int uInt
Definition: aipstype.h:51
FITSTabular * defaultMaker(const String &fileName)
Simplified interface to FITS tables with Casacore Look and Feel.
Definition: FITSTable.h:80
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42