casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MS_MSSTATECOLUMNS_H
27#define MS_MSSTATECOLUMNS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/tables/Tables/ScalarColumn.h>
31#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
32#include <casacore/casa/BasicSL/String.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36class MSState;
37
38// <summary>
39// A class to provide easy access to MSState 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> MSState
49// <li> ScalarColumn
50// </prerequisite>
51//
52// <etymology>
53// MSStateColumns stands for MeasurementSet State Table columns.
54// </etymology>
55//
56// <synopsis>
57// This class provides access to the columns in the MSState Table,
58// it does the declaration of all the Scalar and ArrayColumns with the
59// correct types, so the application programmer doesn't have to
60// worry about getting those right. There is an access function
61// for every predefined column. Access to non-predefined columns will still
62// have to be done with explicit declarations.
63// See <linkto class=MSColumns> MSColumns</linkto> for an example.
64// </synopsis>
65//
66// <motivation>
67// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
68// </motivation>
69
71 public:
72 // Create a columns object that accesses the data in the specified Table
73 MSStateColumns(const MSState& msState);
74
75 // The destructor does nothing special
77
78 // Access to required columns
79 // <group>
89 // </group>
90
91 // Const access to required columns
92 // <group>
93 const ScalarColumn<Double>& cal() const { return cal_p; }
95 const ScalarColumn<Bool>& flagRow() const { return flagRow_p; }
96 const ScalarColumn<Double>& load() const { return load_p; }
98 const ScalarColumn<String>& obsMode() const { return obsMode_p; }
99 const ScalarColumn<Bool>& ref() const { return ref_p; }
100 const ScalarColumn<Bool>& sig() const { return sig_p; }
101 const ScalarColumn<Int>& subScan() const { return subScan_p; }
102 // </group>
103
104 // Convenience function that returns the number of rows in any of the columns
105 rownr_t nrow() const { return cal_p.nrow(); }
106
107 // Returns the last row that contains a state with the specified values.
108 // For Cal and Load, the tolerance is applied in the match.
109 // Returns -1 if no match could be found. Flagged rows can never match.
110 // If tryRow is non-negative, then that row is tested
111 // to see if it matches before any others are tested. Setting tryRow to a
112 // positive value greater than the table length will throw an exception
113 // (AipsError), when compiled in debug mode.
114 Int64 matchState(const Quantum<Double>& stateCalQ, const Quantum<Double>& stateLoadQ,
115 const String& stateObsMode, const Bool& stateRef, const Bool& stateSig,
116 const Int& stateSubScan, const Quantum<Double>& tolerance, 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 this object to the supplied table.
124 void attach(const MSState& msState);
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 // # required columns
140
141 // Access to Quantum columns
144};
145
146// # Define the RO version for backward compatibility.
148
149} // namespace casacore
150
151#endif
MSStateColumns & operator=(const MSStateColumns &)
ScalarQuantColumn< Double > & loadQuant()
MSStateColumns(const MSStateColumns &)
ScalarColumn< Bool > flagRow_p
const ScalarColumn< Bool > & sig() const
ScalarColumn< Double > & load()
ScalarColumn< Bool > & flagRow()
ScalarColumn< Double > load_p
ScalarQuantColumn< Double > & calQuant()
ScalarColumn< String > obsMode_p
ScalarColumn< Int > subScan_p
ScalarQuantColumn< Double > loadQuant_p
~MSStateColumns()
The destructor does nothing special.
const ScalarColumn< String > & obsMode() const
ScalarColumn< Bool > ref_p
const ScalarColumn< Double > & load() const
ScalarColumn< Double > cal_p
ScalarQuantColumn< Double > calQuant_p
Access to Quantum columns.
ScalarColumn< Double > & cal()
Access to required columns.
ScalarColumn< Bool > & sig()
ScalarColumn< Int > & subScan()
const ScalarQuantColumn< Double > & calQuant() const
ScalarColumn< String > & obsMode()
const ScalarColumn< Bool > & ref() const
MSStateColumns(const MSState &msState)
Create a columns object that accesses the data in the specified Table.
const ScalarColumn< Int > & subScan() const
const ScalarQuantColumn< Double > & loadQuant() const
ScalarColumn< Bool > & ref()
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.
const ScalarColumn< Bool > & flagRow() const
const ScalarColumn< Double > & cal() const
Const access to required columns.
ScalarColumn< Bool > sig_p
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
void attach(const MSState &msState)
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
MSStateColumns ROMSStateColumns
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44