casacore
MSObsColumns.h
Go to the documentation of this file.
1 //# MSObservationColumns.h: provides easy access to MSObservation 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_MSOBSCOLUMNS_H
29 #define MS_MSOBSCOLUMNS_H
30 
31 #include <casacore/casa/aips.h>
32 #include <casacore/measures/Measures/MEpoch.h>
33 #include <casacore/measures/Measures/MCEpoch.h>
34 #include <casacore/measures/TableMeasures/ArrayMeasColumn.h>
35 #include <casacore/measures/TableMeasures/ArrayQuantColumn.h>
36 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
37 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
38 #include <casacore/tables/Tables/ArrayColumn.h>
39 #include <casacore/tables/Tables/ScalarColumn.h>
40 #include <casacore/casa/BasicSL/String.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 class MSObservation;
45 
46 // <summary>
47 // A class to provide easy access to MSObservation columns
48 // </summary>
49 
50 // <use visibility=export>
51 
52 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
53 // </reviewed>
54 
55 // <prerequisite>
56 // <li> MSObservation
57 // <li> ArrayColumn
58 // <li> ScalarColumn
59 // </prerequisite>
60 //
61 // <etymology>
62 // MSObservationColumns stands for MeasurementSet Observation Table
63 // columns.
64 // </etymology>
65 //
66 // <synopsis>
67 // This class provides access to the columns in the MSObservation Table,
68 // it does the declaration of all the Scalar and ArrayColumns with the
69 // correct types, so the application programmer doesn't have to
70 // worry about getting those right. There is an access function
71 // for every predefined column. Access to non-predefined columns will still
72 // have to be done with explicit declarations.
73 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
74 // </synopsis>
75 //
76 // <motivation>
77 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
78 // </motivation>
79 
81 {
82 public:
83  // Create a columns object that accesses the data in the specified Table
84  MSObservationColumns(const MSObservation& msObservation);
85 
86  // The desctructor does nothing special
88 
89  // Access to required columns
90  // <group>
104  // </group>
105 
106  // Const access to required columns
107  // <group>
108  const ScalarColumn<Bool>& flagRow() const {return flagRow_p;}
109  const ArrayColumn<String>& log() const {return log_p;}
110  const ScalarColumn<String>& observer() const {return observer_p;}
111  const ScalarColumn<String>& project() const {return project_p;}
114  return releaseDateQuant_p;}
116  return releaseDateMeas_p;}
117  const ArrayColumn<String>& schedule() const {return schedule_p;}
120  const ArrayColumn<Double>& timeRange() const {return timeRange_p;}
122  return timeRangeQuant_p;}
124  return timeRangeMeas_p;}
125  // </group>
126 
127  // Convenience function that returns the number of rows in any of the columns
128  rownr_t nrow() const {return flagRow_p.nrow();}
129 
130  // set the epoch type for the TIME_RANGE & RELEASE_DATE columns.
131  // <note role=tip>
132  // In principle this function can only be used if the table is empty,
133  // otherwise already written values may thereafter have an incorrect
134  // reference, offset, or unit. However, it is possible that part of the
135  // table gets written before these values are known. In that case the
136  // reference, offset, or units can be set by using a False
137  // <src>tableMustBeEmpty</src> argument.
138  // </note>
139  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
140 
141 protected:
142  //# default constructor creates a object that is not usable. Use the attach
143  //# function correct this.
145 
146  //# attach this object to the supplied table.
147  void attach(const MSObservation& msObservation);
148 
149 private:
150  //# Make the assignment operator and the copy constructor private to prevent
151  //# any compiler generated one from being used.
154 
155  //# required columns
165 
166  //# Access to Measure columns
169 
170  //# Access to Quantum columns
173 };
174 
175 //# Define the RO version for backward compatibility.
177 
178 } //# NAMESPACE CASACORE - END
179 
180 #endif
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarQuantColumn< Double > & releaseDateQuant()
Definition: MSObsColumns.h:96
ScalarColumn< Bool > & flagRow()
Access to required columns.
Definition: MSObsColumns.h:91
~MSObservationColumns()
The desctructor does nothing special.
ArrayQuantColumn< Double > & timeRangeQuant()
Definition: MSObsColumns.h:102
ScalarColumn< String > telescopeName_p
Definition: MSObsColumns.h:163
MSObservationColumns(const MSObservationColumns &)
ScalarColumn< String > & observer()
Definition: MSObsColumns.h:93
ScalarColumn< String > & telescopeName()
Definition: MSObsColumns.h:100
ArrayColumn< String > & log()
Definition: MSObsColumns.h:92
ScalarQuantColumn< Double > releaseDateQuant_p
Definition: MSObsColumns.h:171
const ScalarColumn< String > & observer() const
Definition: MSObsColumns.h:110
ArrayColumn< String > schedule_p
Definition: MSObsColumns.h:161
const ScalarColumn< String > & telescopeName() const
Definition: MSObsColumns.h:119
const ScalarColumn< Double > & releaseDate() const
Definition: MSObsColumns.h:112
const ArrayColumn< Double > & timeRange() const
Definition: MSObsColumns.h:120
ArrayQuantColumn< Double > timeRangeQuant_p
Definition: MSObsColumns.h:172
const ArrayMeasColumn< MEpoch > & timeRangeMeas() const
Definition: MSObsColumns.h:123
MSObservationColumns(const MSObservation &msObservation)
Create a columns object that accesses the data in the specified Table.
const ScalarColumn< String > & project() const
Definition: MSObsColumns.h:111
ArrayColumn< Double > & timeRange()
Definition: MSObsColumns.h:101
ScalarColumn< String > observer_p
Definition: MSObsColumns.h:158
ScalarColumn< Bool > flagRow_p
Definition: MSObsColumns.h:156
ArrayMeasColumn< MEpoch > timeRangeMeas_p
Definition: MSObsColumns.h:168
ScalarColumn< String > scheduleType_p
Definition: MSObsColumns.h:162
ScalarColumn< Double > & releaseDate()
Definition: MSObsColumns.h:95
const ScalarQuantColumn< Double > & releaseDateQuant() const
Definition: MSObsColumns.h:113
void attach(const MSObservation &msObservation)
const ArrayColumn< String > & schedule() const
Definition: MSObsColumns.h:117
ArrayColumn< String > log_p
Definition: MSObsColumns.h:157
const ScalarColumn< String > & scheduleType() const
Definition: MSObsColumns.h:118
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME_RANGE & RELEASE_DATE columns.
ScalarMeasColumn< MEpoch > releaseDateMeas_p
Definition: MSObsColumns.h:167
const ScalarMeasColumn< MEpoch > & releaseDateMeas() const
Definition: MSObsColumns.h:115
ScalarColumn< String > project_p
Definition: MSObsColumns.h:159
ArrayMeasColumn< MEpoch > & timeRangeMeas()
Definition: MSObsColumns.h:103
ScalarMeasColumn< MEpoch > & releaseDateMeas()
Definition: MSObsColumns.h:97
MSObservationColumns & operator=(const MSObservationColumns &)
ArrayColumn< String > & schedule()
Definition: MSObsColumns.h:98
const ArrayColumn< String > & log() const
Definition: MSObsColumns.h:109
const ScalarColumn< Bool > & flagRow() const
Const access to required columns.
Definition: MSObsColumns.h:108
const ArrayQuantColumn< Double > & timeRangeQuant() const
Definition: MSObsColumns.h:121
ArrayColumn< Double > timeRange_p
Definition: MSObsColumns.h:164
ScalarColumn< String > & scheduleType()
Definition: MSObsColumns.h:99
ScalarColumn< String > & project()
Definition: MSObsColumns.h:94
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
Definition: MSObsColumns.h:128
ScalarColumn< Double > releaseDate_p
Definition: MSObsColumns.h:160
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
MSObservationColumns ROMSObservationColumns
Definition: MSObsColumns.h:176
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