casacore
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: 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//# $Id$
27
28#ifndef MS_MSSOURCECOLUMNS_H
29#define MS_MSSOURCECOLUMNS_H
30
31#include <casacore/casa/aips.h>
32#include <casacore/measures/Measures/MDirection.h>
33#include <casacore/measures/Measures/MEpoch.h>
34#include <casacore/measures/Measures/MFrequency.h>
35#include <casacore/measures/Measures/MPosition.h>
36#include <casacore/measures/Measures/MRadialVelocity.h>
37#include <casacore/measures/Measures/MCDirection.h>
38#include <casacore/measures/Measures/MCEpoch.h>
39#include <casacore/measures/Measures/MCFrequency.h>
40#include <casacore/measures/Measures/MCPosition.h>
41#include <casacore/measures/Measures/MCRadialVelocity.h>
42#include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
43#include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
44#include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
45#include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
46#include <casacore/tables/Tables/ArrayColumn.h>
47#include <casacore/tables/Tables/ScalarColumn.h>
48#include <casacore/tables/Tables/TableRecord.h>
49#include <casacore/casa/BasicSL/String.h>
50
51namespace casacore { //# NAMESPACE CASACORE - BEGIN
52
53class MSSource;
54
55// <summary>
56// A class to provide easy access to MSSource columns
57// </summary>
58
59// <use visibility=export>
60
61// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
62// </reviewed>
63
64// <prerequisite>
65// <li> MSSource
66// <li> ArrayColumn
67// <li> ScalarColumn
68// </prerequisite>
69//
70// <etymology>
71// MSSourceColumns stands for MeasurementSet Source Table columns.
72// </etymology>
73//
74// <synopsis>
75// This class provides access to the columns in the MSSource Table,
76// it does the declaration of all the Scalar and ArrayColumns with the
77// correct types, so the application programmer doesn't have to
78// worry about getting those right. There is an access function
79// for every predefined column. Access to non-predefined columns will still
80// have to be done with explicit declarations.
81// See <linkto class=MSColumns> MSColumns</linkto> for an example.
82// </synopsis>
83//
84// <motivation>
85// See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
86// </motivation>
87
89{
90public:
91 // Construct from the supplied Table
92 MSSourceColumns(const MSSource& msSource);
93
94 // The destructor does nothing special
96
97 // Is this object defined? (MSSource table is optional)
98 Bool isNull() const {return isNull_p;}
99
100 // Access to required columns
101 // <group>
118 // </group>
119
120 // Access to optional columns
121 // <group>
129 return restFrequencyMeas_p;}
135 // </group>
136
137 // Const access to required columns
138 // <group>
140 return calibrationGroup_p;}
141 const ScalarColumn<String>& code() const {return code_p;}
144 return directionQuant_p;}
146 return directionMeas_p;}
147 const ScalarColumn<Double>& interval() const {return interval_p;}
149 return intervalQuant_p;}
150 const ScalarColumn<String>& name() const {return name_p;}
151 const ScalarColumn<Int>& numLines() const {return numLines_p;}
154 return properMotionQuant_p;}
155 const ScalarColumn<Int>& sourceId() const {return sourceId_p;}
157 return spectralWindowId_p;}
158 const ScalarColumn<Double>& time() const {return time_p;}
161 // </group>
162
163 // Const access to optional columns
164 // <group>
165 const ArrayColumn<Double>& position() const {return position_p;}
167 return positionQuant_p;}
169 return positionMeas_p;}
170 const ScalarColumn<Int>& pulsarId() const {return pulsarId_p;}
173 return restFrequencyQuant_p;}
175 return restFrequencyMeas_p;}
177 return sourceModel_p;}
178 const ArrayColumn<Double>& sysvel() const {return sysvel_p;}
181 return sysvelMeas_p;}
183 // </group>
184
185 // Convenience function that returns the number of rows in any of the
186 // columns. Returns zero if the object is null.
187 rownr_t nrow() const {return isNull() ? 0 : calibrationGroup_p.nrow();}
188
189 // set the epoch type for the TIME column.
190 // <note role=tip>
191 // In principle this function can only be used if the table is empty,
192 // otherwise already written values may thereafter have an incorrect
193 // reference, offset, or unit. However, it is possible that part of the
194 // table gets written before these values are known. In that case the
195 // reference, offset, or units can be set by using a False
196 // <src>tableMustBeEmpty</src> argument.
197 // </note>
198 void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
199
200 // set the direction type for the DIRECTION column. This can only be done
201 // when the table has no rows. Trying to do so at other times will throw an
202 // exception.
204
205 // set the position type for the POSITION column. This can only be done when
206 // the table has no rows. Trying to do so at other times will throw an
207 // exception.
209
210 // set the frequency type for the REST_FREQUENCY column. Does nothing if this
211 // column is not defined. This can only be done when the table has no
212 // rows. Trying to do so at other times will throw an exception.
214
215 // set the radial velocity type for the SYSVEL column. Does nothing if this
216 // column is not defined. This can only be done when the table has no
217 // rows. Trying to do so at other times will throw an exception.
219
220protected:
221 //# default constructor creates a object that is not usable. Use the attach
222 //# function correct this.
224
225 //# attach this object to the supplied table.
226 void attach(const MSSource& msSource);
227
228private:
229 //# Make the assignment operator and the copy constructor private to prevent
230 //# any compiler generated one from being used.
233
234 //# Check if any optional columns exist and if so attach them.
235 void attachOptionalCols(const MSSource& msSource);
236
237 //# Is the object not attached to a Table.
239
240 //# required columns
251 //# optional columns
258
259 //# Access to Measure columns
262 //# Optional Measure columns
266
267 //# Access to Quantum columns
272 //# Optional Quantum columns
276};
277
278//# Define the RO version for backward compatibility.
280
281} //# NAMESPACE CASACORE - END
282
283#endif
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
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.
Definition: TableColumn.h:197
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:42
const Bool True
Definition: aipstype.h:43
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46