casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSFlagCmdColumns.h
Go to the documentation of this file.
00001 //# MSFlagCmdColumns.h: provides easy access to MSFlagCmd columns
00002 //# Copyright (C) 1999,2000
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: MSFlagCmdColumns.h 19944 2007-02-27 11:14:34Z Malte.Marquarding $
00027 
00028 #ifndef MS_MSFLAGCMDCOLUMNS_H
00029 #define MS_MSFLAGCMDCOLUMNS_H
00030 
00031 #include <casa/aips.h>
00032 #include <measures/Measures/MEpoch.h>
00033 #include <measures/Measures/MCEpoch.h>
00034 #include <measures/TableMeasures/ScalarMeasColumn.h>
00035 #include <measures/TableMeasures/ScalarQuantColumn.h>
00036 #include <tables/Tables/ScalarColumn.h>
00037 #include <casa/BasicSL/String.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 class MSFlagCmd;
00042 
00043 // <summary>
00044 // A class to provide easy read-only access to MSFlagCmd columns
00045 // </summary>
00046 
00047 // <use visibility=export>
00048 
00049 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00050 // </reviewed>
00051 
00052 // <prerequisite>
00053 //   <li> MSFlagCmd
00054 //   <li> ScalarColumn
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 // ROMSFlagCmdColumns stands for Read-Only MeasurementSet FlagCmd Table columns.
00059 // </etymology>
00060 //
00061 // <synopsis>
00062 // This class provides read-only access to the columns in the MSFlagCmd
00063 // Table.  It does the declaration of all the ScalarColumns with the correct
00064 // types, so the application programmer doesn't have to worry about getting
00065 // those right. There is an access function for every predefined column. Access
00066 // to non-predefined columns will still have to be done with explicit
00067 // declarations.  See <linkto class=ROMSColumns> ROMSColumns</linkto> for
00068 // an example.
00069 // </synopsis>
00070 //
00071 // <motivation>
00072 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00073 // </motivation>
00074 
00075 class ROMSFlagCmdColumns
00076 {
00077 public:
00078   // Create a columns object that accesses the data in the specified Table
00079   ROMSFlagCmdColumns(const MSFlagCmd& msFlagCmd);
00080 
00081   // The destructor does nothing special
00082   ~ROMSFlagCmdColumns();
00083 
00084   // Access to required columns
00085   // <group>
00086   const ROScalarColumn<Bool>& applied() const {return applied_p;}
00087   const ROScalarColumn<String>& command() const {return command_p;}
00088   const ROScalarQuantColumn<Double>& intervalQuant() const {
00089     return intervalQuant_p;}
00090   const ROScalarColumn<Double>& interval() const {return interval_p;}
00091   const ROScalarColumn<Int>& level() const {return level_p;}
00092   const ROScalarColumn<String>& reason() const {return reason_p;}
00093   const ROScalarColumn<Int>& severity() const {return severity_p;}
00094   const ROScalarColumn<Double>& time() const {return time_p;}
00095   const ROScalarQuantColumn<Double>& timeQuant() const { return timeQuant_p;}
00096   const ROScalarMeasColumn<MEpoch>& timeMeas() const { return timeMeas_p;}
00097   const ROScalarColumn<String>& type() const {return type_p;}
00098   // </group>
00099 
00100   // Convenience function that returns the number of rows in any of the columns
00101   uInt nrow() const {return applied_p.nrow();}
00102 
00103 protected:
00104   //# default constructor creates a object that is not usable. Use the attach
00105   //# function correct this.
00106   ROMSFlagCmdColumns();
00107 
00108   //# attach this object to the supplied table.
00109   void attach(const MSFlagCmd& msFlagCmd);
00110 
00111 private:
00112   //# Make the assignment operator and the copy constructor private to prevent
00113   //# any compiler generated one from being used.
00114   ROMSFlagCmdColumns(const ROMSFlagCmdColumns&);
00115   ROMSFlagCmdColumns& operator=(const ROMSFlagCmdColumns&);
00116 
00117   //# required columns
00118   ROScalarColumn<Bool> applied_p;
00119   ROScalarColumn<String> command_p;
00120   ROScalarColumn<Double> interval_p;
00121   ROScalarColumn<Int> level_p;
00122   ROScalarColumn<String> reason_p;
00123   ROScalarColumn<Int> severity_p;
00124   ROScalarColumn<Double> time_p;
00125   ROScalarColumn<String> type_p;
00126 
00127   //# Access to Measure columns
00128   ROScalarMeasColumn<MEpoch> timeMeas_p;
00129 
00130   //# Access to Quantum columns
00131   ROScalarQuantColumn<Double> intervalQuant_p;
00132   ROScalarQuantColumn<Double> timeQuant_p;
00133 };
00134 
00135 // <summary>
00136 // A class to provide easy read-write access to MSFlagCmd columns
00137 // </summary>
00138 
00139 // <use visibility=export>
00140 
00141 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00142 // </reviewed>
00143 
00144 // <prerequisite>
00145 //   <li> MSFlagCmd
00146 //   <li> ScalarColumn
00147 // </prerequisite>
00148 //
00149 // <etymology>
00150 // MSFlagCmdColumns stands for MeasurementSet FlagCmd Table columns.
00151 // </etymology>
00152 //
00153 // <synopsis>
00154 // This class provides access to the columns in the MSFlagCmd Table, it does
00155 // the declaration of all the ScalarColumns with the correct types, so the
00156 // application programmer doesn't have to worry about getting those
00157 // right. There is an access function for every predefined column. Access to
00158 // non-predefined columns will still have to be done with explicit
00159 // declarations.  See <linkto class=MSColumns> MSColumns</linkto> for an
00160 // example.
00161 // </synopsis>
00162 //
00163 // <motivation>
00164 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00165 // </motivation>
00166 
00167 class MSFlagCmdColumns: public ROMSFlagCmdColumns
00168 {
00169 public:
00170   // Create a columns object that accesses the data in the specified Table
00171   MSFlagCmdColumns(MSFlagCmd& msFlagCmd);
00172   
00173   // The destructor does nothing special
00174   ~MSFlagCmdColumns();
00175 
00176   // Read-write access to required columns
00177   // <group>
00178   ScalarColumn<Bool>& applied() {return applied_p;}
00179   ScalarColumn<String>& command() {return command_p;}
00180   ScalarColumn<Double>& interval() {return interval_p;}
00181   ScalarQuantColumn<Double>& intervalQuant() {return intervalQuant_p;}
00182   ScalarColumn<Int>& level() {return level_p;}
00183   ScalarColumn<String>& reason() {return reason_p;}
00184   ScalarColumn<Int>& severity() {return severity_p;}
00185   ScalarColumn<Double>& time() {return time_p;}
00186   ScalarQuantColumn<Double>& timeQuant() {return timeQuant_p;}
00187   ScalarMeasColumn<MEpoch>& timeMeas() {return timeMeas_p;}
00188   ScalarColumn<String>& type() {return type_p;}
00189   // </group>
00190 
00191   // Read-only access to required columns
00192   // <group>
00193   const ROScalarColumn<Bool>& applied() const {
00194     return ROMSFlagCmdColumns::applied();}
00195   const ROScalarColumn<String>& command() const {
00196     return ROMSFlagCmdColumns::command();}
00197   const ROScalarQuantColumn<Double>& intervalQuant() const {
00198     return ROMSFlagCmdColumns::intervalQuant();}
00199   const ROScalarColumn<Double>& interval() const {
00200     return ROMSFlagCmdColumns::interval();}
00201   const ROScalarColumn<Int>& level() const {
00202     return ROMSFlagCmdColumns::level();}
00203   const ROScalarColumn<String>& reason() const {
00204     return ROMSFlagCmdColumns::reason();}
00205   const ROScalarColumn<Int>& severity() const {
00206     return ROMSFlagCmdColumns::severity();}
00207   const ROScalarColumn<Double>& time() const {
00208     return ROMSFlagCmdColumns::time();}
00209   const ROScalarQuantColumn<Double>& timeQuant() const {
00210     return ROMSFlagCmdColumns::timeQuant();}
00211   const ROScalarMeasColumn<MEpoch>& timeMeas() const {
00212     return ROMSFlagCmdColumns::timeMeas();}
00213   const ROScalarColumn<String>& type() const {
00214     return ROMSFlagCmdColumns::type();}
00215   // </group>
00216 
00217   // set the epoch type for the FLAG_CMD column.
00218   // <note role=tip>
00219   // In principle this function can only be used if the table is empty,
00220   // otherwise already written values may thereafter have an incorrect
00221   // reference, offset, or unit.  However, it is possible that part of the
00222   // table gets written before these values are known.  In that case the
00223   // reference, offset, or units can be set by using a False
00224   // <src>tableMustBeEmpty</src> argument.
00225   // </note>
00226   void setEpochRef(MEpoch::Types ref, Bool tableMustBeEmpty=True);
00227 
00228 protected:
00229   //# default constructor creates a object that is not usable. Use the attach
00230   //# function correct this.
00231   MSFlagCmdColumns();
00232 
00233   //# attach this object to the supplied table.
00234   void attach(MSFlagCmd& msFlagCmd);
00235 
00236 private:
00237   //# Make the assignment operator and the copy constructor private to prevent
00238   //# any compiler generated one from being used.
00239   MSFlagCmdColumns(const MSFlagCmdColumns&);
00240   MSFlagCmdColumns& operator=(const MSFlagCmdColumns&);
00241 
00242   //# required columns
00243   ScalarColumn<Bool> applied_p;
00244   ScalarColumn<String> command_p;
00245   ScalarColumn<Double> interval_p;
00246   ScalarColumn<Int> level_p;
00247   ScalarColumn<String> reason_p;
00248   ScalarColumn<Int> severity_p;
00249   ScalarColumn<Double> time_p;
00250   ScalarColumn<String> type_p;
00251 
00252   //# Access to Measure columns
00253   ScalarMeasColumn<MEpoch> timeMeas_p;
00254 
00255   //# Access to Quantum columns
00256   ScalarQuantColumn<Double> intervalQuant_p;
00257   ScalarQuantColumn<Double> timeQuant_p;
00258 };
00259 
00260 } //# NAMESPACE CASA - END
00261 
00262 #endif