casacore
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>
33 #include <casacore/fits/FITS/FITSTable.h>
34 #include <casacore/casa/Containers/Record.h>
35 #include <casacore/casa/Containers/RecordField.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
casacore::FITSTimedTable::time_next_p
RORecordFieldPtr< Double > time_next_p
Definition: FITSTimedTable.h:131
casacore::FITSTimedTable::table_p
FITSTabular * table_p
Definition: FITSTimedTable.h:127
casacore::RecordDesc
Description of the fields in a record object.
Definition: RecordDesc.h:105
casacore::FITSTimedTable::dummyDisps
Record dummyDisps
Definition: FITSTimedTable.h:137
casacore::FITSTimedTable::nextTime
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...
casacore::FITSTimedTable::changePending_p
Bool changePending_p
Definition: FITSTimedTable.h:126
casacore::FITSTimedTable
Definition: FITSTimedTable.h:73
casacore::FITSTimedTable::rowDesc_p
RecordDesc rowDesc_p
Definition: FITSTimedTable.h:132
casacore::TableRecord
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
casacore::FITSTimedTable::keywords
virtual const TableRecord & keywords() const
Returns keywords which are associated with the underlying FITS files.
casacore::FITSTimedTable::~FITSTimedTable
~FITSTimedTable()
casacore::FITSTimedTable::currentTime
Double currentTime() const
What is the time of the current row?
casacore::FITSTimedTable::time_now_p
RORecordFieldPtr< Double > time_now_p
Definition: FITSTimedTable.h:130
casacore::FITSTimedTable::next
virtual void next()
Advance the row if possible (guaranteed harmless if pastEnd() is True.
casacore::FITSTimedTable::dummyUnits
Record dummyUnits
Definition: FITSTimedTable.h:136
casacore::FITSTimedTable::dummyKeywords
TableRecord dummyKeywords
Definition: FITSTimedTable.h:135
casacore::FITSTimedTable::resetChangedFlag
virtual void resetChangedFlag()
reset the changed flag, default do nothing
Definition: FITSTimedTable.h:97
casacore::FITSTimedTable::pastEnd
virtual Bool pastEnd() const
Returns True if we have advanced past the end of data.
casacore::FITSTimedTable::row_next_p
Record * row_next_p
Definition: FITSTimedTable.h:129
casacore::FITSTimedTable::description
virtual const RecordDesc & description() const
Returns the description of the underlying FITS table.
casacore::FITSTimedTable::ok
Bool ok() const
this is True if the last setTime() finished as expected It is False only if the requested time is bef...
Definition: FITSTimedTable.h:117
casacore::Double
double Double
Definition: aipstype.h:55
casacore::FITSTimedTable::ok_p
Bool ok_p
Definition: FITSTimedTable.h:124
casacore::FITSTimedTable::hasChanged_p
Bool hasChanged_p
Definition: FITSTimedTable.h:125
casacore::False
const Bool False
Definition: aipstype.h:44
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::FITSTimedTable::name
virtual const String & name() const
return the name
Definition: FITSTimedTable.h:98
casacore::FITSTimedTable::isValid
virtual Bool isValid() const
isValid() returns False if this object isn't a valid Tabular data structure.
casacore::FITSTimedTable::initNextRecord
void initNextRecord(const RecordDesc &desc)
casacore::FITSTabular::name
virtual const String & name() const =0
return the name
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::FITSTimedTable::currentRow
virtual const Record & currentRow() const
Return the currentRow.
casacore::FITSTimedTable::initNowRecord
void initNowRecord(const RecordDesc &desc)
casacore::time
TableExprNode time(const TableExprNode &node)
Definition: ExprNode.h:1537
casacore::FITSTimedTable::atStart_p
Bool atStart_p
Definition: FITSTimedTable.h:123
casacore::FITSTimedTable::how_past_end_p
Int how_past_end_p
Definition: FITSTimedTable.h:133
casacore::FITSTimedTable::FITSTimedTable
FITSTimedTable()
This is not connected to any data, isValid always returns True, keywords and description return the d...
casacore::RORecordFieldPtr< Double >
casacore::String
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::FITSTimedTable::nulls
virtual const Record & nulls() const
Returns any TNULLnnn associated with a column (the field names are the column names,...
casacore::FITSTimedTable::setTime
virtual void setTime(Double time)
interpolate to the desired time which must be >= the currentTime() This uses a linear interpolation b...
casacore::Record
A hierarchical collection of named fields of various types.
Definition: Record.h:180
casacore::FITSTabular
Simplified interface to FITS tables with Casacore Look and Feel.
Definition: FITSTable.h:80
casacore::FITSTimedTable::units
virtual const Record & units() const
Returns any TUNITnnn associated with a column (the field names are the column names,...
casacore::FITSTimedTable::displayFormats
virtual const Record & displayFormats() const
Returns any TDISPnnn associated with a column (the field names are the column names,...
casacore::FITSTimedTable::timeColumn_p
uInt timeColumn_p
Definition: FITSTimedTable.h:134
casacore::FITSTimedTable::dummyNulls
Record dummyNulls
Definition: FITSTimedTable.h:138
casacore::FITSTimedTable::hasChanged
virtual Bool hasChanged() const
Has the description changed since construction, default is False.
Definition: FITSTimedTable.h:96
casacore::FITSTimedTable::row_now_p
Record * row_now_p
Definition: FITSTimedTable.h:128