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{
68public:
69 // Construct one unattached to a MeasurementSet. All functions return -1.
70 // Use the attach function to attach this to a MeasurementSet after construction.
72
73 // Construct one attached to the indicated MeasurementSet
75
76 // Construct one from another
77 MSValidIds(const MSValidIds &other);
78
79 // The destructor
81
82 // Assignment operator, reference semantics.
84
85 // Attach this one to a MeasurementSet. This can also be used to
86 // re-attach to the same MeasurementSet when additional optional
87 // subtables have been added since this object was constructed.
88 void attach(const MeasurementSet &ms);
89
90 // These functions check on the validity of the appropriate value in
91 // the main table or sub-tables in the case of some Ids. The actual
92 // value stored is returned unless the sub-table does not exist (for
93 // optional subtables) or the indicated row number does not exist
94 // in that sub-table where appropriate.
95 // <group>
96 Int antenna1(rownr_t rownr) const;
97 Int antenna2(rownr_t rownr) const;
98 Int dataDescId(rownr_t rownr) const;
99 Int fieldId(rownr_t rownr) const;
101 Int processorId(rownr_t rownr) const;
102 Int stateId(rownr_t rownr) const;
103 // The polarizationId comes from the DATA_DESCRIPTION subtable, so dataDescId must
104 // first be valid in order for this to also be valid.
106 // The spectralWindowId comes from the DATA_DESCRIPTION subtable, so dataDescId must
107 // first be valid in order for this to also be valid.
109 // the dopplerId comes from the SPECTRAL_WINDOW subtable so spectralWindowId must
110 // first be valid in order for this to also be valid. Since the DOPPLER subtable
111 // is not simply indexed by DOPPLER_ID, the DOPPLER subtable exists and a dopplerId
112 // can be found in the SPECTRAL_WINDOW subtable, that value will be returned, whatever
113 // it is.
114 Int dopplerId(rownr_t rownr) const;
115 // The sourceId comes from the FIELD subtable so fieldId must first be valid
116 // in order for this to also be valid. Since the SOURCE table is also
117 // indexed by TIME, the only additional check is that a SOURCE table must
118 // exist in order for this to be valid.
119 Int sourceId(rownr_t rownr) const;
120 // </group>
121private:
124
126
127 void clear();
128 Int checkResult(Int testResult, const Table &mstable) const
129 { return (testResult < 0 || rownr_t(testResult) >= mstable.nrow()) ? -1 : testResult;}
130
131 Bool checkRow(rownr_t rownr) const {return rownr < ms_p.nrow();}
132};
133
134
135} //# NAMESPACE CASACORE - END
136
137#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:128
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:122
MSColumns * romsCols_p
Definition MSValidIds.h:123
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:1176
this file contains all the compiler specific defines
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