casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSProcessorColumns.h
Go to the documentation of this file.
1 //# MSProcessorColumns.h: provides easy access to MSProcessor 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_MSPROCESSORCOLUMNS_H
29 #define MS_MSPROCESSORCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 class MSProcessor;
38 
39 // <summary>
40 // A class to provide easy access to MSProcessor 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> MSProcessor
50 // <li> ScalarColumn
51 // </prerequisite>
52 //
53 // <etymology>
54 // MSProcessorColumns stands for MeasurementSet Processor Table columns.
55 // </etymology>
56 //
57 // <synopsis>
58 // This class provides access to the columns in the MSProcessor 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 // </synopsis>
66 //
67 // <motivation>
68 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
69 // </motivation>
70 
72 {
73 public:
74  // Create a columns object that accesses the data in the specified Table
75  MSProcessorColumns(const MSProcessor& msProcessor);
76 
77  // The destructor does nothing special
79 
80  // Access to required columns
81  // <group>
87  // </group>
88 
89  // Access to optional columns
90  // <group>
92  // </group>
93 
94  // Const access to required columns
95  // <group>
96  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
97  const ScalarColumn<Int>& modeId() const {return modeId_p;}
98  const ScalarColumn<String>& type() const {return type_p;}
99  const ScalarColumn<Int>& typeId() const {return typeId_p;}
100  const ScalarColumn<String>& subType() const {return subType_p;}
101  // </group>
102 
103  // Const access to optional columns
104  // <group>
105  const ScalarColumn<Int>& passId() const {return passId_p;}
106  // </group>
107 
108  // Convenience function that returns the number of rows in any of the columns
109  rownr_t nrow() const {return flagRow_p.nrow();}
110 
111 protected:
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 MSProcessor& msProcessor);
118 
119 private:
120  //# Make the assignment operator and the copy constructor private to prevent
121  //# any compiler generated one from being used.
124 
125  //# Check if any optional columns exist and if so attach them.
126  void attachOptionalCols(const MSProcessor& msProcessor);
127 
128  //# required columns
134  //# optional columns
136 };
137 
138 //# Define the RO version for backward compatibility.
140 
141 } //# NAMESPACE CASACORE - END
142 
143 #endif
const ScalarColumn< Int > & modeId() const
MSProcessorColumns ROMSProcessorColumns
A Table intended to hold a MeasurementSet PROCESSOR table.
Definition: MSProcessor.h:77
ScalarColumn< Int > & typeId()
const ScalarColumn< Bool > & flagRow() const
Const access to required columns.
ScalarColumn< Int > & passId()
Access to optional columns.
const ScalarColumn< String > & subType() const
ScalarColumn< String > & type()
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
~MSProcessorColumns()
The destructor does nothing special.
ScalarColumn< Bool > & flagRow()
Access to required columns.
ScalarColumn< Int > & modeId()
void attach(const MSProcessor &msProcessor)
A class to provide easy access to MSProcessor columns.
const ScalarColumn< Int > & typeId() const
ScalarColumn< String > subType_p
const ScalarColumn< String > & type() const
MSProcessorColumns & operator=(const MSProcessorColumns &)
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
ScalarColumn< String > & subType()
void attachOptionalCols(const MSProcessor &msProcessor)
ScalarColumn< String > type_p
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarColumn< Bool > flagRow_p
const ScalarColumn< Int > & passId() const
Const access to optional columns.