casacore
Loading...
Searching...
No Matches
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: 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_MSVALIDIDS_H
27#define MS_MSVALIDIDS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/ms/MeasurementSets/MeasurementSet.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// # Forward declarations
35class MSColumns;
36
37// <summary>
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
43// </reviewed>
44
45// <prerequisite>
46// <li> MeasurementSet
47// </prerequisite>
48//
49// <etymology>
50// </etymology>
51//
52// <synopsis>
53// </synopsis>
54//
55// <example>
56// </example>
57//
58// <motivation>
59// </motivation>
60//
61// <thrown>
62// <li>
63// <li>
64// </thrown>
65
67 public:
68 // Construct one unattached to a MeasurementSet. All functions return -1.
69 // Use the attach function to attach this to a MeasurementSet after construction.
71
72 // Construct one attached to the indicated MeasurementSet
74
75 // Construct one from another
76 MSValidIds(const MSValidIds &other);
77
78 // The destructor
80
81 // Assignment operator, reference semantics.
83
84 // Attach this one to a MeasurementSet. This can also be used to
85 // re-attach to the same MeasurementSet when additional optional
86 // subtables have been added since this object was constructed.
87 void attach(const MeasurementSet &ms);
88
89 // These functions check on the validity of the appropriate value in
90 // the main table or sub-tables in the case of some Ids. The actual
91 // value stored is returned unless the sub-table does not exist (for
92 // optional subtables) or the indicated row number does not exist
93 // in that sub-table where appropriate.
94 // <group>
95 Int antenna1(rownr_t rownr) const;
96 Int antenna2(rownr_t rownr) const;
97 Int dataDescId(rownr_t rownr) const;
98 Int fieldId(rownr_t rownr) const;
100 Int processorId(rownr_t rownr) const;
101 Int stateId(rownr_t rownr) const;
102 // The polarizationId comes from the DATA_DESCRIPTION subtable, so dataDescId must
103 // first be valid in order for this to also be valid.
105 // The spectralWindowId comes from the DATA_DESCRIPTION subtable, so dataDescId must
106 // first be valid in order for this to also be valid.
108 // the dopplerId comes from the SPECTRAL_WINDOW subtable so spectralWindowId must
109 // first be valid in order for this to also be valid. Since the DOPPLER subtable
110 // is not simply indexed by DOPPLER_ID, the DOPPLER subtable exists and a dopplerId
111 // can be found in the SPECTRAL_WINDOW subtable, that value will be returned, whatever
112 // it is.
113 Int dopplerId(rownr_t rownr) const;
114 // The sourceId comes from the FIELD subtable so fieldId must first be valid
115 // in order for this to also be valid. Since the SOURCE table is also
116 // indexed by TIME, the only additional check is that a SOURCE table must
117 // exist in order for this to be valid.
118 Int sourceId(rownr_t rownr) const;
119 // </group>
120 private:
123
125
126 void clear();
127 Int checkResult(Int testResult, const Table &mstable) const {
128 return (testResult < 0 || rownr_t(testResult) >= mstable.nrow()) ? -1 : testResult;
129 }
130
131 Bool checkRow(rownr_t rownr) const { return rownr < ms_p.nrow(); }
132};
133
134} // namespace casacore
135
136#endif
Int polarizationId(rownr_t rownr) const
The polarizationId comes from the DATA_DESCRIPTION subtable, so dataDescId must first be valid in ord...
Int antenna2(rownr_t rownr) const
Bool checkRow(rownr_t rownr) const
Definition MSValidIds.h:131
MSValidIds(const MSValidIds &other)
Construct one from another.
void attach(const MeasurementSet &ms)
Attach this one to a MeasurementSet.
MSValidIds(const MeasurementSet &ms)
Construct one attached to the indicated MeasurementSet.
Int antenna1(rownr_t rownr) const
These functions check on the validity of the appropriate value in the main table or sub-tables in the...
Int checkResult(Int testResult, const Table &mstable) const
Definition MSValidIds.h:127
Int fieldId(rownr_t rownr) const
Int spectralWindowId(rownr_t rownr) const
The spectralWindowId comes from the DATA_DESCRIPTION subtable, so dataDescId must first be valid in o...
Int dataDescId(rownr_t rownr) const
Int sourceId(rownr_t rownr) const
The sourceId comes from the FIELD subtable so fieldId must first be valid in order for this to also b...
MSValidIds()
Construct one unattached to a MeasurementSet.
Int observationId(rownr_t rownr) const
MSValidIds & operator=(const MSValidIds &other)
Assignment operator, reference semantics.
Int stateId(rownr_t rownr) const
~MSValidIds()
The destructor.
Int processorId(rownr_t rownr) const
MeasurementSet ms_p
Definition MSValidIds.h:121
MSColumns * romsCols_p
Definition MSValidIds.h:122
Int dopplerId(rownr_t rownr) const
the dopplerId comes from the SPECTRAL_WINDOW subtable so spectralWindowId must first be valid in orde...
rownr_t nrow() const
Get the number of rows.
Definition Table.h:1112
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
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