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