casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSProcessorColumns.h
Go to the documentation of this file.
00001 //# MSProcessorColumns.h: provides easy access to MSProcessor 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: MSProcessorColumns.h 18093 2004-11-30 17:51:10Z ddebonis $
00027 
00028 #ifndef MS_MSPROCESSORCOLUMNS_H
00029 #define MS_MSPROCESSORCOLUMNS_H
00030 
00031 #include <casa/aips.h>
00032 #include <ms/MeasurementSets/MSProcessor.h>
00033 #include <tables/Tables/ScalarColumn.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 class MSProcessor;
00038 
00039 // <summary>
00040 // A class to provide easy read-only access to MSProcessor columns
00041 // </summary>
00042 
00043 // <use visibility=export>
00044 
00045 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00046 // </reviewed>
00047 
00048 // <prerequisite>
00049 //   <li> MSProcessor
00050 //   <li> ArrayColumn
00051 //   <li> ScalarColumn
00052 // </prerequisite>
00053 //
00054 // <etymology>
00055 // ROMSProcessorColumns stands for Read-Only MeasurementSet Processor Table columns.
00056 // </etymology>
00057 //
00058 // <synopsis>
00059 // This class provides read-only access to the columns in the MSProcessor
00060 // Table.  It does the declaration of all the Scalar and ArrayColumns with the
00061 // correct types, so the application programmer doesn't have to worry about
00062 // getting those right. There is an access function for every predefined
00063 // column. Access to non-predefined columns will still have to be done with
00064 // explicit declarations.  See <linkto class=ROMSColumns>
00065 // ROMSColumns</linkto> for an example.
00066 // </synopsis>
00067 //
00068 // <motivation>
00069 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00070 // </motivation>
00071 
00072 class ROMSProcessorColumns
00073 {
00074 public:
00075   // Create a columns object that accesses the data in the specified Table
00076   ROMSProcessorColumns(const MSProcessor& msProcessor);
00077 
00078   // The destructor does nothing special
00079   ~ROMSProcessorColumns();
00080 
00081   // Access to required columns
00082   // <group>
00083   const ROScalarColumn<Bool>& flagRow() const {return flagRow_p;}
00084   const ROScalarColumn<Int>& modeId() const {return modeId_p;}
00085   const ROScalarColumn<String>& type() const {return type_p;}
00086   const ROScalarColumn<Int>& typeId() const {return typeId_p;}
00087   const ROScalarColumn<String>& subType() const {return subType_p;}
00088   // </group>
00089 
00090   // Read-only access to optional columns
00091   // <group>
00092   const ROScalarColumn<Int>& passId() const {return passId_p;}
00093   // </group>
00094 
00095   // Convenience function that returns the number of rows in any of the columns
00096   uInt nrow() const {return flagRow_p.nrow();}
00097 
00098 protected:
00099   //# default constructor creates a object that is not usable. Use the attach
00100   //# function correct this.
00101   ROMSProcessorColumns();
00102 
00103   //# attach this object to the supplied table.
00104   void attach(const MSProcessor& msProcessor);
00105 
00106 private:
00107   //# Make the assignment operator and the copy constructor private to prevent
00108   //# any compiler generated one from being used.
00109   ROMSProcessorColumns(const ROMSProcessorColumns&);
00110   ROMSProcessorColumns& operator=(const ROMSProcessorColumns&);
00111 
00112   //# Check if any optional columns exist and if so attach them.
00113   void attachOptionalCols(const MSProcessor& msField);
00114   
00115   //# required columns
00116   ROScalarColumn<Bool> flagRow_p;
00117   ROScalarColumn<Int> modeId_p;
00118   ROScalarColumn<String> type_p;
00119   ROScalarColumn<Int> typeId_p;
00120   ROScalarColumn<String> subType_p;
00121   //# optional columns
00122   ROScalarColumn<Int> passId_p;
00123 };
00124 
00125 // <summary>
00126 // A class to provide easy read-write access to MSProcessor columns
00127 // </summary>
00128 
00129 // <use visibility=export>
00130 
00131 // <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
00132 // </reviewed>
00133 
00134 // <prerequisite>
00135 //   <li> MSProcessor
00136 //   <li> ScalarColumn
00137 // </prerequisite>
00138 //
00139 // <etymology>
00140 // MSProcessorColumns stands for MeasurementSet Processor Table columns.
00141 // </etymology>
00142 //
00143 // <synopsis>
00144 // This class provides access to the columns in the MSProcessor Table,
00145 // it does the declaration of all the Scalar and ArrayColumns with the
00146 // correct types, so the application programmer doesn't have to
00147 // worry about getting those right. There is an access function
00148 // for every predefined column. Access to non-predefined columns will still
00149 // have to be done with explicit declarations.
00150 // See <linkto class=MSColumns> MSColumns</linkto> for an example.
00151 // </synopsis>
00152 //
00153 // <motivation>
00154 // See <linkto class=MSColumns> MSColumns</linkto> for the motivation.
00155 // </motivation>
00156 
00157 class MSProcessorColumns: public ROMSProcessorColumns
00158 {
00159 public:
00160   // Create a columns object that accesses the data in the specified Table
00161   MSProcessorColumns(MSProcessor& msProcessor);
00162 
00163   // The destructor does nothing special
00164   ~MSProcessorColumns();
00165 
00166   // Read-write access to required columns
00167   // <group>
00168   ScalarColumn<Bool>& flagRow() {return flagRow_p;}
00169   ScalarColumn<Int>& modeId() {return modeId_p;}
00170   ScalarColumn<String>& type() {return type_p;}
00171   ScalarColumn<Int>& typeId() {return typeId_p;}
00172   ScalarColumn<String>& subType() {return subType_p;}
00173   // </group>
00174 
00175   // Read-write access to optional columns
00176   // <group>
00177   ScalarColumn<Int>& passId() {return passId_p;}
00178   // </group>
00179 
00180   // Read-only access to required columns
00181   // <group>
00182   const ROScalarColumn<Bool>& flagRow() const {
00183     return ROMSProcessorColumns::flagRow();}
00184   const ROScalarColumn<Int>& modeId() const {
00185     return ROMSProcessorColumns::modeId();}
00186   const ROScalarColumn<String>& type() const {
00187     return ROMSProcessorColumns::type();}
00188   const ROScalarColumn<Int>& typeId() const {
00189     return ROMSProcessorColumns::typeId();}
00190   const ROScalarColumn<String>& subType() const {
00191     return ROMSProcessorColumns::subType();}
00192   // </group>
00193 
00194   // Read-only access to optional columns
00195   // <group>
00196   const ROScalarColumn<Int>& passId() const {
00197     return ROMSProcessorColumns::passId();}
00198   // </group>
00199 
00200 protected:
00201   //# default constructor creates a object that is not usable. Use the attach
00202   //# function correct this.
00203   MSProcessorColumns();
00204 
00205   //# attach this object to the supplied table.
00206   void attach(MSProcessor& msProcessor);
00207 
00208 private:
00209   //# Make the assignment operator and the copy constructor private to prevent
00210   //# any compiler generated one from being used.
00211   MSProcessorColumns(const MSProcessorColumns&);
00212   MSProcessorColumns& operator=(const MSProcessorColumns&);
00213 
00214   //# Check if any optional columns exist and if so attach them.
00215   void attachOptionalCols(MSProcessor& msProcessor);
00216   
00217   //# required columns
00218   ScalarColumn<Bool> flagRow_p;
00219   ScalarColumn<Int> modeId_p;
00220   ScalarColumn<String> type_p;
00221   ScalarColumn<Int> typeId_p;
00222   ScalarColumn<String> subType_p;
00223   //# optional columns
00224   ScalarColumn<Int> passId_p;
00225 };
00226 
00227 } //# NAMESPACE CASA - END
00228 
00229 #endif