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: 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/casa/Arrays/ArrayFwd.h>
33#include <casacore/tables/Tables/ArrayColumn.h>
34#include <casacore/tables/Tables/ScalarColumn.h>
35#include <casacore/measures/Measures/Stokes.h>
36
37namespace casacore { //# NAMESPACE CASACORE - BEGIN
38
39class 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{
76public:
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>
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
111protected:
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
119private:
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
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:38
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:42
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:46