casacore
Loading...
Searching...
No Matches
MSDataDescColumns.h
Go to the documentation of this file.
1//# MSDataDescColumns.h: provides easy access to MSDataDescription columns
2//# Copyright (C) 1996,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_MSDATADESCCOLUMNS_H
27#define MS_MSDATADESCCOLUMNS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/tables/Tables/ScalarColumn.h>
31
32namespace casacore { //# NAMESPACE CASACORE - BEGIN
33
34class MSDataDescription;
35
36// <summary>
37// A class to provide easy access to MSDataDescription columns
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
43// </reviewed>
44
45// <prerequisite>
46// <li> MSDataDesc
47// <li> ScalarColumn
48// </prerequisite>
49//
50// <etymology>
51// MSDataDescColumns stands for MeasurementSet DataDescription Table
52// columns.
53// </etymology>
54//
55// <synopsis>
56// This class provides access to the columns in the MSDataDesc Table,
57// it does the declaration of all the Scalar and ArrayColumns with the
58// correct types, so the application programmer doesn't have to
59// worry about getting those right. There is an access function
60// for every predefined column. Access to non-predefined columns will still
61// have to be done with explicit declarations.
62// See <linkto class=MSColumns> MSColumns</linkto> for an example.
63// <note role=warning> The Table that is used to construct this class must not
64// be destroyed (or go out of scope) before this class does. Otherwise the
65// scalar and array columns use by this class will be left dangling.</note>
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
77
78 // The destructor does nothing special
80
81 // Access to required columns
82 // <group>
86 // </group>
87
88 // Const access to required columns
89 // <group>
90 const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
93 // </group>
94
95 // Access to optional columns
96 // <group>
98 // </group>
99
100 // Const access to optional columns
101 // <group>
102 const ScalarColumn<Int>& lagId() const {return lagId_p;}
103 // </group>
104
105 // Convenience function that returns the number of rows in any of the columns
106 rownr_t nrow() const {return flagRow_p.nrow();}
107
108 // returns the last row that contains the specified entries in the
109 // SPECTRAL_WINDOW_ID & POLARIZATION_ID columns. Returns -1 if no match could
110 // be found. Flagged rows can never match. If tryRow is non-negative, then
111 // that row is tested to see if it matches before any others are
112 // tested. Setting tryRow to a positive value greater than the table length
113 // will throw an exception (AipsError).
114 Int64 match(uInt spwId, uInt polId, Int64 tryRow=-1);
115
116protected:
117 //# default constructor creates a object that is not usable. Use the attach
118 //# function correct this.
120
121 //# attach all the columns in the supplied table to this object
122 void attach(const MSDataDescription& msDataDesc);
123
124private:
125 //# Make the assignment operator and the copy constructor private to prevent
126 //# any compiler generated one from being used.
129
130 //# attach optional columns in the supplied Table (if they exist)
131 void attachOptionalCols(const MSDataDescription& msDataDesc);
132
133 //# required columns
137 //# optional columns
139};
140
141//# Define the RO version for backward compatibility.
143
144} //# NAMESPACE CASACORE - END
145
146#endif
const ScalarColumn< Bool > & flagRow() const
Const access to required columns.
MSDataDescColumns(const MSDataDescColumns &)
void attach(const MSDataDescription &msDataDesc)
ScalarColumn< Int > polarizationId_p
const ScalarColumn< Int > & polarizationId() const
void attachOptionalCols(const MSDataDescription &msDataDesc)
ScalarColumn< Bool > flagRow_p
ScalarColumn< Int > & lagId()
Access to optional columns.
ScalarColumn< Int > spectralWindowId_p
ScalarColumn< Bool > & flagRow()
Access to required columns.
MSDataDescColumns(const MSDataDescription &msDataDesc)
Create a columns object that accesses the data in the specified Table.
MSDataDescColumns & operator=(const MSDataDescColumns &)
~MSDataDescColumns()
The destructor does nothing special.
const ScalarColumn< Int > & spectralWindowId() const
Int64 match(uInt spwId, uInt polId, Int64 tryRow=-1)
returns the last row that contains the specified entries in the SPECTRAL_WINDOW_ID & POLARIZATION_ID ...
ScalarColumn< Int > & spectralWindowId()
ScalarColumn< Int > & polarizationId()
const ScalarColumn< Int > & lagId() const
Const access to optional columns.
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
rownr_t nrow() const
Get the number of rows in the column.
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
MSDataDescColumns ROMSDataDescColumns
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition aipsxtype.h:36
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44