casacore
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>
32 #include <casacore/measures/Measures/MPosition.h>
33 #include <casacore/measures/Measures/MCPosition.h>
34 #include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
35 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
36 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
37 #include <casacore/tables/Tables/ArrayColumn.h>
38 #include <casacore/tables/Tables/ScalarColumn.h>
39 #include <casacore/casa/BasicSL/String.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  uInt 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. Flaged
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  Int matchAntenna(const MPosition& antennaPos,
163  const Quantum<Double>& tolerance, Int tryRow=-1);
164 
165  // Same as the previous function except that the antenna name must also
166  // match.
167  Int matchAntenna(const String& antName, const MPosition& antennaPos,
168  const Quantum<Double>& tolerance, Int tryRow=-1);
169 
170  // Same as the previous function except that the station name must also
171  // match.
172  Int matchAntennaAndStation(const String& antName,
173  const String& stationName, // ignored when empty
174  const MPosition& antennaPos,
175  const Quantum<Double>& tolerance, Int 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(uInt row, const String& antName) const;
197  Bool matchStation(uInt row, const String& stationName) const;
198  Bool matchPosition(uInt 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
Bool matchPosition(uInt row, const Vector< Double > &antPosInM, const Double tolInM) const
ScalarMeasColumn< MPosition > & positionMeas()
ScalarColumn< String > station_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.
const ScalarColumn< Bool > & flagRow() const
MSAntennaColumns ROMSAntennaColumns
A Measure: position on Earth.
Definition: MPosition.h:79
ScalarColumn< Int > & orbitId()
int Int
Definition: aipstype.h:50
ScalarColumn< String > & name()
~MSAntennaColumns()
The destructor does nothing special.
const ArrayColumn< Double > & offset() const
ScalarColumn< Bool > & flagRow()
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
ArrayColumn< Double > & meanOrbit()
Access to optional columns.
const ScalarColumn< Int > & orbitId() const
ArrayColumn< Double > position_p
ArrayQuantColumn< Double > & positionQuant()
ScalarColumn< String > name_p
Bool matchName(uInt row, const String &antName) const
const ArrayQuantColumn< Double > & positionQuant() const
const ScalarColumn< String > & mount() const
ScalarMeasColumn< MPosition > offsetMeas_p
ArrayQuantColumn< Double > offsetQuant_p
ScalarColumn< String > type_p
const ScalarColumn< String > & name() const
const ArrayColumn< Double > & position() const
const ScalarMeasColumn< MPosition > & offsetMeas() const
const ScalarColumn< String > & type() const
const ScalarMeasColumn< MPosition > & positionMeas() const
void attachOptionalCols(const MSAntenna &msAntenna)
const ScalarColumn< String > & station() const
const ScalarQuantColumn< Double > & dishDiameterQuant() const
A Table intended to hold a MeasurementSet ANTENNA table.
Definition: MSAntenna.h:79
MSAntennaColumns & operator=(const MSAntennaColumns &)
ScalarColumn< String > & mount()
ScalarColumn< Int > orbitId_p
ScalarMeasColumn< MPosition > & offsetMeas()
ArrayQuantColumn< Double > positionQuant_p
ScalarQuantColumn< Double > & dishDiameterQuant()
ScalarColumn< String > mount_p
ScalarColumn< Double > & dishDiameter()
Access to required columns.
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...
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
double Double
Definition: aipstype.h:55
const ScalarColumn< Double > & dishDiameter() const
Const access to required columns.
uInt nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
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()
const ArrayColumn< Double > & meanOrbit() const
Const access to optional columns.
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
void setOffsetRef(MPosition::Types ref)
set the position type for the OFFSET column.
ScalarMeasColumn< MPosition > positionMeas_p
ScalarColumn< Int > & phasedArrayId()
Bool matchStation(uInt row, const String &stationName) const
ScalarColumn< String > & station()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
ScalarColumn< String > & type()
const ArrayQuantColumn< Double > & offsetQuant() const
const ScalarColumn< Int > & phasedArrayId() const
ArrayQuantColumn< Double > & offsetQuant()
this file contains all the compiler specific defines
Definition: mainpage.dox:28
ArrayColumn< Double > & offset()
unsigned int uInt
Definition: aipstype.h:51
ScalarQuantColumn< Double > dishDiameterQuant_p