casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
50 
51 namespace casacore { //# NAMESPACE CASACORE - BEGIN
52 
53 class 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 {
90 public:
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;}
142  const ArrayColumn<Double>& direction() const {return direction_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;}
182  const ArrayColumn<String>& transition() const {return transition_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 
220 protected:
221  //# default constructor creates a object that is not usable. Use the attach
222  //# function correct this.
223  MSSourceColumns();
224 
225  //# attach this object to the supplied table.
226  void attach(const MSSource& msSource);
227 
228 private:
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
ScalarColumn< Int > & calibrationGroup()
Access to required columns.
ArrayMeasColumn< MRadialVelocity > & sysvelMeas()
ArrayColumn< Double > & restFrequency()
ArrayQuantColumn< Double > & positionQuant()
void setFrequencyRef(MFrequency::Types ref)
set the frequency type for the REST_FREQUENCY column.
ArrayColumn< Double > properMotion_p
const ArrayColumn< Double > & direction() const
ScalarQuantColumn< Double > & timeQuant()
ArrayQuantColumn< Double > & restFrequencyQuant()
ArrayColumn< Double > & properMotion()
ScalarColumn< Double > time_p
MSSourceColumns ROMSSourceColumns
ScalarColumn< Double > & interval()
ArrayMeasColumn< MFrequency > restFrequencyMeas_p
ScalarColumn< Int > & sourceId()
ScalarColumn< Double > interval_p
ArrayQuantColumn< Double > sysvelQuant_p
ScalarColumn< String > & code()
const ScalarMeasColumn< MPosition > & positionMeas() const
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
ArrayQuantColumn< Double > & sysvelQuant()
void attachOptionalCols(const MSSource &msSource)
const ArrayColumn< Double > & restFrequency() const
ScalarQuantColumn< Double > intervalQuant_p
ArrayQuantColumn< Double > restFrequencyQuant_p
~MSSourceColumns()
The destructor does nothing special.
MSSourceColumns & operator=(const MSSourceColumns &)
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ArrayColumn< Double > position_p
const ArrayColumn< Double > & position() const
Const access to optional columns.
ScalarColumn< Double > & time()
const ScalarColumn< TableRecord > & sourceModel() const
const ScalarMeasColumn< MDirection > & directionMeas() const
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
const ArrayQuantColumn< Double > & properMotionQuant() const
A class to provide easy access to MSSource columns.
ArrayMeasColumn< MFrequency > & restFrequencyMeas()
rownr_t nrow() const
Get the number of rows in the column.
Definition: TableColumn.h:197
ArrayMeasColumn< MRadialVelocity > sysvelMeas_p
ScalarColumn< Int > calibrationGroup_p
ArrayQuantColumn< Double > properMotionQuant_p
A Table intended to hold a MeasurementSet SOURCE table.
Definition: MSSource.h:77
ScalarColumn< Int > numLines_p
ScalarColumn< String > code_p
ScalarQuantColumn< Double > & intervalQuant()
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
ArrayQuantColumn< Double > & properMotionQuant()
ScalarColumn< TableRecord > & sourceModel()
void attach(const MSSource &msSource)
Bool isNull() const
Is this object defined? (MSSource table is optional)
const ArrayQuantColumn< Double > & positionQuant() const
ScalarQuantColumn< Double > timeQuant_p
ArrayQuantColumn< Double > positionQuant_p
const ArrayQuantColumn< Double > & directionQuant() const
const ArrayColumn< Double > & properMotion() const
void setRadialVelocityRef(MRadialVelocity::Types ref)
set the radial velocity type for the SYSVEL column.
Types
Types of known MRadialVelocity Warning: The order defines the order in the translation matrix FromTo...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const ArrayMeasColumn< MFrequency > & restFrequencyMeas() const
ArrayColumn< Double > & sysvel()
const ScalarColumn< Double > & time() const
ArrayColumn< String > & transition()
ArrayQuantColumn< Double > directionQuant_p
ScalarColumn< Int > pulsarId_p
ScalarMeasColumn< MEpoch > timeMeas_p
ArrayColumn< Double > & position()
Access to optional columns.
ArrayColumn< String > transition_p
ScalarColumn< Int > & spectralWindowId()
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
const ScalarColumn< Int > & numLines() const
const ArrayColumn< String > & transition() const
ScalarColumn< Int > & numLines()
ScalarMeasColumn< MPosition > & positionMeas()
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
ScalarMeasColumn< MDirection > directionMeas_p
const ScalarMeasColumn< MEpoch > & timeMeas() const
ArrayColumn< Double > sysvel_p
ArrayColumn< Double > & direction()
const ArrayColumn< Double > & sysvel() const
const ArrayQuantColumn< Double > & restFrequencyQuant() const
ScalarColumn< String > name_p
const ArrayQuantColumn< Double > & sysvelQuant() const
void setDirectionRef(MDirection::Types ref)
set the direction type for the DIRECTION column.
ArrayColumn< Double > restFrequency_p
const ScalarColumn< String > & code() const
ScalarColumn< TableRecord > sourceModel_p
ScalarColumn< Int > sourceId_p
ScalarMeasColumn< MPosition > positionMeas_p
const ScalarColumn< Int > & pulsarId() const
const ScalarQuantColumn< Double > & intervalQuant() const
const ScalarColumn< Int > & spectralWindowId() const
ScalarColumn< Int > & pulsarId()
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
const ArrayMeasColumn< MRadialVelocity > & sysvelMeas() const
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarMeasColumn< MEpoch > & timeMeas()
ScalarColumn< Int > spectralWindowId_p
const ScalarColumn< String > & name() const
const Bool True
Definition: aipstype.h:43
const ScalarQuantColumn< Double > & timeQuant() const
ScalarMeasColumn< MDirection > & directionMeas()
ArrayQuantColumn< Double > & directionQuant()
const ScalarColumn< Int > & calibrationGroup() const
Const access to required columns.
ScalarColumn< String > & name()
const ScalarColumn< Double > & interval() const
const ScalarColumn< Int > & sourceId() const
ArrayColumn< Double > direction_p