casacore
 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 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 // MSStateColumns stands for MeasurementSet State Table columns.
56 // </etymology>
57 //
58 // <synopsis>
59 // This class provides 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=MSColumns> MSColumns</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  MSStateColumns(const MSState& msState);
77 
78  // The destructor does nothing special
80 
81  // Access to required columns
82  // <group>
92  // </group>
93 
94  // Const access to required columns
95  // <group>
96  const ScalarColumn<Double>& cal() const {return cal_p;}
97  const ScalarQuantColumn<Double>& calQuant() const { return calQuant_p;}
98  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
99  const ScalarColumn<Double>& load() const {return load_p;}
101  const ScalarColumn<String>& obsMode() const {return obsMode_p;}
102  const ScalarColumn<Bool>& ref() const {return ref_p;}
103  const ScalarColumn<Bool>& sig() const {return sig_p;}
104  const ScalarColumn<Int>& subScan() const {return subScan_p;}
105  // </group>
106 
107  // Convenience function that returns the number of rows in any of the columns
108  rownr_t nrow() const {return cal_p.nrow();}
109 
110  // Returns the last row that contains a state with the specified values.
111  // For Cal and Load, the tolerance is applied in the match.
112  // Returns -1 if no match could be found. Flagged rows can never match.
113  // If tryRow is non-negative, then that row is tested
114  // to see if it matches before any others are tested. Setting tryRow to a
115  // positive value greater than the table length will throw an exception
116  // (AipsError), when compiled in debug mode.
117  Int64 matchState(const Quantum<Double>& stateCalQ,
118  const Quantum<Double>& stateLoadQ,
119  const String& stateObsMode,
120  const Bool& stateRef,
121  const Bool& stateSig,
122  const Int& stateSubScan,
123  const Quantum<Double>& tolerance,
124  Int64 tryRow=-1);
125 
126 protected:
127  //# default constructor creates a object that is not usable. Use the attach
128  //# function correct this.
129  MSStateColumns();
130 
131  //# attach this object to the supplied table.
132  void attach(const MSState& msState);
133 
134 private:
135  //# Make the assignment operator and the copy constructor private to prevent
136  //# any compiler generated one from being used.
139 
140  //# required columns
148 
149  // Access to Quantum columns
152 };
153 
154 //# Define the RO version for backward compatibility.
156 
157 } //# NAMESPACE CASACORE - END
158 
159 #endif
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
ScalarColumn< Int > & subScan()
int Int
Definition: aipstype.h:50
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
~MSStateColumns()
The destructor does nothing special.
ScalarColumn< Int > subScan_p
const ScalarColumn< Double > & load() const
ScalarColumn< Bool > & ref()
ScalarColumn< Bool > sig_p
ScalarColumn< Bool > & flagRow()
Int64 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, Int64 tryRow=-1)
Returns the last row that contains a state with the specified values.
ScalarQuantColumn< Double > & calQuant()
const ScalarColumn< Double > & cal() const
Const access to required columns.
ScalarQuantColumn< Double > loadQuant_p
const ScalarColumn< Bool > & ref() const
ScalarColumn< Double > & load()
MSStateColumns & operator=(const MSStateColumns &)
const ScalarQuantColumn< Double > & calQuant() const
ScalarColumn< Bool > ref_p
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
ScalarColumn< String > & obsMode()
A Table intended to hold a MeasurementSet STATE table.
Definition: MSState.h:79
ScalarColumn< Double > cal_p
ScalarColumn< String > obsMode_p
ScalarQuantColumn< Double > & loadQuant()
const ScalarColumn< Bool > & flagRow() 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
const ScalarColumn< String > & obsMode() const
const ScalarColumn< Int > & subScan() const
ScalarColumn< Bool > flagRow_p
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
const ScalarQuantColumn< Double > & loadQuant() const
const ScalarColumn< Bool > & sig() const
String: the storage and methods of handling collections of characters.
Definition: String.h:225
void attach(const MSState &msState)
A class to provide easy access to MSState columns.
MSStateColumns ROMSStateColumns
ScalarColumn< Bool > & sig()
ScalarColumn< Double > & cal()
Access to required columns.