casacore
MSHistoryColumns.h
Go to the documentation of this file.
1 //# MSHistoryColumns.h: provides easy access to MSHistory 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_MSHISTORYCOLUMNS_H
29 #define MS_MSHISTORYCOLUMNS_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/tables/Tables/ScalarColumn.h>
35 #include <casacore/tables/Tables/ArrayColumn.h>
36 #include <casacore/measures/TableMeasures/ScalarMeasColumn.h>
37 #include <casacore/measures/TableMeasures/ScalarQuantColumn.h>
38 #include <casacore/casa/BasicSL/String.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 class MSHistory;
43 
44 // <summary>
45 // A class to provide easy access to MSHistory columns
46 // </summary>
47 
48 // <use visibility=export>
49 
50 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
51 // </reviewed>
52 
53 // <prerequisite>
54 // <li> MSHistory
55 // <li> ArrayColumn
56 // <li> ScalarColumn
57 // </prerequisite>
58 //
59 // <etymology>
60 // MSHistoryColumns stands for MeasurementSet History Table columns.
61 // </etymology>
62 //
63 // <synopsis>
64 // This class provides access to the columns in the MSHistory Table,
65 // it does the declaration of all the Scalar and ArrayColumns with the
66 // correct types, so the application programmer doesn't have to
67 // worry about getting those right. There is an access function
68 // for every predefined column. Access to non-predefined columns will still
69 // have to be done with explicit declarations.
70 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
71 //
72 // Note by GvD 28-Jan-2010:
73 // According to note 229 the OBJECTID column should contain Strings.
74 // It is, however, defined as Int. It has to be left as such, otherwise older
75 // MeasurementSets cannot be read anymore.
76 // </synopsis>
77 //
78 // <motivation>
79 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
80 // </motivation>
81 
83 {
84 public:
85  // Create a columns object that accesses the data in the specified Table
86  MSHistoryColumns(const MSHistory& msHistory);
87 
88  // The destructor does nothing special
90 
91  // Access to required columns
92  // <group>
104  // </group>
105 
106  // Const access to required columns
107  // <group>
109  const ArrayColumn<String>& appParams() const {return appParams_p;}
110  const ArrayColumn<String>& cliCommand() const {return cliCommand_p;}
111  const ScalarColumn<String>& message() const {return message_p;}
112  const ScalarColumn<Int>& objectId() const {return objectId_p;}
114  const ScalarColumn<String>& origin() const {return origin_p;}
115  const ScalarColumn<String>& priority() const {return priority_p;}
116  const ScalarColumn<Double>& time() const {return time_p;}
119  // </group>
120 
121  // Convenience function that returns the number of rows in any of the columns
122  rownr_t nrow() const {return application_p.nrow();}
123 
124  // set the epoch type for the TIME column.
125  // <note role=tip>
126  // In principle this function can only be used if the table is empty,
127  // otherwise already written values may thereafter have an incorrect
128  // reference, offset, or unit. However, it is possible that part of the
129  // table gets written before these values are known. In that case the
130  // reference, offset, or units can be set by using a False
131  // <src>tableMustBeEmpty</src> argument.
132  // </note>
133  void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
134 
135 protected:
136  //# default constructor creates a object that is not usable. Use the attach
137  //# function correct this.
139 
140  //# attach this object to the supplied table.
141  void attach(const MSHistory& msHistory);
142 
143 private:
144  //# Make the assignment operator and the copy constructor private to prevent
145  //# any compiler generated one from being used.
148 
149  //# required columns
159 
160  //# Access to Measure columns
162 
163  //# Access to Quantum columns
165 };
166 
167 //# Define the RO version for backward compatibility.
169 
170 } //# NAMESPACE CASACORE - END
171 
172 #endif
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
ScalarColumn< String > & origin()
ScalarColumn< Double > & time()
const ScalarColumn< Int > & observationId() const
const ScalarColumn< Int > & objectId() const
rownr_t nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarMeasColumn< MEpoch > timeMeas_p
ArrayColumn< String > & cliCommand()
ArrayColumn< String > appParams_p
ScalarColumn< String > application_p
ScalarColumn< Int > & objectId()
ScalarColumn< Double > time_p
MSHistoryColumns & operator=(const MSHistoryColumns &)
const ScalarColumn< Double > & time() const
void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True)
set the epoch type for the TIME column.
ScalarColumn< Int > objectId_p
ScalarQuantColumn< Double > timeQuant_p
ScalarColumn< String > origin_p
ScalarColumn< String > & application()
Access to required columns.
ScalarColumn< String > priority_p
ScalarColumn< Int > & observationId()
void attach(const MSHistory &msHistory)
ScalarColumn< String > & priority()
ScalarColumn< String > & message()
~MSHistoryColumns()
The destructor does nothing special.
const ScalarColumn< String > & message() const
ScalarQuantColumn< Double > & timeQuant()
MSHistoryColumns(const MSHistoryColumns &)
ArrayColumn< String > cliCommand_p
const ArrayColumn< String > & cliCommand() const
const ScalarColumn< String > & priority() const
const ScalarColumn< String > & origin() const
const ArrayColumn< String > & appParams() const
MSHistoryColumns(const MSHistory &msHistory)
Create a columns object that accesses the data in the specified Table.
const ScalarMeasColumn< MEpoch > & timeMeas() const
ScalarColumn< Int > observationId_p
ScalarColumn< String > message_p
ScalarMeasColumn< MEpoch > & timeMeas()
ArrayColumn< String > & appParams()
const ScalarColumn< String > & application() const
Const access to required columns.
const ScalarQuantColumn< Double > & timeQuant() const
this file contains all the compiler specific defines
Definition: mainpage.dox:28
MSHistoryColumns ROMSHistoryColumns
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