casacore
 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 
46 // <summary>
47 // A class to provide easy access to MSAntenna columns
48 // </summary>
49 
50 // <use visibility=export>
51 
52 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
53 // </reviewed>
54 
55 // <prerequisite>
56 // <li> MSAntenna
57 // <li> ArrayColumn
58 // <li> ScalarColumn
59 // </prerequisite>
60 //
61 // <etymology>
62 // MSAntennaColumns stands for MeasurementSet Antenna Table columns.
63 // </etymology>
64 //
65 // <synopsis>
66 // This class provides access to the columns in the MSAntenna Table,
67 // it does the declaration of all the Scalar and ArrayColumns with the
68 // correct types, so the application programmer doesn't have to
69 // worry about getting those right. There is an access function
70 // for every predefined column. Access to non-predefined columns will still
71 // have to be done with explicit declarations.
72 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
73 // </synopsis>
74 //
75 // <motivation>
76 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
77 // </motivation>
78 
80 {
81 public:
82 
83  // Create a columns object that accesses the data in the specified Table
84  MSAntennaColumns(const MSAntenna& msAntenna);
85 
86  // The destructor does nothing special
88 
89  // Access to required columns
90  // <group>
104  // </group>
105 
106  // Const access to required columns
107  // <group>
110  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
111  const ScalarColumn<String>& mount() const {return mount_p;}
112  const ScalarColumn<String>& name() const {return name_p;}
113  const ArrayColumn<Double>& offset() const {return offset_p;}
116  const ArrayColumn<Double>& position() const {return position_p;}
119  const ScalarColumn<String>& station() const {return station_p;}
120  const ScalarColumn<String>& type() const {return type_p;}
121  // </group>
122 
123  // Access to optional columns
124  // <group>
128  // </group>
129 
130  // Const access to optional columns
131  // <group>
132  const ArrayColumn<Double>& meanOrbit() const {return meanOrbit_p;}
133  const ScalarColumn<Int>& orbitId() const {return orbitId_p;}
135  // </group>
136 
137  // set the position type for the POSITION column. This can only be done when
138  // the table has no rows. Trying to do so at other times will throw an
139  // exception.
141 
142  // set the position type for the OFFSET column. This can only be done when
143  // the table has no rows. Trying to do so at other times will throw an
144  // exception.
145  void setOffsetRef(MPosition::Types ref);
146 
147  // Convenience function that returns the number of rows in any of the columns
148  rownr_t nrow() const {return dishDiameter_p.nrow();}
149 
150  // returns the last row that contains an antenna at the specified position,
151  // to within the specified tolerance. The reference frame of the supplied
152  // position must be the same as the one for the POSITION columns. If not an
153  // AipsError is thrown as such an argument will never match any row of the
154  // Table. The tolerance is the maximum allowed distance between the two
155  // positions and the supplied Quantum must have dimensions of length. This is
156  // checked when compiled in debug mode and an AipsError exception is thrown
157  // if the dimensions are wrong. Returns -1 if no match could be found. Flagged
158  // rows can never match. If tryRow is non-negative, then that row is tested
159  // to see if it matches before any others are tested. Setting tryRow to a
160  // positive value greater than the table length will throw an exception
161  // (AipsError), when compiled in debug mode.
162  Int64 matchAntenna(const MPosition& antennaPos,
163  const Quantum<Double>& tolerance, Int64 tryRow=-1);
164 
165  // Same as the previous function except that the antenna name must also
166  // match.
167  Int64 matchAntenna(const String& antName, const MPosition& antennaPos,
168  const Quantum<Double>& tolerance, Int64 tryRow=-1);
169 
170  // Same as the previous function except that the station name must also
171  // match.
172  Int64 matchAntennaAndStation(const String& antName,
173  const String& stationName, // ignored when empty
174  const MPosition& antennaPos,
175  const Quantum<Double>& tolerance, Int64 tryRow=-1);
176 
177 protected:
178  //# default constructor creates a object that is not usable. Use the attach
179  //# function correct this.
181 
182  //# attach this object to the supplied table.
183  void attach(const MSAntenna& msAntenna);
184 
185 private:
186  //# Make the assignment operator and the copy constructor private to prevent
187  //# any compiler generated one from being used.
190 
191  //# Check if any optional columns exist and if so attach them.
192  void attachOptionalCols(const MSAntenna& msAntenna);
193 
194  //# Functions which check the supplied values against the relevant column and
195  //# the specified row.
196  Bool matchName(rownr_t row, const String& antName) const;
197  Bool matchStation(rownr_t row, const String& stationName) const;
198  Bool matchPosition(rownr_t row, const Vector<Double>& antPosInM,
199  const Double tolInM) const;
200 
201  //# required columns
210  //# optional columns
214 
215  //# Access to Measure columns
218 
219  //# Access to Quantum columns
223 
224 };
225 
226 //# Define the RO version for backward compatibility.
228 
229 } //# NAMESPACE CASACORE - END
230 
231 #endif
const ScalarColumn< Int > & phasedArrayId() const
ScalarMeasColumn< MPosition > & positionMeas()
ScalarColumn< String > station_p
Int64 matchAntenna(const MPosition &antennaPos, const Quantum< Double > &tolerance, Int64 tryRow=-1)
returns the last row that contains an antenna at the specified position, to within the specified tole...
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
MSAntennaColumns ROMSAntennaColumns
A Measure: position on Earth.
Definition: MPosition.h:79
ScalarColumn< Int > & orbitId()
ScalarColumn< String > & name()
~MSAntennaColumns()
The destructor does nothing special.
ScalarColumn< Bool > & flagRow()
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
ArrayColumn< Double > & meanOrbit()
Access to optional columns.
ArrayColumn< Double > position_p
ArrayQuantColumn< Double > & positionQuant()
ScalarColumn< String > name_p
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarMeasColumn< MPosition > offsetMeas_p
ArrayQuantColumn< Double > offsetQuant_p
ScalarColumn< String > type_p
const ArrayColumn< Double > & meanOrbit() const
Const access to optional columns.
Bool matchName(rownr_t row, const String &antName) const
void attachOptionalCols(const MSAntenna &msAntenna)
A Table intended to hold a MeasurementSet ANTENNA table.
Definition: MSAntenna.h:79
MSAntennaColumns & operator=(const MSAntennaColumns &)
const ScalarColumn< Int > & orbitId() const
ScalarColumn< String > & mount()
ScalarColumn< Int > orbitId_p
const ScalarColumn< String > & station() const
ScalarMeasColumn< MPosition > & offsetMeas()
ArrayQuantColumn< Double > positionQuant_p
const ScalarColumn< Bool > & flagRow() const
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
ScalarQuantColumn< Double > & dishDiameterQuant()
ScalarColumn< String > mount_p
const ScalarColumn< Double > & dishDiameter() const
Const access to required columns.
const ArrayColumn< Double > & position() const
ScalarColumn< Double > & dishDiameter()
Access to required columns.
double Double
Definition: aipstype.h:55
const ArrayQuantColumn< Double > & positionQuant() const
ArrayColumn< Double > offset_p
ScalarColumn< Double > dishDiameter_p
void attach(const MSAntenna &msAntenna)
ScalarColumn< Int > phasedArrayId_p
A class to provide easy 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()
Bool matchStation(rownr_t row, const String &stationName) const
const ScalarMeasColumn< MPosition > & offsetMeas() const
const ArrayColumn< Double > & offset() const
const ArrayQuantColumn< Double > & offsetQuant() const
const ScalarQuantColumn< Double > & dishDiameterQuant() const
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
void setOffsetRef(MPosition::Types ref)
set the position type for the OFFSET column.
const ScalarColumn< String > & mount() const
ScalarMeasColumn< MPosition > positionMeas_p
ScalarColumn< Int > & phasedArrayId()
ScalarColumn< String > & station()
const ScalarColumn< String > & name() const
Int64 matchAntennaAndStation(const String &antName, const String &stationName, const MPosition &antennaPos, const Quantum< Double > &tolerance, Int64 tryRow=-1)
Same as the previous function except that the station name must also match.
const ScalarColumn< String > & type() const
String: the storage and methods of handling collections of characters.
Definition: String.h:225
ScalarColumn< String > & type()
const ScalarMeasColumn< MPosition > & positionMeas() const
Bool matchPosition(rownr_t row, const Vector< Double > &antPosInM, const Double tolInM) const
ArrayQuantColumn< Double > & offsetQuant()
ArrayColumn< Double > & offset()
ScalarQuantColumn< Double > dishDiameterQuant_p