casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSAntennaColumns.h
Go to the documentation of this file.
1 //# MSAntennaColumns.h: provides easy access to MSAntenna 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_MSANTENNACOLUMNS_H
29 #define MS_MSANTENNACOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
40 
41 namespace casacore { //# NAMESPACE CASACORE - BEGIN
42 
43 class MSAntenna;
44 
45 // <summary>
46 // A class to provide easy read-only access to MSAntenna columns
47 // </summary>
48 
49 // <use visibility=export>
50 
51 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
52 // </reviewed>
53 
54 // <prerequisite>
55 // <li> MSAntenna
56 // <li> ArrayColumn
57 // <li> ScalarColumn
58 // </prerequisite>
59 //
60 // <etymology>
61 // ROMSAntennaColumns stands for Read-Only MeasurementSet Antenna Table columns.
62 // </etymology>
63 //
64 // <synopsis>
65 // This class provides read-only access to the columns in the MSAntenna
66 // Table. It does the declaration of all the Scalar and ArrayColumns with the
67 // correct types, so the application programmer doesn't have to worry about
68 // getting those right. There is an access function for every predefined
69 // column. Access to non-predefined columns will still have to be done with
70 // explicit declarations.
71 // See <linkto class=ROMSColumns> ROMSColumns</linkto> for an example.
72 // </synopsis>
73 //
74 // <motivation>
75 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
76 // </motivation>
77 
79 {
80 public:
81 
82  // Create a columns object that accesses the data in the specified Table
83  ROMSAntennaColumns(const MSAntenna& msAntenna);
84 
85  // The destructor does nothing special
87 
88  // Access to columns
89  // <group>
90  const ROScalarColumn<Double>& dishDiameter() const {return dishDiameter_p;}
91  const ROScalarQuantColumn<Double>& dishDiameterQuant() const
92  {return dishDiameterQuant_p;}
93  const ROScalarColumn<Bool>& flagRow() const {return flagRow_p;}
94  const ROScalarColumn<String>& mount() const {return mount_p;}
95  const ROScalarColumn<String>& name() const {return name_p;}
96  const ROArrayColumn<Double>& offset() const {return offset_p;}
97  const ROArrayQuantColumn<Double>& offsetQuant() const {return offsetQuant_p;}
98  const ROScalarMeasColumn<MPosition>& offsetMeas() const {
99  return offsetMeas_p;}
100  const ROArrayColumn<Double>& position() const {return position_p;}
101  const ROArrayQuantColumn<Double>& positionQuant() const {
102  return positionQuant_p;}
103  const ROScalarMeasColumn<MPosition>& positionMeas() const
104  { return positionMeas_p;}
105  const ROScalarColumn<String>& station() const {return station_p;}
106  const ROScalarColumn<String>& type() const {return type_p;}
107  // </group>
108 
109  // Access to optional columns
110  // <group>
111  const ROArrayColumn<Double>& meanOrbit() const {return meanOrbit_p;}
112  const ROScalarColumn<Int>& orbitId() const {return orbitId_p;}
113  const ROScalarColumn<Int>& phasedArrayId() const {return phasedArrayId_p;}
114  // </group>
115 
116  // Convenience function that returns the number of rows in any of the columns
117  uInt nrow() const {return dishDiameter_p.nrow();}
118 
119  // returns the last row that contains an antenna at the specified position,
120  // to within the specified tolerance. The reference frame of the supplied
121  // position must be the same as the one for the POSITION columns. If not an
122  // AipsError is thrown as such an argument will never match any row of the
123  // Table. The tolerance is the maximum allowed distance between the two
124  // positions and the supplied Quantum must have dimensions of length. This is
125  // checked when compiled in debug mode and an AipsError exception is thrown
126  // if the dimensions are wrong. Returns -1 if no match could be found. Flaged
127  // rows can never match. If tryRow is non-negative, then that row is tested
128  // to see if it matches before any others are tested. Setting tryRow to a
129  // positive value greater than the table length will throw an exception
130  // (AipsError), when compiled in debug mode.
131  Int matchAntenna(const MPosition& antennaPos,
132  const Quantum<Double>& tolerance, Int tryRow=-1);
133 
134  // Same as the previous function except that the antenna name must also
135  // match.
136  Int matchAntenna(const String& antName, const MPosition& antennaPos,
137  const Quantum<Double>& tolerance, Int tryRow=-1);
138 
139  // Same as the previous function except that the station name must also
140  // match.
141  Int matchAntennaAndStation(const String& antName,
142  const String& stationName, // ignored when empty
143  const MPosition& antennaPos,
144  const Quantum<Double>& tolerance, Int tryRow=-1);
145 protected:
146  //# default constructor creates a object that is not usable. Use the attach
147  //# function correct this.
149 
150  //# attach this object to the supplied table.
151  void attach(const MSAntenna& msAntenna);
152 
153 private:
154  //# Make the assignment operator and the copy constructor private to prevent
155  //# any compiler generated one from being used.
158 
159  //# Check if any optional columns exist and if so attach them.
160  void attachOptionalCols(const MSAntenna& msAntenna);
161 
162  //# Functions which check the supplied values against the relevant column and
163  //# the specified row.
164  Bool matchName(uInt row, const String& antName) const;
165  Bool matchStation(uInt row, const String& stationName) const;
166  Bool matchPosition(uInt row, const Vector<Double>& antPosInM,
167  const Double tolInM) const;
168 
169 
170  //# required columns
171  ROScalarColumn<Double> dishDiameter_p;
172  ROScalarColumn<Bool> flagRow_p;
173  ROScalarColumn<String> mount_p;
174  ROScalarColumn<String> name_p;
175  ROArrayColumn<Double> offset_p;
176  ROArrayColumn<Double> position_p;
177  ROScalarColumn<String> station_p;
178  ROScalarColumn<String> type_p;
179  //# optional columns
180  ROArrayColumn<Double> meanOrbit_p;
181  ROScalarColumn<Int> orbitId_p;
182  ROScalarColumn<Int> phasedArrayId_p;
183 
184  //# Access to Measure columns
185  ROScalarMeasColumn<MPosition> offsetMeas_p;
186  ROScalarMeasColumn<MPosition> positionMeas_p;
187 
188  //# Access to Quantum columns
189  ROScalarQuantColumn<Double> dishDiameterQuant_p;
190  ROArrayQuantColumn<Double> offsetQuant_p;
191  ROArrayQuantColumn<Double> positionQuant_p;
192 };
193 
194 // <summary>
195 // A class to provide easy read-write access to MSAntenna columns
196 // </summary>
197 
198 // <use visibility=export>
199 
200 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
201 // </reviewed>
202 
203 // <prerequisite>
204 // <li> MSAntenna
205 // <li> ArrayColumn
206 // <li> ScalarColumn
207 // </prerequisite>
208 //
209 // <etymology>
210 // MSAntennaColumns stands for MeasurementSet Antenna Table columns.
211 // </etymology>
212 //
213 // <synopsis>
214 // This class provides access to the columns in the MSAntenna Table,
215 // it does the declaration of all the Scalar and ArrayColumns with the
216 // correct types, so the application programmer doesn't have to
217 // worry about getting those right. There is an access function
218 // for every predefined column. Access to non-predefined columns will still
219 // have to be done with explicit declarations.
220 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
221 // </synopsis>
222 //
223 // <motivation>
224 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
225 // </motivation>
226 
228 {
229 public:
230 
231  // Create a columns object that accesses the data in the specified Table
232  MSAntennaColumns(MSAntenna& msAntenna);
233 
234  // The destructor does nothing special
236 
237  // Read-write access to required columns
238  // <group>
252  // </group>
253 
254  // Read-write access to optional columns
255  // <group>
259  // </group>
260 
261  // Read-only access to required columns
262  // <group>
263  const ROScalarColumn<Double>& dishDiameter() const {
265  const ROScalarQuantColumn<Double>& dishDiameterQuant() const {
267  const ROScalarColumn<Bool>& flagRow() const {
268  return ROMSAntennaColumns::flagRow();}
269  const ROScalarColumn<String>& mount() const {
270  return ROMSAntennaColumns::mount();}
271  const ROScalarColumn<String>& name() const {
272  return ROMSAntennaColumns::name();}
273  const ROArrayColumn<Double>& offset() const {
274  return ROMSAntennaColumns::offset();}
275  const ROArrayQuantColumn<Double>& offsetQuant() const {
277  const ROScalarMeasColumn<MPosition>& offsetMeas() const {
279  const ROArrayColumn<Double>& position() const {
281  const ROArrayQuantColumn<Double>& positionQuant() const {
283  const ROScalarMeasColumn<MPosition>& positionMeas() const {
285  const ROScalarColumn<String>& station() const {
286  return ROMSAntennaColumns::station();}
287  const ROScalarColumn<String>& type() const {
288  return ROMSAntennaColumns::type();}
289  // </group>
290 
291  // Read-only access to optional columns
292  // <group>
293  const ROArrayColumn<Double>& meanOrbit() const {
295  const ROScalarColumn<Int>& orbitId() const {
296  return ROMSAntennaColumns::orbitId();}
297  const ROScalarColumn<Int>& phasedArrayId() const {
299  // </group>
300 
301  // set the position type for the POSITION column. This can only be done when
302  // the table has no rows. Trying to do so at other times will throw an
303  // exception.
305 
306  // set the position type for the OFFSET column. This can only be done when
307  // the table has no rows. Trying to do so at other times will throw an
308  // exception.
309  void setOffsetRef(MPosition::Types ref);
310 
311 protected:
312  //# default constructor creates a object that is not usable. Use the attach
313  //# function correct this.
315 
316  //# attach this object to the supplied table.
317  void attach(MSAntenna& msAntenna);
318 
319 private:
320  //# Make the assignment operator and the copy constructor private to prevent
321  //# any compiler generated one from being used.
324 
325  //# Check if any optional columns exist and if so attach them.
326  void attachOptionalCols(MSAntenna& msAntenna);
327 
328  //# required columns
337  //# optional columns
341 
342  //# Access to Measure columns
345 
346  //# Access to Quantum columns
350 
351 };
352 
353 } //# NAMESPACE CASACORE - END
354 
355 #endif
const ROScalarColumn< Double > & dishDiameter() const
Read-only access to required columns.
ROScalarColumn< String > station_p
const ROScalarColumn< String > & station() const
ScalarMeasColumn< MPosition > & positionMeas()
ScalarColumn< String > station_p
A Measure: position on Earth.
Definition: MPosition.h:79
ROScalarColumn< String > name_p
ScalarColumn< Int > & orbitId()
int Int
Definition: aipstype.h:50
ScalarColumn< String > & name()
~MSAntennaColumns()
The destructor does nothing special.
const ROScalarColumn< String > & name() const
ScalarColumn< Bool > & flagRow()
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
ArrayColumn< Double > & meanOrbit()
Read-write access to optional columns.
ArrayColumn< Double > position_p
ArrayQuantColumn< Double > & positionQuant()
Bool matchStation(uInt row, const String &stationName) const
ScalarColumn< String > name_p
const ROScalarMeasColumn< MPosition > & positionMeas() const
ROScalarColumn< Double > dishDiameter_p
~ROMSAntennaColumns()
The destructor does nothing special.
ROScalarQuantColumn< Double > dishDiameterQuant_p
ScalarMeasColumn< MPosition > offsetMeas_p
ArrayQuantColumn< Double > offsetQuant_p
ROScalarMeasColumn< MPosition > offsetMeas_p
const ROArrayColumn< Double > & position() const
ROArrayColumn< Double > offset_p
const ROArrayColumn< Double > & offset() const
Bool matchName(uInt row, const String &antName) const
Int matchAntenna(const MPosition &antennaPos, const Quantum< Double > &tolerance, Int tryRow=-1)
returns the last row that contains an antenna at the specified position, to within the specified tole...
ROArrayColumn< Double > meanOrbit_p
ScalarColumn< String > type_p
const ROArrayColumn< Double > & meanOrbit() const
Read-only access to optional columns.
const ROScalarColumn< String > & mount() const
void attach(const MSAntenna &msAntenna)
const ROScalarMeasColumn< MPosition > & positionMeas() const
ROScalarColumn< String > type_p
const ROArrayColumn< Double > & offset() const
ROScalarColumn< Int > phasedArrayId_p
A Table intended to hold a MeasurementSet ANTENNA table.
Definition: MSAntenna.h:79
const ROScalarColumn< String > & type() const
ROMSAntennaColumns & operator=(const ROMSAntennaColumns &)
MSAntennaColumns & operator=(const MSAntennaColumns &)
const ROArrayQuantColumn< Double > & offsetQuant() const
ScalarColumn< String > & mount()
ROScalarMeasColumn< MPosition > positionMeas_p
ScalarColumn< Int > orbitId_p
ScalarMeasColumn< MPosition > & offsetMeas()
const ROArrayColumn< Double > & position() const
ArrayQuantColumn< Double > positionQuant_p
const ROArrayColumn< Double > & meanOrbit() const
Access to optional columns.
ScalarQuantColumn< Double > & dishDiameterQuant()
ScalarColumn< String > mount_p
const ROScalarMeasColumn< MPosition > & offsetMeas() const
const ROArrayQuantColumn< Double > & offsetQuant() const
ScalarColumn< Double > & dishDiameter()
Read-write access to required columns.
const ROScalarColumn< Int > & phasedArrayId() const
const ROScalarColumn< String > & station() const
const ROArrayQuantColumn< Double > & positionQuant() const
const ROScalarMeasColumn< MPosition > & offsetMeas() const
const ROScalarColumn< Int > & phasedArrayId() const
const ROScalarColumn< String > & mount() const
ROScalarColumn< Int > orbitId_p
double Double
Definition: aipstype.h:55
const ROScalarColumn< String > & name() const
ROArrayQuantColumn< Double > offsetQuant_p
ArrayColumn< Double > offset_p
ScalarColumn< Double > dishDiameter_p
ROScalarColumn< String > mount_p
ScalarColumn< Int > phasedArrayId_p
A class to provide easy read-write access to MSAntenna columns.
ArrayColumn< Double > meanOrbit_p
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ScalarColumn< Bool > flagRow_p
ArrayColumn< Double > & position()
const ROScalarQuantColumn< Double > & dishDiameterQuant() const
const ROScalarColumn< String > & type() const
const ROScalarColumn< Double > & dishDiameter() const
Access to columns.
ROArrayColumn< Double > position_p
void attachOptionalCols(MSAntenna &msAntenna)
const ROScalarQuantColumn< Double > & dishDiameterQuant() const
const ROScalarColumn< Bool > & flagRow() const
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
const ROScalarColumn< Bool > & flagRow() const
void attach(MSAntenna &msAntenna)
void setOffsetRef(MPosition::Types ref)
set the position type for the OFFSET column.
ScalarMeasColumn< MPosition > positionMeas_p
ScalarColumn< Int > & phasedArrayId()
Bool matchPosition(uInt row, const Vector< Double > &antPosInM, const Double tolInM) const
const ROScalarColumn< Int > & orbitId() const
ScalarColumn< String > & station()
A class to provide easy read-only access to MSAntenna columns.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
ScalarColumn< String > & type()
const ROScalarColumn< Int > & orbitId() const
ROArrayQuantColumn< Double > positionQuant_p
Int matchAntennaAndStation(const String &antName, const String &stationName, const MPosition &antennaPos, const Quantum< Double > &tolerance, Int tryRow=-1)
Same as the previous function except that the station name must also match.
ROScalarColumn< Bool > flagRow_p
ArrayQuantColumn< Double > & offsetQuant()
ArrayColumn< Double > & offset()
unsigned int uInt
Definition: aipstype.h:51
void attachOptionalCols(const MSAntenna &msAntenna)
const ROArrayQuantColumn< Double > & positionQuant() const
ScalarQuantColumn< Double > dishDiameterQuant_p
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42