casa  5.7.0-16
 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 read-only 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 // ROMSSourceColumns stands for Read-Only MeasurementSet Source Table columns.
72 // </etymology>
73 //
74 // <synopsis>
75 // This class provides read-only 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=ROMSColumns> ROMSColumns</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  ROMSSourceColumns(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>
102  const ROScalarColumn<Int>& calibrationGroup() const {
103  return calibrationGroup_p;}
104  const ROScalarColumn<String>& code() const {return code_p;}
105  const ROArrayColumn<Double>& direction() const {return direction_p;}
106  const ROArrayQuantColumn<Double>& directionQuant() const {
107  return directionQuant_p;}
108  const ROScalarMeasColumn<MDirection>& directionMeas() const {
109  return directionMeas_p;}
110  const ROScalarColumn<Double>& interval() const {return interval_p;}
111  const ROScalarQuantColumn<Double>& intervalQuant() const {
112  return intervalQuant_p;}
113  const ROScalarColumn<String>& name() const {return name_p;}
114  const ROScalarColumn<Int>& numLines() const {return numLines_p;}
115  const ROArrayColumn<Double>& properMotion() const {return properMotion_p;}
116  const ROArrayQuantColumn<Double>& properMotionQuant() const {
117  return properMotionQuant_p;}
118  const ROScalarColumn<Int>& sourceId() const {return sourceId_p;}
119  const ROScalarColumn<Int>& spectralWindowId() const {
120  return spectralWindowId_p;}
121  const ROScalarColumn<Double>& time() const {return time_p;}
122  const ROScalarQuantColumn<Double>& timeQuant() const {return timeQuant_p;}
123  const ROScalarMeasColumn<MEpoch>& timeMeas() const {return timeMeas_p;}
124  // </group>
125 
126  // Access to optional columns
127  // <group>
128  const ROArrayColumn<Double>& position() const {return position_p;}
129  const ROArrayQuantColumn<Double>& positionQuant() const {
130  return positionQuant_p;}
131  const ROScalarMeasColumn<MPosition>& positionMeas() const {
132  return positionMeas_p;}
133  const ROScalarColumn<Int>& pulsarId() const {return pulsarId_p;}
134  const ROArrayColumn<Double>& restFrequency() const {return restFrequency_p;}
135  const ROArrayQuantColumn<Double>& restFrequencyQuant() const {
136  return restFrequencyQuant_p;}
137  const ROArrayMeasColumn<MFrequency>& restFrequencyMeas() const {
138  return restFrequencyMeas_p;}
139  const ROScalarColumn<TableRecord>& sourceModel() const {
140  return sourceModel_p;}
141  const ROArrayColumn<Double>& sysvel() const {return sysvel_p;}
142  const ROArrayQuantColumn<Double>& sysvelQuant() const {return sysvelQuant_p;}
143  const ROArrayMeasColumn<MRadialVelocity>& sysvelMeas() const {
144  return sysvelMeas_p;}
145  const ROArrayColumn<String>& transition() const {return transition_p;}
146  // </group>
147 
148  // Convenience function that returns the number of rows in any of the
149  // columns. Returns zero if the object is null.
150  uInt nrow() const {return isNull() ? 0 : calibrationGroup_p.nrow();}
151 
152 protected:
153  //# default constructor creates a object that is not usable. Use the attach
154  //# function correct this.
156 
157  //# attach this object to the supplied table.
158  void attach(const MSSource& msSource);
159 
160 private:
161  //# Make the assignment operator and the copy constructor private to prevent
162  //# any compiler generated one from being used.
165 
166  //# Check if any optional columns exist and if so attach them.
167  void attachOptionalCols(const MSSource& msSource);
168 
169  //# Is the object not attached to a Table.
171 
172  //# required columns
173  ROScalarColumn<Int> calibrationGroup_p;
174  ROScalarColumn<String> code_p;
175  ROArrayColumn<Double> direction_p;
176  ROScalarColumn<Double> interval_p;
177  ROScalarColumn<String> name_p;
178  ROScalarColumn<Int> numLines_p;
179  ROArrayColumn<Double> properMotion_p;
180  ROScalarColumn<Int> sourceId_p;
181  ROScalarColumn<Int> spectralWindowId_p;
182  ROScalarColumn<Double> time_p;
183  //# optional columns
184  ROArrayColumn<Double> position_p;
185  ROScalarColumn<Int> pulsarId_p;
186  ROArrayColumn<Double> restFrequency_p;
187  ROScalarColumn<TableRecord> sourceModel_p;
188  ROArrayColumn<Double> sysvel_p;
189  ROArrayColumn<String> transition_p;
190 
191  //# Access to Measure columns
192  ROScalarMeasColumn<MDirection> directionMeas_p;
193  ROScalarMeasColumn<MEpoch> timeMeas_p;
194  //# Optional Measure columns
195  ROScalarMeasColumn<MPosition> positionMeas_p;
196  ROArrayMeasColumn<MFrequency> restFrequencyMeas_p;
197  ROArrayMeasColumn<MRadialVelocity> sysvelMeas_p;
198 
199  //# Access to Quantum columns
200  ROArrayQuantColumn<Double> directionQuant_p;
201  ROScalarQuantColumn<Double> intervalQuant_p;
202  ROArrayQuantColumn<Double> properMotionQuant_p;
203  ROScalarQuantColumn<Double> timeQuant_p;
204  //# Optional Quantum columns
205  ROArrayQuantColumn<Double> positionQuant_p;
206  ROArrayQuantColumn<Double> restFrequencyQuant_p;
207  ROArrayQuantColumn<Double> sysvelQuant_p;
208 };
209 
210 // <summary>
211 // A class to provide easy read-write access to MSSource columns
212 // </summary>
213 
214 // <use visibility=export>
215 
216 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
217 // </reviewed>
218 
219 // <prerequisite>
220 // <li> MSSource
221 // <li> ArrayColumn
222 // <li> ScalarColumn
223 // </prerequisite>
224 //
225 // <etymology>
226 // MSSourceColumns stands for MeasurementSet Source Table columns.
227 // </etymology>
228 //
229 // <synopsis>
230 // This class provides access to the columns in the MSSource Table,
231 // it does the declaration of all the Scalar and ArrayColumns with the
232 // correct types, so the application programmer doesn't have to
233 // worry about getting those right. There is an access function
234 // for every predefined column. Access to non-predefined columns will still
235 // have to be done with explicit declarations.
236 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
237 // </synopsis>
238 //
239 // <motivation>
240 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
241 // </motivation>
242 
244 {
245 public:
246  // Construct from the supplied Table
247  MSSourceColumns(MSSource& msSource);
248 
249  // The destructor does nothing special
251 
252  // Read-write access to required columns
253  // <group>
270  // </group>
271 
272  // Read-write access to optional columns
273  // <group>
281  return restFrequencyMeas_p;}
287  // </group>
288 
289  // Read-only access to required columns
290  // <group>
291  const ROScalarColumn<Int>& calibrationGroup() const {
293  const ROScalarColumn<String>& code() const {
294  return ROMSSourceColumns::code();}
295  const ROArrayColumn<Double>& direction() const {
297  const ROArrayQuantColumn<Double>& directionQuant() const {
299  const ROScalarMeasColumn<MDirection>& directionMeas() const {
301  const ROScalarColumn<Double>& interval() const {
302  return ROMSSourceColumns::interval();}
303  const ROScalarQuantColumn<Double>& intervalQuant() const {
305  const ROScalarColumn<String>& name() const {
306  return ROMSSourceColumns::name();}
307  const ROScalarColumn<Int>& numLines() const {
308  return ROMSSourceColumns::numLines();}
309  const ROArrayColumn<Double>& properMotion() const {
311  const ROArrayQuantColumn<Double>& properMotionQuant() const {
313  const ROScalarColumn<Int>& sourceId() const {
314  return ROMSSourceColumns::sourceId();}
315  const ROScalarColumn<Int>& spectralWindowId() const {
317  const ROScalarColumn<Double>& time() const {
318  return ROMSSourceColumns::time();}
319  const ROScalarQuantColumn<Double>& timeQuant() const {
321  const ROScalarMeasColumn<MEpoch>& timeMeas() const {
322  return ROMSSourceColumns::timeMeas();}
323  // </group>
324 
325  // Read-only access to optional columns
326  // <group>
327  const ROArrayColumn<Double>& position() const {
328  return ROMSSourceColumns::position();}
329  const ROArrayQuantColumn<Double>& positionQuant() const {
331  const ROScalarMeasColumn<MPosition>& positionMeas() const {
333  const ROScalarColumn<Int>& pulsarId() const {
334  return ROMSSourceColumns::pulsarId();}
335  const ROArrayColumn<Double>& restFrequency() const {
337  const ROArrayQuantColumn<Double>& restFrequencyQuant() const {
339  const ROArrayMeasColumn<MFrequency>& restFrequencyMeas() const {
341  const ROScalarColumn<TableRecord>& sourceModel() const {
343  const ROArrayColumn<Double>& sysvel() const {
344  return ROMSSourceColumns::sysvel();}
345  const ROArrayQuantColumn<Double>& sysvelQuant() const {
347  const ROArrayMeasColumn<MRadialVelocity>& sysvelMeas() const {
349  const ROArrayColumn<String>& transition() const {
351  // </group>
352 
353  // set the epoch type for the TIME column.
354  // <note role=tip>
355  // In principle this function can only be used if the table is empty,
356  // otherwise already written values may thereafter have an incorrect
357  // reference, offset, or unit. However, it is possible that part of the
358  // table gets written before these values are known. In that case the
359  // reference, offset, or units can be set by using a False
360  // <src>tableMustBeEmpty</src> argument.
361  // </note>
362  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
363 
364  // set the direction type for the DIRECTION column. This can only be done
365  // when the table has no rows. Trying to do so at other times will throw an
366  // exception.
368 
369  // set the position type for the POSITION column. This can only be done when
370  // the table has no rows. Trying to do so at other times will throw an
371  // exception.
373 
374  // set the frequency type for the REST_FREQUENCY column. Does nothing if this
375  // column is not defined. This can only be done when the table has no
376  // rows. Trying to do so at other times will throw an exception.
378 
379  // set the radial velocity type for the SYSVEL column. Does nothing if this
380  // column is not defined. This can only be done when the table has no
381  // rows. Trying to do so at other times will throw an exception.
383 
384 protected:
385  //# default constructor creates a object that is not usable. Use the attach
386  //# function correct this.
387  MSSourceColumns();
388 
389  //# attach this object to the supplied table.
390  void attach(MSSource& msSource);
391 
392 private:
393  //# Make the assignment operator and the copy constructor private to prevent
394  //# any compiler generated one from being used.
397 
398  //# Check if any optional columns exist and if so attach them.
399  void attachOptionalCols(MSSource& msSource);
400 
401  //# required columns
412  //# optional columns
419 
420  //# Access to Measure columns
423  //# Optional Measure columns
427 
428  //# Access to Quantum columns
433  //# Optional Quantum columns
437 };
438 
439 } //# NAMESPACE CASACORE - END
440 
441 #endif
void attach(MSSource &msSource)
ROArrayColumn< Double > position_p
ScalarColumn< Int > & calibrationGroup()
Read-write access to required columns.
const ROArrayMeasColumn< MFrequency > & restFrequencyMeas() const
ROArrayColumn< Double > restFrequency_p
const ROScalarMeasColumn< MPosition > & positionMeas() const
const ROArrayMeasColumn< MRadialVelocity > & sysvelMeas() const
const ROScalarColumn< Int > & pulsarId() const
ArrayMeasColumn< MRadialVelocity > & sysvelMeas()
const ROArrayColumn< String > & transition() const
ROScalarColumn< String > code_p
ArrayColumn< Double > & restFrequency()
const ROScalarMeasColumn< MEpoch > & timeMeas() const
ArrayQuantColumn< Double > & positionQuant()
void setFrequencyRef(MFrequency::Types ref)
set the frequency type for the REST_FREQUENCY column.
~ROMSSourceColumns()
The destructor does nothing special.
ArrayColumn< Double > properMotion_p
const ROScalarColumn< Double > & interval() const
ROScalarMeasColumn< MPosition > positionMeas_p
ROScalarColumn< Int > numLines_p
ROScalarMeasColumn< MEpoch > timeMeas_p
ROScalarColumn< TableRecord > sourceModel_p
ROArrayColumn< Double > sysvel_p
ROArrayQuantColumn< Double > directionQuant_p
ScalarQuantColumn< Double > & timeQuant()
ArrayQuantColumn< Double > & restFrequencyQuant()
ArrayColumn< Double > & properMotion()
ScalarColumn< Double > time_p
const ROScalarColumn< String > & code() const
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarColumn< Double > & interval()
ArrayMeasColumn< MFrequency > restFrequencyMeas_p
ScalarColumn< Int > & sourceId()
ScalarColumn< Double > interval_p
const ROScalarColumn< String > & name() const
const ROArrayMeasColumn< MRadialVelocity > & sysvelMeas() const
const ROArrayColumn< Double > & direction() const
A class to provide easy read-only access to MSSource columns.
ArrayQuantColumn< Double > sysvelQuant_p
ScalarColumn< String > & code()
const ROScalarColumn< Int > & calibrationGroup() const
Access to required columns.
const ROScalarColumn< Double > & time() const
const ROArrayColumn< Double > & sysvel() const
ROArrayQuantColumn< Double > sysvelQuant_p
ROScalarQuantColumn< Double > timeQuant_p
void setPositionRef(MPosition::Types ref)
set the position type for the POSITION column.
ArrayQuantColumn< Double > & sysvelQuant()
const ROScalarColumn< Int > & numLines() const
ScalarQuantColumn< Double > intervalQuant_p
ArrayQuantColumn< Double > restFrequencyQuant_p
~MSSourceColumns()
The destructor does nothing special.
MSSourceColumns & operator=(const MSSourceColumns &)
ArrayColumn< Double > position_p
const ROArrayQuantColumn< Double > & positionQuant() const
ScalarColumn< Double > & time()
ROArrayColumn< Double > direction_p
ROArrayColumn< Double > properMotion_p
const ROScalarColumn< Int > & numLines() const
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
const ROArrayColumn< Double > & position() const
Access to optional columns.
ROScalarMeasColumn< MDirection > directionMeas_p
A class to provide easy read-write access to MSSource columns.
ArrayMeasColumn< MFrequency > & restFrequencyMeas()
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
const ROArrayColumn< Double > & position() const
Read-only access to optional columns.
ScalarColumn< String > code_p
const ROScalarQuantColumn< Double > & timeQuant() const
const ROArrayQuantColumn< Double > & properMotionQuant() const
ScalarQuantColumn< Double > & intervalQuant()
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
const ROArrayColumn< String > & transition() const
ArrayQuantColumn< Double > & properMotionQuant()
ScalarColumn< TableRecord > & sourceModel()
const ROScalarColumn< Double > & time() const
const ROArrayColumn< Double > & restFrequency() const
const ROArrayQuantColumn< Double > & properMotionQuant() const
const ROScalarColumn< Int > & sourceId() const
const ROScalarMeasColumn< MDirection > & directionMeas() const
void attach(const MSSource &msSource)
ScalarQuantColumn< Double > timeQuant_p
ROScalarColumn< String > name_p
const ROScalarMeasColumn< MPosition > & positionMeas() const
ROScalarColumn< Int > pulsarId_p
ROArrayMeasColumn< MRadialVelocity > sysvelMeas_p
ArrayQuantColumn< Double > positionQuant_p
ROScalarColumn< Double > interval_p
void attachOptionalCols(const MSSource &msSource)
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
ArrayColumn< Double > & sysvel()
const ROArrayQuantColumn< Double > & sysvelQuant() const
ROArrayQuantColumn< Double > restFrequencyQuant_p
ROArrayQuantColumn< Double > properMotionQuant_p
const ROScalarMeasColumn< MDirection > & directionMeas() const
ArrayColumn< String > & transition()
ArrayQuantColumn< Double > directionQuant_p
ScalarColumn< Int > pulsarId_p
ScalarMeasColumn< MEpoch > timeMeas_p
const ROArrayColumn< Double > & direction() const
ArrayColumn< Double > & position()
Read-write access to optional columns.
ArrayColumn< String > transition_p
ROScalarColumn< Int > sourceId_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
ScalarColumn< Int > & numLines()
ROArrayColumn< String > transition_p
ScalarMeasColumn< MPosition > & positionMeas()
ScalarMeasColumn< MDirection > directionMeas_p
ArrayColumn< Double > sysvel_p
ArrayColumn< Double > & direction()
const ROArrayColumn< Double > & restFrequency() const
const ROScalarQuantColumn< Double > & intervalQuant() const
ROScalarColumn< Double > time_p
const ROScalarColumn< Double > & interval() const
const ROArrayQuantColumn< Double > & positionQuant() const
const ROArrayQuantColumn< Double > & directionQuant() const
ROArrayQuantColumn< Double > positionQuant_p
const ROArrayMeasColumn< MFrequency > & restFrequencyMeas() const
ScalarColumn< String > name_p
const ROScalarColumn< Int > & spectralWindowId() const
const ROScalarColumn< TableRecord > & sourceModel() const
ROScalarQuantColumn< Double > intervalQuant_p
void setDirectionRef(MDirection::Types ref)
set the direction type for the DIRECTION column.
const ROArrayColumn< Double > & sysvel() const
void attachOptionalCols(MSSource &msSource)
ArrayColumn< Double > restFrequency_p
const ROScalarMeasColumn< MEpoch > & timeMeas() const
ScalarColumn< TableRecord > sourceModel_p
const ROScalarColumn< Int > & sourceId() const
ROMSSourceColumns & operator=(const ROMSSourceColumns &)
ScalarColumn< Int > sourceId_p
const ROScalarColumn< Int > & calibrationGroup() const
Read-only access to required columns.
const ROScalarColumn< String > & name() const
ScalarMeasColumn< MPosition > positionMeas_p
const ROArrayQuantColumn< Double > & directionQuant() const
ROScalarColumn< Int > calibrationGroup_p
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 ROArrayQuantColumn< Double > & restFrequencyQuant() 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()
ROArrayMeasColumn< MFrequency > restFrequencyMeas_p
ScalarColumn< Int > spectralWindowId_p
const ROScalarColumn< Int > & spectralWindowId() const
const ROArrayColumn< Double > & properMotion() const
const ROArrayQuantColumn< Double > & restFrequencyQuant() const
const ROScalarColumn< Int > & pulsarId() const
const ROArrayColumn< Double > & properMotion() const
const Bool True
Definition: aipstype.h:43
ScalarMeasColumn< MDirection > & directionMeas()
ArrayQuantColumn< Double > & directionQuant()
Bool isNull() const
Is this object defined? (MSSource table is optional)
ScalarColumn< String > & name()
const ROArrayQuantColumn< Double > & sysvelQuant() const
const ROScalarQuantColumn< Double > & intervalQuant() const
unsigned int uInt
Definition: aipstype.h:51
const ROScalarColumn< String > & code() const
ROScalarColumn< Int > spectralWindowId_p
const ROScalarColumn< TableRecord > & sourceModel() const
const ROScalarQuantColumn< Double > & timeQuant() const
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
ArrayColumn< Double > direction_p