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