casacore
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>
32 #include <casacore/tables/Tables/ArrayColumn.h>
33 #include <casacore/tables/Tables/ScalarColumn.h>
34 #include <casacore/measures/Measures/Stokes.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 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 // MSPolarizationColumns stands for MeasurementSet Polarization Table columns.
59 // </etymology>
60 //
61 // <synopsis>
62 // This class provides 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=MSColumns> MSColumns</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  MSPolarizationColumns(const MSPolarization& msPolarization);
80 
81  // The destructor does nothing special
83 
84  // Access to required columns
85  // <group>
90  // </group>
91 
92  // Const access to required columns
93  // <group>
94  const ArrayColumn<Int>& corrProduct() const {return corrProduct_p;}
95  const ArrayColumn<Int>& corrType() const {return corrType_p;}
96  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
97  const ScalarColumn<Int>& numCorr() const {return numCorr_p;}
98  // </group>
99 
100  // Convenience function that returns the number of rows in any of the columns
101  uInt nrow() const {return corrProduct_p.nrow();}
102 
103  // returns the last row that contains the an entry in the CORR_TYPE column
104  // that matches, in length and value, the supplied corrType Vector. Returns
105  // -1 if no match could be found. Flagged rows can never match. If tryRow is
106  // non-negative, then that row is tested to see if it matches before any
107  // others are tested. Setting tryRow to a positive value greater than the
108  // table length will throw an exception (AipsError), when compiled in debug
109  // mode.
110  Int match(const Vector<Stokes::StokesTypes>& polType, Int tryRow=-1);
111 
112 protected:
113  //# default constructor creates a object that is not usable. Use the attach
114  //# function correct this.
116 
117  //# attach this object to the supplied table.
118  void attach(const MSPolarization& msPolarization);
119 
120 private:
121  //# Make the assignment operator and the copy constructor private to prevent
122  //# any compiler generated one from being used.
125 
126  //# Functions which check the supplied values against the relevant column and
127  //# the specified row.
128  Bool matchCorrType(uInt row, const Vector<Int>& polType) const;
129  Bool matchCorrProduct(uInt row, const Matrix<Int>& polProduct) const;
130 
131  //# required columns
136 };
137 
138 //# Define the RO version for backward compatibility.
140 
141 } //# NAMESPACE CASACORE - END
142 
143 #endif
casacore::MSPolarizationColumns::attach
void attach(const MSPolarization &msPolarization)
casacore::Matrix< Int >
casacore::MSPolarizationColumns::MSPolarizationColumns
MSPolarizationColumns(const MSPolarization &msPolarization)
Create a columns object that accesses the data in the specified Table.
casacore::MSPolarizationColumns::flagRow_p
ScalarColumn< Bool > flagRow_p
Definition: MSPolColumns.h:134
casacore::MSPolarizationColumns::corrProduct
ArrayColumn< Int > & corrProduct()
Access to required columns.
Definition: MSPolColumns.h:86
casacore::MSPolarizationColumns::match
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,...
casacore::MSPolarizationColumns::corrType
ArrayColumn< Int > & corrType()
Definition: MSPolColumns.h:87
casacore::MSPolarizationColumns::nrow
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
Definition: MSPolColumns.h:101
casacore::MSPolarizationColumns::operator=
MSPolarizationColumns & operator=(const MSPolarizationColumns &)
casacore::ScalarColumn< Bool >
casacore::MSPolarizationColumns::matchCorrProduct
Bool matchCorrProduct(uInt row, const Matrix< Int > &polProduct) const
casacore::ArrayColumn< Int >
casacore::MSPolarizationColumns::flagRow
const ScalarColumn< Bool > & flagRow() const
Definition: MSPolColumns.h:96
casacore::MSPolarizationColumns::~MSPolarizationColumns
~MSPolarizationColumns()
The destructor does nothing special.
casacore::MSPolarizationColumns::MSPolarizationColumns
MSPolarizationColumns()
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::MSPolarizationColumns::MSPolarizationColumns
MSPolarizationColumns(const MSPolarizationColumns &)
casacore::MSPolarizationColumns::corrProduct_p
ArrayColumn< Int > corrProduct_p
Definition: MSPolColumns.h:132
casacore::MSPolarizationColumns::numCorr_p
ScalarColumn< Int > numCorr_p
Definition: MSPolColumns.h:135
casacore::MSPolarizationColumns::matchCorrType
Bool matchCorrType(uInt row, const Vector< Int > &polType) const
casacore::MSPolarizationColumns::corrProduct
const ArrayColumn< Int > & corrProduct() const
Const access to required columns.
Definition: MSPolColumns.h:94
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::MSPolarizationColumns::numCorr
ScalarColumn< Int > & numCorr()
Definition: MSPolColumns.h:89
casacore::MSPolarizationColumns::flagRow
ScalarColumn< Bool > & flagRow()
Definition: MSPolColumns.h:88
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::MSPolarizationColumns::corrType
const ArrayColumn< Int > & corrType() const
Definition: MSPolColumns.h:95
casacore::Vector
A 1-D Specialization of the Array class.
Definition: ArrayIO.h:45
casacore::ROMSPolarizationColumns
MSPolarizationColumns ROMSPolarizationColumns
Definition: MSPolColumns.h:139
casacore::MSPolarizationColumns::corrType_p
ArrayColumn< Int > corrType_p
Definition: MSPolColumns.h:133
casacore::MSPolarizationColumns::numCorr
const ScalarColumn< Int > & numCorr() const
Definition: MSPolColumns.h:97
casacore::MSPolarization
A Table intended to hold a MeasurementSet POLARIZATION table.
Definition: MSPolarization.h:80
casacore::MSPolarizationColumns
A class to provide easy access to MSPolarization columns.
Definition: MSPolColumns.h:76