casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSColumns.h
Go to the documentation of this file.
1 //# MSColumns.h: provides easy access to MeasurementSet 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_MSCOLUMNS_H
29 #define MS_MSCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
57 
58 namespace casacore { //# NAMESPACE CASACORE - BEGIN
59 
60 class MeasurementSet;
61 
62 
63 // <summary>
64 // A class to provide easy access to MeasurementSet columns
65 // </summary>
66 
67 // <use visibility=export>
68 
69 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
70 // </reviewed>
71 
72 // <prerequisite>
73 // <li> MeasurementSet
74 // <li> ArrayColumn
75 // <li> ScalarColumn
76 // </prerequisite>
77 //
78 // <etymology>
79 // MSColumns stands for MeasurementSet Table columns.
80 // </etymology>
81 //
82 // <synopsis>
83 // This class provides access to all the subtables and direct access to all the
84 // columns in the MeasurementSet. It does the declaration of all the Scalar
85 // and ArrayColumns with the correct types, so the application programmer
86 // doesn't have to worry about getting those right. There is an access function
87 // for every predefined column. Access to non-predefined columns will still
88 // have to be done with explicit declarations.
89 // </synopsis>
90 //
91 // <example>
92 // <srcblock>
93 // // use as follows
94 // MeasurementSet ms("myMS",Table::Update);
95 // MSColumns msc(ms);
96 // // show data from row 5
97 // cout << msc.data()(5);
98 // // change name of antenna on row 3 in antenna table
99 // msc.antenna().name().put(3,"NewAnt-3");
100 // </srcblock>
101 // </example>
102 //
103 // <motivation>
104 // Having to type long lists of Scalar and Array column declarations gets
105 // very tedious. This class attempts to relieve some of that tedium, while
106 // at the same time concentrating all the declarations in one place,
107 // making Type errors in the column declaration (only caught at run-time) less
108 // probable. Type errors in the use of the columns is caught at compile
109 // time.
110 // </motivation>
111 //
112 // <todo asof="1997/02/01">
113 // <li> We might decide to merge this class with the MeasurementSet
114 // </todo>
115 
117 {
118 public:
119  // Create a columns object that accesses the data in the specified MS
120  MSColumns(const MeasurementSet& ms);
121 
122  // The destructor does nothing special
123  ~MSColumns();
124 
125  // Access to required subtables
126  // <group>
129  MSFeedColumns& feed() {return feed_p;}
139  // </group>
140 
141  // Access to optional subtables
142  // <group>
148  // </group>
149 
150  // Access to required subtables
151  // <group>
152  const MSAntennaColumns& antenna() const {return antenna_p;}
154  const MSFeedColumns& feed() const {return feed_p;}
155  const MSFieldColumns& field() const {return field_p;}
156  const MSFlagCmdColumns& flagCmd() const {return flagCmd_p;}
157  const MSHistoryColumns& history() const {return history_p;}
159  const MSPointingColumns& pointing() const {return pointing_p;}
161  return polarization_p;}
162  const MSProcessorColumns& processor() const {return processor_p;}
164  return spectralWindow_p;}
165  const MSStateColumns& state() const {return state_p;}
166  // </group>
167 
168  // Access to optional subtables
169  // <group>
170  const MSDopplerColumns& doppler() const {return doppler_p;}
171  const MSFreqOffsetColumns& freqOffset() const {return freqOffset_p;}
172  const MSSourceColumns& source() const {return source_p;}
173  const MSSysCalColumns& sysCal() const {return sysCal_p;}
174  const MSWeatherColumns& weather() const {return weather_p;}
175  // </group>
176 
177  // set the EPOCH reference type in all EPOCH columns in the MS. Note that
178  // only a single EPOCH reference is allowed in the MS. This
179  // <note role=tip>
180  // In principle this function can only be used if the table is empty,
181  // otherwise already written values may thereafter have an incorrect
182  // reference, offset, or unit. However, it is possible that part of the
183  // table gets written before these values are known. In that case the
184  // reference, offset, or units can be set by using a False
185  // <src>tableMustBeEmpty</src> argument.
186  // </note>
187  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
188 
189  // set the DIRECTION reference type for FIELD, POINTING and SOURCE tables
190  // (except for antenna frame directions).
192 
193 private:
194  // Access to subtables
212 };
213 
214 //# Define the RO version for backward compatibility.
216 
217 //# Declare extern templates for often used types.
218  extern template class ArrayMeasColumn<MDirection>;
219  extern template class ScalarMeasColumn<MPosition>;
220  extern template class ScalarMeasColumn<MEpoch>;
221  extern template class ArrayQuantColumn<Double>;
222  extern template class ScalarQuantColumn<Double>;
223 
224 } //# NAMESPACE CASACORE - END
225 
226 #endif
227 
228 
const MSWeatherColumns & weather() const
Definition: MSColumns.h:174
const MSAntennaColumns & antenna() const
Access to required subtables.
Definition: MSColumns.h:152
MSFlagCmdColumns flagCmd_p
Definition: MSColumns.h:200
MSFieldColumns & field()
Definition: MSColumns.h:130
MSFeedColumns & feed()
Definition: MSColumns.h:129
const MSStateColumns & state() const
Definition: MSColumns.h:165
A class to provide easy access to MSObservation columns.
Definition: MSObsColumns.h:80
MSFreqOffsetColumns & freqOffset()
Definition: MSColumns.h:144
MSWeatherColumns & weather()
Definition: MSColumns.h:147
const MSProcessorColumns & processor() const
Definition: MSColumns.h:162
MSHistoryColumns history_p
Definition: MSColumns.h:202
const MSHistoryColumns & history() const
Definition: MSColumns.h:157
MSSpWindowColumns spectralWindow_p
Definition: MSColumns.h:208
const MSSpWindowColumns & spectralWindow() const
Definition: MSColumns.h:163
MSSourceColumns & source()
Definition: MSColumns.h:145
MSColumns ROMSColumns
Definition: MSColumns.h:215
const MSFeedColumns & feed() const
Definition: MSColumns.h:154
MSAntennaColumns & antenna()
Access to required subtables.
Definition: MSColumns.h:127
~MSColumns()
The destructor does nothing special.
A class to provide easy access to MSPointing columns.
MSWeatherColumns weather_p
Definition: MSColumns.h:211
A class to provide easy access to MSHistory columns.
MSHistoryColumns & history()
Definition: MSColumns.h:132
MSSourceColumns source_p
Definition: MSColumns.h:207
MSSpWindowColumns & spectralWindow()
Definition: MSColumns.h:137
MSColumns(const MeasurementSet &ms)
Create a columns object that accesses the data in the specified MS.
const MSFreqOffsetColumns & freqOffset() const
Definition: MSColumns.h:171
const MSFieldColumns & field() const
Definition: MSColumns.h:155
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the EPOCH reference type in all EPOCH columns in the MS.
const MSPolarizationColumns & polarization() const
Definition: MSColumns.h:160
MSDataDescColumns dataDesc_p
Definition: MSColumns.h:196
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
A class to provide easy access to MSField columns.
A class to provide easy access to MSSource columns.
MSSysCalColumns sysCal_p
Definition: MSColumns.h:210
MSFlagCmdColumns & flagCmd()
Definition: MSColumns.h:131
MSProcessorColumns processor_p
Definition: MSColumns.h:206
MSStateColumns & state()
Definition: MSColumns.h:138
const MSDataDescColumns & dataDescription() const
Definition: MSColumns.h:153
const MSSysCalColumns & sysCal() const
Definition: MSColumns.h:173
MSPointingColumns & pointing()
Definition: MSColumns.h:134
A class to provide easy access to MSSpectralWindow columns.
A class to provide easy access to MSSysCal columns.
A class to provide easy access to MSProcessor columns.
MSDopplerColumns & doppler()
Access to optional subtables.
Definition: MSColumns.h:143
MSAntennaColumns antenna_p
Access to subtables.
Definition: MSColumns.h:195
A class to provide easy access to MSAntenna columns.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A class to provide easy access to MSDoppler columns.
const MSFlagCmdColumns & flagCmd() const
Definition: MSColumns.h:156
const MSObservationColumns & observation() const
Definition: MSColumns.h:158
MSFieldColumns field_p
Definition: MSColumns.h:199
MSFreqOffsetColumns freqOffset_p
Definition: MSColumns.h:201
MSObservationColumns & observation()
Definition: MSColumns.h:133
MSDataDescColumns & dataDescription()
Definition: MSColumns.h:128
A class to provide easy access to MSFeed columns.
Definition: MSFeedColumns.h:84
A Table intended to hold astronomical data (a set of Measurements).
A class to provide easy access to MSPolarization columns.
Definition: MSPolColumns.h:74
MSPointingColumns pointing_p
Definition: MSColumns.h:204
MSProcessorColumns & processor()
Definition: MSColumns.h:136
A class for easy access to MeasurementSet main table columns.
MSStateColumns state_p
Definition: MSColumns.h:209
A class to provide easy access to MeasurementSet columns.
Definition: MSColumns.h:116
const MSPointingColumns & pointing() const
Definition: MSColumns.h:159
MSFeedColumns feed_p
Definition: MSColumns.h:198
A class to provide easy access to MSState columns.
const MSSourceColumns & source() const
Definition: MSColumns.h:172
MSSysCalColumns & sysCal()
Definition: MSColumns.h:146
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
MSPolarizationColumns & polarization()
Definition: MSColumns.h:135
const Bool True
Definition: aipstype.h:43
const MSDopplerColumns & doppler() const
Access to optional subtables.
Definition: MSColumns.h:170
A class to provide easy access to MSFlagCmd columns.
A class to provide easy access to MSFreqOffset columns.
void setDirectionRef(MDirection::Types ref)
set the DIRECTION reference type for FIELD, POINTING and SOURCE tables (except for antenna frame dire...
MSPolarizationColumns polarization_p
Definition: MSColumns.h:205
MSDopplerColumns doppler_p
Definition: MSColumns.h:197
A class to provide easy access to MSDataDescription columns.
MSObservationColumns observation_p
Definition: MSColumns.h:203
A class to provide easy access to MSWeather columns.