casacore
 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>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 class MSPolarization;
40 
41 // <summary>
42 // A class to provide easy access to MSPolarization columns
43 // </summary>
44 
45 // <use visibility=export>
46 
47 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
48 // </reviewed>
49 
50 // <prerequisite>
51 // <li> MSPolarization
52 // <li> ArrayColumn
53 // <li> ScalarColumn
54 // </prerequisite>
55 //
56 // <etymology>
57 // MSPolarizationColumns stands for MeasurementSet Polarization Table columns.
58 // </etymology>
59 //
60 // <synopsis>
61 // This class provides access to the columns in the MSPolarization Table,
62 // it does the declaration of all the Scalar and ArrayColumns with the
63 // correct types, so the application programmer doesn't have to
64 // worry about getting those right. There is an access function
65 // for every predefined column. Access to non-predefined columns will still
66 // have to be done with explicit declarations.
67 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
68 // </synopsis>
69 //
70 // <motivation>
71 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
72 // </motivation>
73 
75 {
76 public:
77  // Create a columns object that accesses the data in the specified Table
78  MSPolarizationColumns(const MSPolarization& msPolarization);
79 
80  // The destructor does nothing special
82 
83  // Access to required columns
84  // <group>
89  // </group>
90 
91  // Const access to required columns
92  // <group>
93  const ArrayColumn<Int>& corrProduct() const {return corrProduct_p;}
94  const ArrayColumn<Int>& corrType() const {return corrType_p;}
95  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
96  const ScalarColumn<Int>& numCorr() const {return numCorr_p;}
97  // </group>
98 
99  // Convenience function that returns the number of rows in any of the columns
100  rownr_t nrow() const {return corrProduct_p.nrow();}
101 
102  // returns the last row that contains the an entry in the CORR_TYPE column
103  // that matches, in length and value, the supplied corrType Vector. Returns
104  // -1 if no match could be found. Flagged rows can never match. If tryRow is
105  // non-negative, then that row is tested to see if it matches before any
106  // others are tested. Setting tryRow to a positive value greater than the
107  // table length will throw an exception (AipsError), when compiled in debug
108  // mode.
109  Int64 match(const Vector<Stokes::StokesTypes>& polType, Int64 tryRow=-1);
110 
111 protected:
112  //# default constructor creates a object that is not usable. Use the attach
113  //# function correct this.
115 
116  //# attach this object to the supplied table.
117  void attach(const MSPolarization& msPolarization);
118 
119 private:
120  //# Make the assignment operator and the copy constructor private to prevent
121  //# any compiler generated one from being used.
124 
125  //# Functions which check the supplied values against the relevant column and
126  //# the specified row.
127  Bool matchCorrType(rownr_t row, const Vector<Int>& polType) const;
128  Bool matchCorrProduct(rownr_t row, const Matrix<Int>& polProduct) const;
129 
130  //# required columns
135 };
136 
137 //# Define the RO version for backward compatibility.
139 
140 } //# NAMESPACE CASACORE - END
141 
142 #endif
A 1-D Specialization of the Array class.
Definition: ArrayFwd.h:9
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
const ScalarColumn< Int > & numCorr() const
Definition: MSPolColumns.h:96
Bool matchCorrProduct(rownr_t row, const Matrix< Int > &polProduct) const
Int64 match(const Vector< Stokes::StokesTypes > &polType, Int64 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.
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
Definition: MSPolColumns.h:100
const ArrayColumn< Int > & corrProduct() const
Const access to required columns.
Definition: MSPolColumns.h:93
Bool matchCorrType(rownr_t row, const Vector< Int > &polType) const
void attach(const MSPolarization &msPolarization)
~MSPolarizationColumns()
The destructor does nothing special.
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
MSPolarizationColumns & operator=(const MSPolarizationColumns &)
ScalarColumn< Bool > & flagRow()
Definition: MSPolColumns.h:87
const ScalarColumn< Bool > & flagRow() const
Definition: MSPolColumns.h:95
const ArrayColumn< Int > & corrType() const
Definition: MSPolColumns.h:94
A Table intended to hold a MeasurementSet POLARIZATION table.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ScalarColumn< Int > numCorr_p
Definition: MSPolColumns.h:134
ArrayColumn< Int > corrType_p
Definition: MSPolColumns.h:132
ScalarColumn< Bool > flagRow_p
Definition: MSPolColumns.h:133
A class to provide easy access to MSPolarization columns.
Definition: MSPolColumns.h:74
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
ArrayColumn< Int > & corrType()
Definition: MSPolColumns.h:86
ArrayColumn< Int > & corrProduct()
Access to required columns.
Definition: MSPolColumns.h:85
ScalarColumn< Int > & numCorr()
Definition: MSPolColumns.h:88
ArrayColumn< Int > corrProduct_p
Definition: MSPolColumns.h:131
MSPolarizationColumns ROMSPolarizationColumns
Definition: MSPolColumns.h:138