casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSPolColumns.h
Go to the documentation of this file.
1 //# MSPolColumns.h: provides easy access to MSPolarization columns
2 //# Copyright (C) 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_MSPOLCOLUMNS_H
29 #define MS_MSPOLCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 class MSPolarization;
39 template <class T> class Vector;
40 template <class T> class Matrix;
41 
42 // <summary>
43 // A class to provide easy read-only access to MSPolarization columns
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> MSPolarization
53 // <li> ArrayColumn
54 // <li> ScalarColumn
55 // </prerequisite>
56 //
57 // <etymology>
58 // ROMSPolarizationColumns stands for Read-Only MeasurementSet Polarization Table columns.
59 // </etymology>
60 //
61 // <synopsis>
62 // This class provides read-only access to the columns in the MSPolarization Table.
63 // It does the declaration of all the Scalar and ArrayColumns with the
64 // correct types, so the application programmer doesn't have to
65 // worry about getting those right. There is an access function
66 // for every predefined column. Access to non-predefined columns will still
67 // have to be done with explicit declarations.
68 // See <linkto class=ROMSColumns> ROMSColumns</linkto> for an example.
69 // </synopsis>
70 //
71 // <motivation>
72 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
73 // </motivation>
74 
76 {
77 public:
78  // Create a columns object that accesses the data in the specified Table
79  ROMSPolarizationColumns(const MSPolarization& msPolarization);
80 
81  // The destructor does nothing special
83 
84  // Access to required columns
85  // <group>
86  const ROArrayColumn<Int>& corrProduct() const {return corrProduct_p;}
87  const ROArrayColumn<Int>& corrType() const {return corrType_p;}
88  const ROScalarColumn<Bool>& flagRow() const {return flagRow_p;}
89  const ROScalarColumn<Int>& numCorr() const {return numCorr_p;}
90  // </group>
91 
92  // Convenience function that returns the number of rows in any of the columns
93  uInt nrow() const {return corrProduct_p.nrow();}
94 
95  // returns the last row that contains the an entry in the CORR_TYPE column
96  // that matches, in length and value, the supplied corrType Vector. Returns
97  // -1 if no match could be found. Flagged rows can never match. If tryRow is
98  // non-negative, then that row is tested to see if it matches before any
99  // others are tested. Setting tryRow to a positive value greater than the
100  // table length will throw an exception (AipsError), when compiled in debug
101  // mode.
102  Int match(const Vector<Stokes::StokesTypes>& polType, Int tryRow=-1);
103 
104 protected:
105  //# default constructor creates a object that is not usable. Use the attach
106  //# function correct this.
108 
109  //# attach this object to the supplied table.
110  void attach(const MSPolarization& msPolarization);
111 
112 private:
113  //# Functions which check the supplied values against the relevant column and
114  //# the specified row.
115  Bool matchCorrType(uInt row, const Vector<Int>& polType) const;
116  Bool matchCorrProduct(uInt row, const Matrix<Int>& polProduct) const;
117 
118  //# Make the assignment operator and the copy constructor private to prevent
119  //# any compiler generated one from being used.
122 
123  //# required columns
124  ROArrayColumn<Int> corrProduct_p;
125  ROArrayColumn<Int> corrType_p;
126  ROScalarColumn<Bool> flagRow_p;
127  ROScalarColumn<Int> numCorr_p;
128 };
129 
130 // <summary>
131 // A class to provide easy read-write access to MSPolarization columns
132 // </summary>
133 
134 // <use visibility=export>
135 
136 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
137 // </reviewed>
138 
139 // <prerequisite>
140 // <li> MSPolarization
141 // <li> ArrayColumn
142 // <li> ScalarColumn
143 // </prerequisite>
144 //
145 // <etymology>
146 // MSPolarizationColumns stands for MeasurementSet Polarization Table columns.
147 // </etymology>
148 //
149 // <synopsis>
150 // This class provides access to the columns in the MSPolarization Table,
151 // it does the declaration of all the Scalar and ArrayColumns with the
152 // correct types, so the application programmer doesn't have to
153 // worry about getting those right. There is an access function
154 // for every predefined column. Access to non-predefined columns will still
155 // have to be done with explicit declarations.
156 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
157 // </synopsis>
158 //
159 // <motivation>
160 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
161 // </motivation>
162 
164 {
165 public:
166  // Create a columns object that accesses the data in the specified Table
167  MSPolarizationColumns(MSPolarization& msPolarization);
168 
169  // The destructor does nothing special
171 
172  // Read-write access to required columns
173  // <group>
178  // </group>
179 
180  // Read-only access to required columns
181  // <group>
182  const ROArrayColumn<Int>& corrProduct() const {
184  const ROArrayColumn<Int>& corrType() const {
186  const ROScalarColumn<Bool>& flagRow() const {
188  const ROScalarColumn<Int>& numCorr() const {
190  // </group>
191 
192 protected:
193  //# default constructor creates a object that is not usable. Use the attach
194  //# function correct this.
196 
197  //# attach this object to the supplied table.
198  void attach(MSPolarization& msPolarization);
199 
200 private:
201  //# Make the assignment operator and the copy constructor private to prevent
202  //# any compiler generated one from being used.
205 
206  //# required columns
211 };
212 
213 } //# NAMESPACE CASACORE - END
214 
215 #endif
A 1-D Specialization of the Array class.
int Int
Definition: aipstype.h:50
std::vector< double > Vector
Definition: ds9context.h:24
Int match(const Vector< Stokes::StokesTypes > &polType, Int tryRow=-1)
returns the last row that contains the an entry in the CORR_TYPE column that matches, in length and value, the supplied corrType Vector.
const ROScalarColumn< Int > & numCorr() const
Definition: MSPolColumns.h:188
ROMSPolarizationColumns & operator=(const ROMSPolarizationColumns &)
const ROScalarColumn< Bool > & flagRow() const
Definition: MSPolColumns.h:88
const ROArrayColumn< Int > & corrProduct() const
Access to required columns.
Definition: MSPolColumns.h:86
ROArrayColumn< Int > corrProduct_p
Definition: MSPolColumns.h:124
ROScalarColumn< Bool > flagRow_p
Definition: MSPolColumns.h:126
const ROArrayColumn< Int > & corrProduct() const
Read-only access to required columns.
Definition: MSPolColumns.h:182
~ROMSPolarizationColumns()
The destructor does nothing special.
void attach(MSPolarization &msPolarization)
const ROScalarColumn< Int > & numCorr() const
Definition: MSPolColumns.h:89
ROScalarColumn< Int > numCorr_p
Definition: MSPolColumns.h:127
~MSPolarizationColumns()
The destructor does nothing special.
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
Definition: MSPolColumns.h:93
MSPolarizationColumns & operator=(const MSPolarizationColumns &)
ScalarColumn< Bool > & flagRow()
Definition: MSPolColumns.h:176
A Table intended to hold a MeasurementSet POLARIZATION table.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const ROScalarColumn< Bool > & flagRow() const
Definition: MSPolColumns.h:186
ScalarColumn< Int > numCorr_p
Definition: MSPolColumns.h:210
void attach(const MSPolarization &msPolarization)
ArrayColumn< Int > corrType_p
Definition: MSPolColumns.h:208
ScalarColumn< Bool > flagRow_p
Definition: MSPolColumns.h:209
A class to provide easy read-write access to MSPolarization columns.
Definition: MSPolColumns.h:163
ROArrayColumn< Int > corrType_p
Definition: MSPolColumns.h:125
A class to provide easy read-only access to MSPolarization columns.
Definition: MSPolColumns.h:75
ArrayColumn< Int > & corrType()
Definition: MSPolColumns.h:175
Bool matchCorrType(uInt row, const Vector< Int > &polType) const
Bool matchCorrProduct(uInt row, const Matrix< Int > &polProduct) const
ArrayColumn< Int > & corrProduct()
Read-write access to required columns.
Definition: MSPolColumns.h:174
const ROArrayColumn< Int > & corrType() const
Definition: MSPolColumns.h:184
ScalarColumn< Int > & numCorr()
Definition: MSPolColumns.h:177
const ROArrayColumn< Int > & corrType() const
Definition: MSPolColumns.h:87
ArrayColumn< Int > corrProduct_p
Definition: MSPolColumns.h:207
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42