casacore
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>
32 #include <casacore/measures/Measures/MDirection.h>
33 #include <casacore/measures/Measures/MEpoch.h>
34 #include <casacore/measures/Measures/MCPosition.h>
35 #include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
36 #include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
37 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
38 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
39 #include <casacore/ms/MeasurementSets/MSAntennaColumns.h>
40 #include <casacore/ms/MeasurementSets/MSDataDescColumns.h>
41 #include <casacore/ms/MeasurementSets/MSDopplerColumns.h>
42 #include <casacore/ms/MeasurementSets/MSFeedColumns.h>
43 #include <casacore/ms/MeasurementSets/MSFieldColumns.h>
44 #include <casacore/ms/MeasurementSets/MSFlagCmdColumns.h>
45 #include <casacore/ms/MeasurementSets/MSFreqOffColumns.h>
46 #include <casacore/ms/MeasurementSets/MSHistoryColumns.h>
47 #include <casacore/ms/MeasurementSets/MSMainColumns.h>
48 #include <casacore/ms/MeasurementSets/MSObsColumns.h>
49 #include <casacore/ms/MeasurementSets/MSPointingColumns.h>
50 #include <casacore/ms/MeasurementSets/MSPolColumns.h>
51 #include <casacore/ms/MeasurementSets/MSProcessorColumns.h>
52 #include <casacore/ms/MeasurementSets/MSSourceColumns.h>
53 #include <casacore/ms/MeasurementSets/MSSpWindowColumns.h>
54 #include <casacore/ms/MeasurementSets/MSStateColumns.h>
55 #include <casacore/ms/MeasurementSets/MSSysCalColumns.h>
56 #include <casacore/ms/MeasurementSets/MSWeatherColumns.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
121 
122  // The destructor does nothing special
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 
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
MSAntennaColumns antenna_p
Access to subtables.
Definition: MSColumns.h:195
MSPolarizationColumns & polarization()
Definition: MSColumns.h:135
const MSHistoryColumns & history() const
Definition: MSColumns.h:157
MSDopplerColumns & doppler()
Access to optional subtables.
Definition: MSColumns.h:143
const MSWeatherColumns & weather() const
Definition: MSColumns.h:174
MSStateColumns state_p
Definition: MSColumns.h:209
MSObservationColumns & observation()
Definition: MSColumns.h:133
MSHistoryColumns & history()
Definition: MSColumns.h:132
MSAntennaColumns & antenna()
Access to required subtables.
Definition: MSColumns.h:127
MSObservationColumns observation_p
Definition: MSColumns.h:203
const MSDataDescColumns & dataDescription() const
Definition: MSColumns.h:153
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the EPOCH reference type in all EPOCH columns in the MS.
MSWeatherColumns weather_p
Definition: MSColumns.h:211
const MSFreqOffsetColumns & freqOffset() const
Definition: MSColumns.h:171
MSFlagCmdColumns & flagCmd()
Definition: MSColumns.h:131
MSSourceColumns & source()
Definition: MSColumns.h:145
MSDataDescColumns dataDesc_p
Definition: MSColumns.h:196
const MSDopplerColumns & doppler() const
Access to optional subtables.
Definition: MSColumns.h:170
const MSPolarizationColumns & polarization() const
Definition: MSColumns.h:160
MSDopplerColumns doppler_p
Definition: MSColumns.h:197
const MSPointingColumns & pointing() const
Definition: MSColumns.h:159
MSSpWindowColumns & spectralWindow()
Definition: MSColumns.h:137
MSSysCalColumns sysCal_p
Definition: MSColumns.h:210
MSProcessorColumns & processor()
Definition: MSColumns.h:136
MSSysCalColumns & sysCal()
Definition: MSColumns.h:146
MSFeedColumns feed_p
Definition: MSColumns.h:198
MSPointingColumns & pointing()
Definition: MSColumns.h:134
MSFieldColumns & field()
Definition: MSColumns.h:130
~MSColumns()
The destructor does nothing special.
const MSFlagCmdColumns & flagCmd() const
Definition: MSColumns.h:156
const MSSourceColumns & source() const
Definition: MSColumns.h:172
MSDataDescColumns & dataDescription()
Definition: MSColumns.h:128
MSPointingColumns pointing_p
Definition: MSColumns.h:204
MSHistoryColumns history_p
Definition: MSColumns.h:202
MSFlagCmdColumns flagCmd_p
Definition: MSColumns.h:200
const MSSysCalColumns & sysCal() const
Definition: MSColumns.h:173
MSSpWindowColumns spectralWindow_p
Definition: MSColumns.h:208
void setDirectionRef(MDirection::Types ref)
set the DIRECTION reference type for FIELD, POINTING and SOURCE tables (except for antenna frame dire...
MSFreqOffsetColumns & freqOffset()
Definition: MSColumns.h:144
MSFieldColumns field_p
Definition: MSColumns.h:199
MSFeedColumns & feed()
Definition: MSColumns.h:129
const MSAntennaColumns & antenna() const
Access to required subtables.
Definition: MSColumns.h:152
const MSObservationColumns & observation() const
Definition: MSColumns.h:158
MSFreqOffsetColumns freqOffset_p
Definition: MSColumns.h:201
MSSourceColumns source_p
Definition: MSColumns.h:207
MSStateColumns & state()
Definition: MSColumns.h:138
MSProcessorColumns processor_p
Definition: MSColumns.h:206
const MSFeedColumns & feed() const
Definition: MSColumns.h:154
const MSStateColumns & state() const
Definition: MSColumns.h:165
const MSFieldColumns & field() const
Definition: MSColumns.h:155
MSColumns(const MeasurementSet &ms)
Create a columns object that accesses the data in the specified MS.
MSPolarizationColumns polarization_p
Definition: MSColumns.h:205
const MSProcessorColumns & processor() const
Definition: MSColumns.h:162
const MSSpWindowColumns & spectralWindow() const
Definition: MSColumns.h:163
MSWeatherColumns & weather()
Definition: MSColumns.h:147
this file contains all the compiler specific defines
Definition: mainpage.dox:28
MSColumns ROMSColumns
Definition: MSColumns.h:215
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43