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 public:
74 // Create a columns object that accesses the data in the specified Table
75 MSPolarizationColumns(const MSPolarization& msPolarization);
76
77 // The destructor does nothing special
79
80 // Access to required columns
81 // <group>
86 // </group>
87
88 // Const access to required columns
89 // <group>
90 const ArrayColumn<Int>& corrProduct() const { return corrProduct_p; }
91 const ArrayColumn<Int>& corrType() const { return corrType_p; }
92 const ScalarColumn<Bool>& flagRow() const { return flagRow_p; }
93 const ScalarColumn<Int>& numCorr() const { return numCorr_p; }
94 // </group>
95
96 // Convenience function that returns the number of rows in any of the columns
97 rownr_t nrow() const { return corrProduct_p.nrow(); }
98
99 // returns the last row that contains the an entry in the CORR_TYPE column
100 // that matches, in length and value, the supplied corrType Vector. Returns
101 // -1 if no match could be found. Flagged rows can never match. If tryRow is
102 // non-negative, then that row is tested to see if it matches before any
103 // others are tested. Setting tryRow to a positive value greater than the
104 // table length will throw an exception (AipsError), when compiled in debug
105 // mode.
106 Int64 match(const Vector<Stokes::StokesTypes>& polType, Int64 tryRow = -1);
107
108 protected:
109 // # default constructor creates a object that is not usable. Use the attach
110 // # function correct this.
112
113 // # attach this object to the supplied table.
114 void attach(const MSPolarization& msPolarization);
115
116 private:
117 // # Make the assignment operator and the copy constructor private to prevent
118 // # any compiler generated one from being used.
121
122 // # Functions which check the supplied values against the relevant column and
123 // # the specified row.
124 Bool matchCorrType(rownr_t row, const Vector<Int>& polType) const;
125 Bool matchCorrProduct(rownr_t row, const Matrix<Int>& polProduct) const;
126
127 // # required columns
132};
133
134// # Define the RO version for backward compatibility.
136
137} // namespace casacore
138
139#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()
For temporary backward namespace compatibility, use casa as alias for casacore.
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