casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSStateColumns.h
Go to the documentation of this file.
1 //# MSStateColumns.h: provides easy access to MSState 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_MSSTATECOLUMNS_H
29 #define MS_MSSTATECOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 class MSState;
39 
40 // <summary>
41 // A class to provide easy read-only access to MSState columns
42 // </summary>
43 
44 // <use visibility=export>
45 
46 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> MSState
51 // <li> ScalarColumn
52 // </prerequisite>
53 //
54 // <etymology>
55 // ROMSStateColumns stands for Read-Only MeasurementSet State Table columns.
56 // </etymology>
57 //
58 // <synopsis>
59 // This class provides read-only access to the columns in the MSState Table.
60 // It does the declaration of all the Scalar and ArrayColumns with the
61 // correct types, so the application programmer doesn't have to
62 // worry about getting those right. There is an access function
63 // for every predefined column. Access to non-predefined columns will still
64 // have to be done with explicit declarations.
65 // See <linkto class=ROMSColumns> 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  ROMSStateColumns(const MSState& msState);
77 
78  // The destructor does nothing special
80 
81  // Access to required columns
82  // <group>
83  const ROScalarColumn<Double>& cal() const {return cal_p;}
84  const ROScalarQuantColumn<Double>& calQuant() const { return calQuant_p;}
85  const ROScalarColumn<Bool>& flagRow() const {return flagRow_p;}
86  const ROScalarColumn<Double>& load() const {return load_p;}
87  const ROScalarQuantColumn<Double>& loadQuant() const { return loadQuant_p;}
88  const ROScalarColumn<String>& obsMode() const {return obsMode_p;}
89  const ROScalarColumn<Bool>& ref() const {return ref_p;}
90  const ROScalarColumn<Bool>& sig() const {return sig_p;}
91  const ROScalarColumn<Int>& subScan() const {return subScan_p;}
92  // </group>
93 
94  // Convenience function that returns the number of rows in any of the columns
95  uInt nrow() const {return cal_p.nrow();}
96 
97  // Returns the last row that contains a state with the specified values.
98  // For Cal and Load, the tolerance is applied in the match.
99  // Returns -1 if no match could be found. Flagged rows can never match.
100  // If tryRow is non-negative, then that row is tested
101  // to see if it matches before any others are tested. Setting tryRow to a
102  // positive value greater than the table length will throw an exception
103  // (AipsError), when compiled in debug mode.
104  Int matchState(const Quantum<Double>& stateCalQ,
105  const Quantum<Double>& stateLoadQ,
106  const String& stateObsMode,
107  const Bool& stateRef,
108  const Bool& stateSig,
109  const Int& stateSubScan,
110  const Quantum<Double>& tolerance,
111  Int tryRow=-1);
112 
113 
114 protected:
115  //# default constructor creates a object that is not usable. Use the attach
116  //# function correct this.
118 
119  //# attach this object to the supplied table.
120  void attach(const MSState& msState);
121 
122 private:
123  //# Make the assignment operator and the copy constructor private to prevent
124  //# any compiler generated one from being used.
127 
128  //# required columns
129  ROScalarColumn<Double> cal_p;
130  ROScalarColumn<Bool> flagRow_p;
131  ROScalarColumn<Double> load_p;
132  ROScalarColumn<String> obsMode_p;
133  ROScalarColumn<Bool> ref_p;
134  ROScalarColumn<Bool> sig_p;
135  ROScalarColumn<Int> subScan_p;
136 
137  //# Access to Quantum columns
138  ROScalarQuantColumn<Double> calQuant_p;
139  ROScalarQuantColumn<Double> loadQuant_p;
140 };
141 
142 // <summary>
143 // A class to provide easy read-write access to MSState columns
144 // </summary>
145 
146 // <use visibility=export>
147 
148 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
149 // </reviewed>
150 
151 // <prerequisite>
152 // <li> MSState
153 // <li> ScalarColumn
154 // </prerequisite>
155 //
156 // <etymology>
157 // MSStateColumns stands for MeasurementSet State Table columns.
158 // </etymology>
159 //
160 // <synopsis>
161 // This class provides access to the columns in the MSState Table,
162 // it does the declaration of all the Scalar and ArrayColumns with the
163 // correct types, so the application programmer doesn't have to
164 // worry about getting those right. There is an access function
165 // for every predefined column. Access to non-predefined columns will still
166 // have to be done with explicit declarations.
167 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
168 // </synopsis>
169 //
170 // <motivation>
171 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
172 // </motivation>
173 
175 {
176 public:
177  // Create a columns object that accesses the data in the specified Table
178  MSStateColumns(MSState& msState);
179 
180  // The destructor does nothing special
181  ~MSStateColumns();
182 
183  // Read-write access to required columns
184  // <group>
194  // </group>
195 
196  // Read-only access to required columns
197  // <group>
198  // </group>
199 
200 protected:
201  //# default constructor creates a object that is not usable. Use the attach
202  //# function correct this.
203  MSStateColumns();
204 
205  //# attach this object to the supplied table.
206  void attach(MSState& msState);
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  //# required columns
222 
223  // Access to Quantum columns
226 };
227 
228 } //# NAMESPACE CASACORE - END
229 
230 #endif
ScalarColumn< Int > & subScan()
~ROMSStateColumns()
The destructor does nothing special.
int Int
Definition: aipstype.h:50
const ROScalarColumn< Bool > & sig() const
Int matchState(const Quantum< Double > &stateCalQ, const Quantum< Double > &stateLoadQ, const String &stateObsMode, const Bool &stateRef, const Bool &stateSig, const Int &stateSubScan, const Quantum< Double > &tolerance, Int tryRow=-1)
Returns the last row that contains a state with the specified values.
ROScalarColumn< Bool > ref_p
void attach(MSState &msState)
~MSStateColumns()
The destructor does nothing special.
MSStateColumns()
Read-only access to required columns.
ScalarColumn< Int > subScan_p
ROScalarQuantColumn< Double > calQuant_p
ScalarColumn< Bool > & ref()
ROScalarColumn< String > obsMode_p
ScalarColumn< Bool > sig_p
const ROScalarQuantColumn< Double > & calQuant() const
ScalarColumn< Bool > & flagRow()
const ROScalarQuantColumn< Double > & loadQuant() const
const ROScalarColumn< Bool > & flagRow() const
ScalarQuantColumn< Double > & calQuant()
ScalarQuantColumn< Double > loadQuant_p
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarColumn< Double > & load()
ROScalarColumn< Double > load_p
MSStateColumns & operator=(const MSStateColumns &)
const ROScalarColumn< Double > & load() const
A class to provide easy read-only access to MSState columns.
ScalarColumn< Bool > ref_p
ScalarColumn< String > & obsMode()
ROScalarColumn< Bool > flagRow_p
ROMSStateColumns & operator=(const ROMSStateColumns &)
A Table intended to hold a MeasurementSet STATE table.
Definition: MSState.h:79
ScalarColumn< Double > cal_p
void attach(const MSState &msState)
ScalarColumn< String > obsMode_p
ScalarQuantColumn< Double > & loadQuant()
const ROScalarColumn< String > & obsMode() const
ROScalarColumn< Bool > sig_p
const ROScalarColumn< Bool > & ref() const
ScalarQuantColumn< Double > calQuant_p
Access to Quantum columns.
ScalarColumn< Double > load_p
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ScalarColumn< Bool > flagRow_p
const ROScalarColumn< Double > & cal() const
Access to required columns.
ROScalarColumn< Double > cal_p
ROScalarQuantColumn< Double > loadQuant_p
ROScalarColumn< Int > subScan_p
String: the storage and methods of handling collections of characters.
Definition: String.h:223
A class to provide easy read-write access to MSState columns.
const ROScalarColumn< Int > & subScan() const
ScalarColumn< Bool > & sig()
unsigned int uInt
Definition: aipstype.h:51
ScalarColumn< Double > & cal()
Read-write access to required columns.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42