casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FITSTimedTable.h
Go to the documentation of this file.
1 //# FITSTimedTable.h: A Table with a time column
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_FITSTIMEDTABLE_H
30 #define FITS_FITSTIMEDTABLE_H
31 
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 // <summary>
40 // </summary>
41 
42 // <use visibility=export>
43 
44 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
45 // </reviewed>
46 
47 // <prerequisite>
48 // <li>
49 // </prerequisite>
50 //
51 // <etymology>
52 // </etymology>
53 //
54 // <synopsis>
55 // FITSTimedTable is used to look at FITS tables which have a time column. In
56 // particular, it peeks ahead, and knows the time of the currentRow and of the
57 // nextRow.
58 //
59 // It is constructed with a pointer to any FITSTabular. Presently, no memory
60 // management is imposed to ensure that the pointer remains valid.
61 // </synopsis>
62 //
63 // <example>
64 // </example>
65 //
66 // <motivation>
67 // </motivation>
68 //
69 // <todo asof="1995/06/01">
70 // <li>
71 // </todo>
72 
74 {
75 public:
76  // This is not connected to any data, isValid always returns True,
77  // keywords and description return the default versions
78  // hasChanged returns False, name returns an empty string
79  // pastEnd returns False and next does nothing.
80  // setTime does nothing, currentRow returns an empty record
81  // and currentTime returns 0.0
82  // and ok returns True and nextTime returns 0.0
84  // Note, originalTable cannot be destructed, reopened, ...,during the
85  // lifetime of this object.
86  FITSTimedTable(FITSTabular *originalTable, uInt whichColumnIsTime=0);
88 
89  virtual Bool isValid() const;
90  virtual const TableRecord &keywords() const;
91  virtual const RecordDesc &description() const;
92  virtual const Record &units() const;
93  virtual const Record &displayFormats() const;
94  virtual const Record &nulls() const;
95 
96  virtual Bool hasChanged() const { return hasChanged_p;}
97  virtual void resetChangedFlag() { hasChanged_p = False; }
98  virtual const String &name() const { return table_p->name(); }
99  virtual Bool pastEnd() const;
100  virtual Bool pastEnd();
101  virtual void next();
102  // interpolate to the desired time which must be >= the currentTime()
103  // This uses a linear interpolation between adjacent floating point values.
104  // Non-floating point values are NOT interpolated but have the value of the
105  // most recent actual row. On the last row of the table, not interpolation
106  // is done.
107  virtual void setTime(Double time);
108  virtual const Record &currentRow() const;
109  virtual Record &currentRow();
110 
111  // What is the time of the current row?
112  Double currentTime() const;
113 
114  // this is True if the last setTime() finished as expected
115  // It is False only if the requested time is before the current time
116  // and the timed table as just been opened
117  Bool ok() const { return ok_p;}
118 
119  // What will the time of the next row be? Returns a very large number if
120  // it is past the end of the table.
121  Double nextTime();
122 private:
139 
140  void initNowRecord(const RecordDesc& desc);
141  void initNextRecord(const RecordDesc& desc);
142 };
143 
144 } //# NAMESPACE CASACORE - END
145 
146 #endif
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).
int Int
Definition: aipstype.h:50
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).
virtual Bool isValid() const
isValid() returns False if this object isn&#39;t a valid Tabular data structure.
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1580
virtual void next()
Advance the row if possible (guaranteed harmless if pastEnd() is True.
Double nextTime()
What will the time of the next row be? Returns a very large number if it is past the end of the table...
virtual Bool pastEnd() const
Returns True if we have advanced past the end of data.
virtual Bool hasChanged() const
Has the description changed since construction, default is False.
virtual const Record & currentRow() const
Return the currentRow.
virtual void resetChangedFlag()
reset the changed flag, default do nothing
Double currentTime() const
What is the time of the current row?
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 TableRecord & keywords() const
Returns keywords which are associated with the underlying FITS files.
RORecordFieldPtr< Double > time_now_p
virtual const String & name() const
return the name
virtual const RecordDesc & description() const
Returns the description of the underlying FITS table.
Description of the fields in a record object.
Definition: RecordDesc.h:105
double Double
Definition: aipstype.h:55
void initNextRecord(const RecordDesc &desc)
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
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
virtual const String & name() const =0
return the name
Bool ok() const
this is True if the last setTime() finished as expected It is False only if the requested time is bef...
FITSTimedTable()
This is not connected to any data, isValid always returns True, keywords and description return the d...
String: the storage and methods of handling collections of characters.
Definition: String.h:225
void initNowRecord(const RecordDesc &desc)
RORecordFieldPtr< Double > time_next_p
virtual void setTime(Double time)
interpolate to the desired time which must be &gt;= the currentTime() This uses a linear interpolation b...
unsigned int uInt
Definition: aipstype.h:51
Simplified interface to FITS tables with Casacore Look and Feel.
Definition: FITSTable.h:80