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
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 public:
74 // Create a columns object that accesses the data in the specified Table
76
77 // The destructor does nothing special
79
80 // Access to required columns
81 // <group>
85 // </group>
86
87 // Const access to required columns
88 // <group>
89 const ScalarColumn<Bool>& flagRow() const { return flagRow_p; }
92 // </group>
93
94 // Access to optional columns
95 // <group>
97 // </group>
98
99 // Const access to optional columns
100 // <group>
101 const ScalarColumn<Int>& lagId() const { return lagId_p; }
102 // </group>
103
104 // Convenience function that returns the number of rows in any of the columns
105 rownr_t nrow() const { return flagRow_p.nrow(); }
106
107 // returns the last row that contains the specified entries in the
108 // SPECTRAL_WINDOW_ID & POLARIZATION_ID columns. Returns -1 if no match could
109 // be found. Flagged rows can never match. If tryRow is non-negative, then
110 // that row is tested to see if it matches before any others are
111 // tested. Setting tryRow to a positive value greater than the table length
112 // will throw an exception (AipsError).
113 Int64 match(uInt spwId, uInt polId, Int64 tryRow = -1);
114
115 protected:
116 // # default constructor creates a object that is not usable. Use the attach
117 // # function correct this.
119
120 // # attach all the columns in the supplied table to this object
121 void attach(const MSDataDescription& msDataDesc);
122
123 private:
124 // # Make the assignment operator and the copy constructor private to prevent
125 // # any compiler generated one from being used.
128
129 // # attach optional columns in the supplied Table (if they exist)
130 void attachOptionalCols(const MSDataDescription& msDataDesc);
131
132 // # required columns
136 // # optional columns
138};
139
140// # Define the RO version for backward compatibility.
142
143} // namespace casacore
144
145#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.
For temporary backward namespace compatibility, use casa as alias for casacore.
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