casacore
MSWeatherColumns.h
Go to the documentation of this file.
1 //# MSWeatherColumns.h: provides easy access to MSWeather columns
2 //# Copyright (C) 1996,1999,2000
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 //# $Id$
27 
28 #ifndef MS_MSWEATHERCOLUMNS_H
29 #define MS_MSWEATHERCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/measures/Measures/MEpoch.h>
33 #include <casacore/measures/Measures/MCEpoch.h>
34 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
35 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
36 #include <casacore/tables/Tables/ScalarColumn.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 class MSWeather;
41 
42 // <summary>
43 // A class to provide easy access to MSWeather columns
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> MSWeather
53 // <li> ArrayColumn
54 // <li> ScalarColumn
55 // </prerequisite>
56 //
57 // <etymology>
58 // MSWeatherColumns stands for MeasurementSet Weather Table columns.
59 // </etymology>
60 //
61 // <synopsis>
62 // This class provides access to the columns in the MSWeather Table,
63 // it does the declaration of all the Scalar and ArrayColumns with the
64 // correct types, so the application programmer doesn't have to
65 // worry about getting those right. There is an access function
66 // for every predefined column. Access to non-predefined columns will still
67 // have to be done with explicit declarations.
68 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
69 // </synopsis>
70 //
71 // <motivation>
72 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
73 // </motivation>
74 
76 {
77 public:
78  // Create a columns object that accesses the data in the specified Table
79  MSWeatherColumns(const MSWeather& msWeather);
80 
81  // The destructor does nothing special
83 
84  // Is this object defined? (MSWeather table is optional)
85  Bool isNull() const {return isNull_p;}
86 
87  // Access to required columns
88  // <group>
95  // </group>
96 
97  // Access to optional columns
98  // <group>
122  // </group>
123 
124  // Const access to columns
125  // <group>
126  const ScalarColumn<Int>& antennaId() const {return antennaId_p;}
127  const ScalarColumn<Double>& interval() const {return interval_p;}
129  return intervalQuant_p;}
130  const ScalarColumn<Double>& time() const {return time_p;}
133  // </group>
134 
135  // Access to optional columns
136  // <group>
137  const ScalarColumn<Float>& dewPoint() const {return dewPoint_p;}
139  return dewPointQuant_p;}
141  const ScalarColumn<Float>& H2O() const {return H2O_p;}
142  const ScalarColumn<Bool>& H2OFlag() const {return H2OFlag_p;}
146  return ionosElectronQuant_p;}
148  return ionosElectronFlag_p;}
149  const ScalarColumn<Float>& pressure() const {return pressure_p;}
151  return pressureQuant_p;}
155  return relHumidityFlag_p;}
158  return temperatureQuant_p;}
160  return temperatureFlag_p;}
163  return windDirectionQuant_p;}
165  return windDirectionFlag_p;}
166  const ScalarColumn<Float>& windSpeed() const {return windSpeed_p;}
168  return windSpeedQuant_p;}
170  // </group>
171 
172  // Convenience function that returns the number of rows in any of the
173  // columns. Returns zero if the object is null.
174  rownr_t nrow() const {return isNull() ? 0 : antennaId_p.nrow();}
175 
176  // set the epoch type for the TIME column.
177  // <note role=tip>
178  // In principle this function can only be used if the table is empty,
179  // otherwise already written values may thereafter have an incorrect
180  // reference, offset, or unit. However, it is possible that part of the
181  // table gets written before these values are known. In that case the
182  // reference, offset, or units can be set by using a False
183  // <src>tableMustBeEmpty</src> argument.
184  // </note>
185  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
186 
187 protected:
188  //# default constructor creates a object that is not usable. Use the attach
189  //# function correct this.
191 
192  //# attach this object to the supplied table.
193  void attach(const MSWeather& msWeather);
194 
195 private:
196  //# Make the assignment operator and the copy constructor private to prevent
197  //# any compiler generated one from being used.
200 
201  //# Check if any optional columns exist and if so attach them.
202  void attachOptionalCols(const MSWeather& msWeather);
203 
204  //# Is the object not attached to a Table.
206 
207  //# required columns
211  //# optional columns
228 
229  //# Access to Measure columns
231 
232  //# Access to Quantum columns
235  //# optional Quantum columns
243 };
244 
245 //# Define the RO version for backward compatibility.
247 
248 } //# NAMESPACE CASACORE - END
249 
250 #endif
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarColumn< Bool > windDirectionFlag_p
const ScalarColumn< Bool > & windSpeedFlag() const
const ScalarColumn< Float > & windSpeed() const
const ScalarQuantColumn< Double > & timeQuant() const
ScalarQuantColumn< Float > & pressureQuant()
ScalarColumn< Float > & dewPoint()
Access to optional columns.
ScalarColumn< Double > time_p
ScalarColumn< Float > & windSpeed()
ScalarQuantColumn< Float > pressureQuant_p
Bool isNull() const
Is this object defined? (MSWeather table is optional)
ScalarQuantColumn< Double > & timeQuant()
ScalarColumn< Bool > dewPointFlag_p
const ScalarQuantColumn< Float > & pressureQuant() const
ScalarColumn< Bool > & dewPointFlag()
const ScalarColumn< Float > & temperature() const
const ScalarQuantColumn< Float > & windDirectionQuant() const
ScalarColumn< Double > interval_p
ScalarColumn< Float > dewPoint_p
const ScalarQuantColumn< Float > & ionosElectronQuant() const
ScalarColumn< Float > & windDirection()
const ScalarColumn< Bool > & ionosElectronFlag() const
void attach(const MSWeather &msWeather)
MSWeatherColumns & operator=(const MSWeatherColumns &)
void attachOptionalCols(const MSWeather &msWeather)
ScalarColumn< Float > relHumidity_p
ScalarQuantColumn< Float > windSpeedQuant_p
const ScalarColumn< Bool > & windDirectionFlag() const
ScalarColumn< Bool > & H2OFlag()
~MSWeatherColumns()
The destructor does nothing special.
const ScalarColumn< Bool > & pressureFlag() const
const ScalarColumn< Bool > & dewPointFlag() const
const ScalarQuantColumn< Double > & intervalQuant() const
const ScalarQuantColumn< Float > & dewPointQuant() const
ScalarColumn< Bool > & temperatureFlag()
MSWeatherColumns(const MSWeatherColumns &)
ScalarColumn< Bool > & windSpeedFlag()
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
const ScalarColumn< Float > & ionosElectron() const
ScalarColumn< Float > & ionosElectron()
ScalarColumn< Double > & time()
const ScalarColumn< Int > & antennaId() const
Const access to columns.
ScalarColumn< Bool > & pressureFlag()
ScalarColumn< Bool > & windDirectionFlag()
ScalarColumn< Float > ionosElectron_p
ScalarQuantColumn< Float > & windDirectionQuant()
ScalarColumn< Float > temperature_p
ScalarColumn< Double > & interval()
const ScalarColumn< Float > & H2O() const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarColumn< Float > pressure_p
ScalarQuantColumn< Float > & dewPointQuant()
ScalarColumn< Float > windSpeed_p
ScalarColumn< Float > & temperature()
const ScalarColumn< Double > & time() const
const ScalarQuantColumn< Float > & windSpeedQuant() const
const ScalarMeasColumn< MEpoch > & timeMeas() const
ScalarColumn< Float > H2O_p
ScalarColumn< Float > & H2O()
ScalarQuantColumn< Float > dewPointQuant_p
ScalarMeasColumn< MEpoch > & timeMeas()
ScalarQuantColumn< Float > & windSpeedQuant()
ScalarColumn< Bool > H2OFlag_p
const ScalarColumn< Float > & relHumidity() const
ScalarColumn< Float > windDirection_p
ScalarQuantColumn< Double > timeQuant_p
ScalarQuantColumn< Float > ionosElectronQuant_p
ScalarQuantColumn< Float > & H2OQuant()
ScalarQuantColumn< Float > H2OQuant_p
ScalarColumn< Float > & relHumidity()
ScalarColumn< Bool > ionosElectronFlag_p
ScalarQuantColumn< Double > & intervalQuant()
ScalarColumn< Int > antennaId_p
ScalarQuantColumn< Float > & ionosElectronQuant()
const ScalarQuantColumn< Float > & H2OQuant() const
ScalarColumn< Bool > pressureFlag_p
const ScalarColumn< Bool > & relHumidityFlag() const
ScalarColumn< Bool > windSpeedFlag_p
const ScalarColumn< Float > & windDirection() const
const ScalarColumn< Float > & pressure() const
const ScalarColumn< Double > & interval() const
const ScalarQuantColumn< Float > & temperatureQuant() const
ScalarQuantColumn< Double > intervalQuant_p
ScalarQuantColumn< Float > temperatureQuant_p
ScalarColumn< Bool > temperatureFlag_p
const ScalarColumn< Bool > & temperatureFlag() const
ScalarColumn< Bool > relHumidityFlag_p
ScalarMeasColumn< MEpoch > timeMeas_p
MSWeatherColumns(const MSWeather &msWeather)
Create a columns object that accesses the data in the specified Table.
ScalarQuantColumn< Float > windDirectionQuant_p
const ScalarColumn< Bool > & H2OFlag() const
ScalarColumn< Float > & pressure()
ScalarColumn< Bool > & relHumidityFlag()
ScalarColumn< Int > & antennaId()
Access to required columns.
const ScalarColumn< Float > & dewPoint() const
Access to optional columns.
ScalarQuantColumn< Float > & temperatureQuant()
ScalarColumn< Bool > & ionosElectronFlag()
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
this file contains all the compiler specific defines
Definition: mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43
MSWeatherColumns ROMSWeatherColumns
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46