casacore
Loading...
Searching...
No Matches
MSSourceColumns.h
Go to the documentation of this file.
1// # MSSourceColumns.h: provides easy access to MSSource columns
2// # Copyright (C) 1996,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_MSSOURCECOLUMNS_H
27#define MS_MSSOURCECOLUMNS_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/measures/Measures/MDirection.h>
31#include <casacore/measures/Measures/MEpoch.h>
32#include <casacore/measures/Measures/MFrequency.h>
33#include <casacore/measures/Measures/MPosition.h>
34#include <casacore/measures/Measures/MRadialVelocity.h>
35#include <casacore/measures/Measures/MCDirection.h>
36#include <casacore/measures/Measures/MCEpoch.h>
37#include <casacore/measures/Measures/MCFrequency.h>
38#include <casacore/measures/Measures/MCPosition.h>
39#include <casacore/measures/Measures/MCRadialVelocity.h>
40#include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
41#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
42#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
43#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
44#include <casacore/tables/Tables/ArrayColumn.h>
45#include <casacore/tables/Tables/ScalarColumn.h>
46#include <casacore/tables/Tables/TableRecord.h>
47#include <casacore/casa/BasicSL/String.h>
48
49namespace casacore { // # NAMESPACE CASACORE - BEGIN
50
51class MSSource;
52
53// <summary>
54// A class to provide easy access to MSSource columns
55// </summary>
56
57// <use visibility=export>
58
59// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
60// </reviewed>
61
62// <prerequisite>
63// <li> MSSource
64// <li> ArrayColumn
65// <li> ScalarColumn
66// </prerequisite>
67//
68// <etymology>
69// MSSourceColumns stands for MeasurementSet Source Table columns.
70// </etymology>
71//
72// <synopsis>
73// This class provides access to the columns in the MSSource Table,
74// it does the declaration of all the Scalar and ArrayColumns with the
75// correct types, so the application programmer doesn't have to
76// worry about getting those right. There is an access function
77// for every predefined column. Access to non-predefined columns will still
78// have to be done with explicit declarations.
79// See <linkto class=MSColumns> MSColumns</linkto> for an example.
80// </synopsis>
81//
82// <motivation>
83// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
84// </motivation>
85
87 public:
88 // Construct from the supplied Table
89 MSSourceColumns(const MSSource& msSource);
90
91 // The destructor does nothing special
93
94 // Is this object defined? (MSSource table is optional)
95 Bool isNull() const { return isNull_p; }
96
97 // Access to required columns
98 // <group>
115 // </group>
116
117 // Access to optional columns
118 // <group>
131 // </group>
132
133 // Const access to required columns
134 // <group>
136 const ScalarColumn<String>& code() const { return code_p; }
137 const ArrayColumn<Double>& direction() const { return direction_p; }
140 const ScalarColumn<Double>& interval() const { return interval_p; }
142 const ScalarColumn<String>& name() const { return name_p; }
143 const ScalarColumn<Int>& numLines() const { return numLines_p; }
146 const ScalarColumn<Int>& sourceId() const { return sourceId_p; }
148 const ScalarColumn<Double>& time() const { return time_p; }
151 // </group>
152
153 // Const access to optional columns
154 // <group>
155 const ArrayColumn<Double>& position() const { return position_p; }
158 const ScalarColumn<Int>& pulsarId() const { return pulsarId_p; }
163 const ArrayColumn<Double>& sysvel() const { return sysvel_p; }
166 const ArrayColumn<String>& transition() const { return transition_p; }
167 // </group>
168
169 // Convenience function that returns the number of rows in any of the
170 // columns. Returns zero if the object is null.
171 rownr_t nrow() const { return isNull() ? 0 : calibrationGroup_p.nrow(); }
172
173 // set the epoch type for the TIME column.
174 // <note role=tip>
175 // In principle this function can only be used if the table is empty,
176 // otherwise already written values may thereafter have an incorrect
177 // reference, offset, or unit. However, it is possible that part of the
178 // table gets written before these values are known. In that case the
179 // reference, offset, or units can be set by using a False
180 // <src>tableMustBeEmpty</src> argument.
181 // </note>
182 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty = True);
183
184 // set the direction type for the DIRECTION column. This can only be done
185 // when the table has no rows. Trying to do so at other times will throw an
186 // exception.
188
189 // set the position type for the POSITION column. This can only be done when
190 // the table has no rows. Trying to do so at other times will throw an
191 // exception.
193
194 // set the frequency type for the REST_FREQUENCY column. Does nothing if this
195 // column is not defined. This can only be done when the table has no
196 // rows. Trying to do so at other times will throw an exception.
198
199 // set the radial velocity type for the SYSVEL column. Does nothing if this
200 // column is not defined. This can only be done when the table has no
201 // rows. Trying to do so at other times will throw an exception.
203
204 protected:
205 // # default constructor creates a object that is not usable. Use the attach
206 // # function correct this.
208
209 // # attach this object to the supplied table.
210 void attach(const MSSource& msSource);
211
212 private:
213 // # Make the assignment operator and the copy constructor private to prevent
214 // # any compiler generated one from being used.
217
218 // # Check if any optional columns exist and if so attach them.
219 void attachOptionalCols(const MSSource& msSource);
220
221 // # Is the object not attached to a Table.
223
224 // # required columns
235 // # optional columns
242
243 // # Access to Measure columns
246 // # Optional Measure columns
250
251 // # Access to Quantum columns
256 // # Optional Quantum columns
260};
261
262// # Define the RO version for backward compatibility.
264
265} // namespace casacore
266
267#endif
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition MDirection.h:187
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition MEpoch.h:116
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:175
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition MPosition.h:93
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
ScalarMeasColumn< MDirection > & directionMeas()
const ScalarMeasColumn< MPosition > & positionMeas() const
ScalarColumn< Double > time_p
const ArrayQuantColumn< Double > & restFrequencyQuant() const
ArrayQuantColumn< Double > positionQuant_p
ScalarColumn< Int > & sourceId()
ArrayMeasColumn< MFrequency > & restFrequencyMeas()
ArrayMeasColumn< MRadialVelocity > sysvelMeas_p
ScalarColumn< String > & name()
ScalarQuantColumn< Double > & timeQuant()
const ScalarColumn< Int > & pulsarId() const
ScalarMeasColumn< MDirection > directionMeas_p
ArrayColumn< Double > direction_p
const ArrayColumn< Double > & sysvel() const
ArrayColumn< Double > sysvel_p
const ArrayColumn< Double > & properMotion() const
ScalarQuantColumn< Double > timeQuant_p
const ArrayColumn< String > & transition() const
ArrayColumn< Double > & position()
Access to optional columns.
ScalarColumn< Int > calibrationGroup_p
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
ArrayColumn< Double > & properMotion()
const ArrayQuantColumn< Double > & directionQuant() const
MSSourceColumns & operator=(const MSSourceColumns &)
ScalarColumn< Int > spectralWindowId_p
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
const ArrayColumn< Double > & restFrequency() const
const ScalarColumn< Int > & numLines() const
void setRadialVelocityRef(MRadialVelocity::Types ref)
set the radial velocity type for the SYSVEL column.
const ScalarColumn< TableRecord > & sourceModel() const
ArrayColumn< Double > restFrequency_p
ScalarColumn< Int > numLines_p
const ScalarColumn< Double > & interval() const
const ScalarQuantColumn< Double > & timeQuant() const
ArrayQuantColumn< Double > restFrequencyQuant_p
const ScalarColumn< Int > & calibrationGroup() const
Const access to required columns.
const ArrayQuantColumn< Double > & positionQuant() const
ArrayColumn< Double > position_p
Bool isNull() const
Is this object defined?
const ScalarColumn< Int > & spectralWindowId() const
ArrayQuantColumn< Double > & directionQuant()
ArrayMeasColumn< MFrequency > restFrequencyMeas_p
ArrayQuantColumn< Double > & properMotionQuant()
ArrayColumn< String > & transition()
ScalarColumn< Double > & time()
ScalarMeasColumn< MPosition > positionMeas_p
const ArrayColumn< Double > & position() const
Const access to optional columns.
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
const ArrayMeasColumn< MFrequency > & restFrequencyMeas() const
ScalarColumn< Int > & spectralWindowId()
ArrayColumn< Double > & restFrequency()
ArrayQuantColumn< Double > directionQuant_p
ArrayQuantColumn< Double > properMotionQuant_p
ScalarColumn< String > & code()
ScalarColumn< String > name_p
const ScalarMeasColumn< MDirection > & directionMeas() const
ArrayColumn< String > transition_p
ScalarColumn< Double > interval_p
ScalarMeasColumn< MEpoch > timeMeas_p
void setFrequencyRef(MFrequency::Types ref)
set the frequency type for the REST_FREQUENCY column.
ScalarQuantColumn< Double > intervalQuant_p
const ArrayQuantColumn< Double > & properMotionQuant() const
ScalarColumn< Int > sourceId_p
ScalarColumn< Int > pulsarId_p
ArrayColumn< Double > & direction()
const ScalarColumn< String > & name() const
void setDirectionRef(MDirection::Types ref)
set the direction type for the DIRECTION column.
const ScalarColumn< Double > & time() const
ArrayMeasColumn< MRadialVelocity > & sysvelMeas()
ArrayColumn< Double > properMotion_p
const ScalarQuantColumn< Double > & intervalQuant() const
MSSourceColumns(const MSSource &msSource)
Construct from the supplied Table.
ScalarColumn< Int > & numLines()
ScalarQuantColumn< Double > & intervalQuant()
ScalarColumn< String > code_p
ScalarColumn< Int > & calibrationGroup()
Access to required columns.
void attach(const MSSource &msSource)
const ScalarColumn< Int > & sourceId() const
void attachOptionalCols(const MSSource &msSource)
ScalarColumn< TableRecord > sourceModel_p
ArrayColumn< Double > & sysvel()
ArrayQuantColumn< Double > & positionQuant()
const ScalarMeasColumn< MEpoch > & timeMeas() const
const ScalarColumn< String > & code() const
const ArrayColumn< Double > & direction() const
const ArrayQuantColumn< Double > & sysvelQuant() const
ScalarColumn< Double > & interval()
ArrayQuantColumn< Double > & restFrequencyQuant()
MSSourceColumns(const MSSourceColumns &)
ArrayQuantColumn< Double > & sysvelQuant()
ArrayQuantColumn< Double > sysvelQuant_p
ScalarMeasColumn< MEpoch > & timeMeas()
const ArrayMeasColumn< MRadialVelocity > & sysvelMeas() const
ScalarColumn< Int > & pulsarId()
~MSSourceColumns()
The destructor does nothing special.
ScalarColumn< TableRecord > & sourceModel()
ScalarMeasColumn< MPosition > & positionMeas()
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const RecordRep & ref() const
Return a const reference to the underlying RecordRep.
MSSourceColumns ROMSSourceColumns
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44