casa  5.7.0-16
 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 read-only 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> ArrayColumn
51 // <li> ScalarColumn
52 // </prerequisite>
53 //
54 // <etymology>
55 // ROMSProcessorColumns stands for Read-Only MeasurementSet Processor Table columns.
56 // </etymology>
57 //
58 // <synopsis>
59 // This class provides read-only access to the columns in the MSProcessor
60 // Table. It does the declaration of all the Scalar and ArrayColumns with the
61 // correct types, so the application programmer doesn't have to worry about
62 // getting those right. There is an access function for every predefined
63 // column. Access to non-predefined columns will still have to be done with
64 // explicit declarations. See <linkto class=ROMSColumns>
65 // ROMSColumns</linkto> for an example.
66 // </synopsis>
67 //
68 // <motivation>
69 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
70 // </motivation>
71 
73 {
74 public:
75  // Create a columns object that accesses the data in the specified Table
76  ROMSProcessorColumns(const MSProcessor& msProcessor);
77 
78  // The destructor does nothing special
80 
81  // Access to required columns
82  // <group>
83  const ROScalarColumn<Bool>& flagRow() const {return flagRow_p;}
84  const ROScalarColumn<Int>& modeId() const {return modeId_p;}
85  const ROScalarColumn<String>& type() const {return type_p;}
86  const ROScalarColumn<Int>& typeId() const {return typeId_p;}
87  const ROScalarColumn<String>& subType() const {return subType_p;}
88  // </group>
89 
90  // Read-only access to optional columns
91  // <group>
92  const ROScalarColumn<Int>& passId() const {return passId_p;}
93  // </group>
94 
95  // Convenience function that returns the number of rows in any of the columns
96  uInt nrow() const {return flagRow_p.nrow();}
97 
98 protected:
99  //# default constructor creates a object that is not usable. Use the attach
100  //# function correct this.
102 
103  //# attach this object to the supplied table.
104  void attach(const MSProcessor& msProcessor);
105 
106 private:
107  //# Make the assignment operator and the copy constructor private to prevent
108  //# any compiler generated one from being used.
111 
112  //# Check if any optional columns exist and if so attach them.
113  void attachOptionalCols(const MSProcessor& msField);
114 
115  //# required columns
116  ROScalarColumn<Bool> flagRow_p;
117  ROScalarColumn<Int> modeId_p;
118  ROScalarColumn<String> type_p;
119  ROScalarColumn<Int> typeId_p;
120  ROScalarColumn<String> subType_p;
121  //# optional columns
122  ROScalarColumn<Int> passId_p;
123 };
124 
125 // <summary>
126 // A class to provide easy read-write access to MSProcessor columns
127 // </summary>
128 
129 // <use visibility=export>
130 
131 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
132 // </reviewed>
133 
134 // <prerequisite>
135 // <li> MSProcessor
136 // <li> ScalarColumn
137 // </prerequisite>
138 //
139 // <etymology>
140 // MSProcessorColumns stands for MeasurementSet Processor Table columns.
141 // </etymology>
142 //
143 // <synopsis>
144 // This class provides access to the columns in the MSProcessor Table,
145 // it does the declaration of all the Scalar and ArrayColumns with the
146 // correct types, so the application programmer doesn't have to
147 // worry about getting those right. There is an access function
148 // for every predefined column. Access to non-predefined columns will still
149 // have to be done with explicit declarations.
150 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
151 // </synopsis>
152 //
153 // <motivation>
154 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
155 // </motivation>
156 
158 {
159 public:
160  // Create a columns object that accesses the data in the specified Table
161  MSProcessorColumns(MSProcessor& msProcessor);
162 
163  // The destructor does nothing special
165 
166  // Read-write access to required columns
167  // <group>
173  // </group>
174 
175  // Read-write access to optional columns
176  // <group>
178  // </group>
179 
180  // Read-only access to required columns
181  // <group>
182  const ROScalarColumn<Bool>& flagRow() const {
184  const ROScalarColumn<Int>& modeId() const {
186  const ROScalarColumn<String>& type() const {
187  return ROMSProcessorColumns::type();}
188  const ROScalarColumn<Int>& typeId() const {
190  const ROScalarColumn<String>& subType() const {
192  // </group>
193 
194  // Read-only access to optional columns
195  // <group>
196  const ROScalarColumn<Int>& passId() const {
198  // </group>
199 
200 protected:
201  //# default constructor creates a object that is not usable. Use the attach
202  //# function correct this.
204 
205  //# attach this object to the supplied table.
206  void attach(MSProcessor& msProcessor);
207 
208 private:
209  //# Make the assignment operator and the copy constructor private to prevent
210  //# any compiler generated one from being used.
213 
214  //# Check if any optional columns exist and if so attach them.
215  void attachOptionalCols(MSProcessor& msProcessor);
216 
217  //# required columns
223  //# optional columns
225 };
226 
227 } //# NAMESPACE CASACORE - END
228 
229 #endif
A Table intended to hold a MeasurementSet PROCESSOR table.
Definition: MSProcessor.h:77
ScalarColumn< Int > & typeId()
ROScalarColumn< String > subType_p
const ROScalarColumn< Int > & passId() const
Read-only access to optional columns.
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
const ROScalarColumn< Int > & typeId() const
const ROScalarColumn< String > & subType() const
ScalarColumn< Int > & passId()
Read-write access to optional columns.
const ROScalarColumn< Bool > & flagRow() const
Access to required columns.
const ROScalarColumn< Int > & passId() const
Read-only access to optional columns.
ROScalarColumn< String > type_p
const ROScalarColumn< Int > & modeId() const
A class to provide easy read-only access to MSProcessor columns.
ScalarColumn< String > & type()
ROScalarColumn< Bool > flagRow_p
~MSProcessorColumns()
The destructor does nothing special.
ScalarColumn< Bool > & flagRow()
Read-write access to required columns.
void attachOptionalCols(const MSProcessor &msField)
ScalarColumn< Int > & modeId()
void attach(const MSProcessor &msProcessor)
A class to provide easy read-write access to MSProcessor columns.
const ROScalarColumn< Int > & modeId() const
const ROScalarColumn< Bool > & flagRow() const
Read-only access to required columns.
ScalarColumn< String > subType_p
~ROMSProcessorColumns()
The destructor does nothing special.
void attachOptionalCols(MSProcessor &msProcessor)
MSProcessorColumns & operator=(const MSProcessorColumns &)
const ROScalarColumn< String > & type() const
const ROScalarColumn< String > & subType() const
ScalarColumn< String > & subType()
void attach(MSProcessor &msProcessor)
ROMSProcessorColumns & operator=(const ROMSProcessorColumns &)
ScalarColumn< String > type_p
ScalarColumn< Bool > flagRow_p
const ROScalarColumn< Int > & typeId() const
unsigned int uInt
Definition: aipstype.h:51
const ROScalarColumn< String > & type() const
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42