casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSValidIds.h
Go to the documentation of this file.
1 //# MSValidIds: ensures that required MS Ids are valid or -1 by row number
2 //# Copyright (C) 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 //#
27 //# $Id$
28 
29 #ifndef MS_MSVALIDIDS_H
30 #define MS_MSVALIDIDS_H
31 
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 //# Forward declarations
38 class ROMSColumns;
39 
40 // <summary>
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> MeasurementSet
50 // </prerequisite>
51 //
52 // <etymology>
53 // </etymology>
54 //
55 // <synopsis>
56 // </synopsis>
57 //
58 // <example>
59 // </example>
60 //
61 // <motivation>
62 // </motivation>
63 //
64 // <thrown>
65 // <li>
66 // <li>
67 // </thrown>
68 
70 {
71 public:
72  // Construct one unattached to a MeasurementSet. All functions return -1.
73  // Use the attach function to attach this to a MeasurementSet after construction.
74  MSValidIds();
75 
76  // Construct one attached to the indicated MeasurementSet
77  MSValidIds(const MeasurementSet &ms);
78 
79  // Construct one from another
80  MSValidIds(const MSValidIds &other);
81 
82  // The destructor
83  ~MSValidIds();
84 
85  // Assignment operator, reference semantics.
86  MSValidIds &operator=(const MSValidIds &other);
87 
88  // Attach this one to a MeasurementSet. This can also be used to
89  // re-attach to the same MeasurementSet when additional optional
90  // subtables have been added since this object was constructed.
91  void attach(const MeasurementSet &ms);
92 
93  // These functions check on the validity of the appropriate value in
94  // the main table or sub-tables in the case of some Ids. The actual
95  // value stored is returned unless the sub-table does not exist (for
96  // optional subtables) or the indicated row number does not exist
97  // in that sub-table where appropriate.
98  // <group>
99  Int antenna1(uInt rownr) const;
100  Int antenna2(uInt rownr) const;
101  Int dataDescId(uInt rownr) const;
102  Int fieldId(uInt rownr) const;
103  Int observationId(uInt rownr) const;
104  Int processorId(uInt rownr) const;
105  Int stateId(uInt rownr) const;
106  // The polarizationId comes from the DATA_DESCRIPTION subtable, so dataDescId must
107  // first be valid in order for this to also be valid.
108  Int polarizationId(uInt rownr) const;
109  // The spectralWindowId comes from the DATA_DESCRIPTION subtable, so dataDescId must
110  // first be valid in order for this to also be valid.
111  Int spectralWindowId(uInt rownr) const;
112  // the dopplerId comes from the SPECTRAL_WINDOW subtable so spectralWindowId must
113  // first be valid in order for this to also be valid. Since the DOPPLER subtable
114  // is not simply indexed by DOPPLER_ID, the DOPPLER subtable exists and a dopplerId
115  // can be found in the SPECTRAL_WINDOW subtable, that value will be returned, whatever
116  // it is.
117  Int dopplerId(uInt rownr) const;
118  // The sourceId comes from the FIELD subtable so fieldId must first be valid
119  // in order for this to also be valid. Since the SOURCE table is also
120  // indexed by TIME, the only additional check is that a SOURCE table must
121  // exist in order for this to be valid.
122  Int sourceId(uInt rownr) const;
123  // </group>
124 private:
127 
129 
130  void clear();
131  Int checkResult(Int testResult, const Table &mstable) const
132  { return (testResult < 0 || uInt(testResult) >= mstable.nrow()) ? -1 : testResult;}
133 
134  Bool checkRow(uInt rownr) const {return rownr < ms_p.nrow();}
135 };
136 
137 
138 } //# NAMESPACE CASACORE - END
139 
140 #endif
ROMSColumns * romsCols_p
Definition: MSValidIds.h:126
int Int
Definition: aipstype.h:50
Main interface class to a read/write table.
Definition: Table.h:153
Bool checkRow(uInt rownr) const
Definition: MSValidIds.h:134
Int checkResult(Int testResult, const Table &mstable) const
Definition: MSValidIds.h:131
MeasurementSet ms_p
Definition: MSValidIds.h:125
Int sourceId(uInt rownr) const
The sourceId comes from the FIELD subtable so fieldId must first be valid in order for this to also b...
Int dataDescId(uInt rownr) const
Int observationId(uInt rownr) const
MSValidIds()
Construct one unattached to a MeasurementSet.
Int polarizationId(uInt rownr) const
The polarizationId comes from the DATA_DESCRIPTION subtable, so dataDescId must first be valid in ord...
~MSValidIds()
The destructor.
Int dopplerId(uInt rownr) const
the dopplerId comes from the SPECTRAL_WINDOW subtable so spectralWindowId must first be valid in orde...
Int processorId(uInt rownr) const
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
Int antenna1(uInt rownr) const
These functions check on the validity of the appropriate value in the main table or sub-tables in the...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
uInt nrow() const
Get the number of rows.
Definition: Table.h:1201
Int fieldId(uInt rownr) const
A Table intended to hold astronomical data (a set of Measurements).
Int antenna2(uInt rownr) const
Int stateId(uInt rownr) const
MSValidIds & operator=(const MSValidIds &other)
Assignment operator, reference semantics.
void attach(const MeasurementSet &ms)
Attach this one to a MeasurementSet.
unsigned int uInt
Definition: aipstype.h:51
Int spectralWindowId(uInt rownr) const
The spectralWindowId comes from the DATA_DESCRIPTION subtable, so dataDescId must first be valid in o...
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42