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{
88public:
89 // Construct from the supplied Table
90 MSSourceColumns(const MSSource& msSource);
91
92 // The destructor does nothing special
94
95 // Is this object defined? (MSSource table is optional)
96 Bool isNull() const {return isNull_p;}
97
98 // Access to required columns
99 // <group>
116 // </group>
117
118 // Access to optional columns
119 // <group>
133 // </group>
134
135 // Const access to required columns
136 // <group>
139 const ScalarColumn<String>& code() const {return code_p;}
145 const ScalarColumn<Double>& interval() const {return interval_p;}
148 const ScalarColumn<String>& name() const {return name_p;}
149 const ScalarColumn<Int>& numLines() const {return numLines_p;}
153 const ScalarColumn<Int>& sourceId() const {return sourceId_p;}
156 const ScalarColumn<Double>& time() const {return time_p;}
159 // </group>
160
161 // Const access to optional columns
162 // <group>
163 const ArrayColumn<Double>& position() const {return position_p;}
168 const ScalarColumn<Int>& pulsarId() const {return pulsarId_p;}
176 const ArrayColumn<Double>& sysvel() const {return sysvel_p;}
181 // </group>
182
183 // Convenience function that returns the number of rows in any of the
184 // columns. Returns zero if the object is null.
185 rownr_t nrow() const {return isNull() ? 0 : calibrationGroup_p.nrow();}
186
187 // set the epoch type for the TIME column.
188 // <note role=tip>
189 // In principle this function can only be used if the table is empty,
190 // otherwise already written values may thereafter have an incorrect
191 // reference, offset, or unit. However, it is possible that part of the
192 // table gets written before these values are known. In that case the
193 // reference, offset, or units can be set by using a False
194 // <src>tableMustBeEmpty</src> argument.
195 // </note>
196 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
197
198 // set the direction type for the DIRECTION column. This can only be done
199 // when the table has no rows. Trying to do so at other times will throw an
200 // exception.
202
203 // set the position type for the POSITION column. This can only be done when
204 // the table has no rows. Trying to do so at other times will throw an
205 // exception.
207
208 // set the frequency type for the REST_FREQUENCY column. Does nothing if this
209 // column is not defined. This can only be done when the table has no
210 // rows. Trying to do so at other times will throw an exception.
212
213 // set the radial velocity type for the SYSVEL column. Does nothing if this
214 // column is not defined. This can only be done when the table has no
215 // rows. Trying to do so at other times will throw an exception.
217
218protected:
219 //# default constructor creates a object that is not usable. Use the attach
220 //# function correct this.
222
223 //# attach this object to the supplied table.
224 void attach(const MSSource& msSource);
225
226private:
227 //# Make the assignment operator and the copy constructor private to prevent
228 //# any compiler generated one from being used.
231
232 //# Check if any optional columns exist and if so attach them.
233 void attachOptionalCols(const MSSource& msSource);
234
235 //# Is the object not attached to a Table.
237
238 //# required columns
249 //# optional columns
256
257 //# Access to Measure columns
260 //# Optional Measure columns
264
265 //# Access to Quantum columns
270 //# Optional Quantum columns
274};
275
276//# Define the RO version for backward compatibility.
278
279} //# NAMESPACE CASACORE - END
280
281#endif
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition MDirection.h:185
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition MEpoch.h:114
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition MFrequency.h:173
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition MPosition.h:91
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? (MSSource table is optional)
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()
rownr_t nrow() const
Get the number of rows in the column.
this file contains all the compiler specific defines
Definition mainpage.dox:28
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