casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CTColumns.h
Go to the documentation of this file.
00001 //# CTColumns.h: provides easy access to (new) CalTable columns
00002 //# Copyright (C) 2011
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: CTColumns.h 23338 2013-03-21 04:03:20Z george.moellenbrock $
00027 
00028 #ifndef CALIBRATION_NEWCALTABLECOLUMNS_H
00029 #define CALIBRATION_NEWCALTABLECOLUMNS_H
00030 
00031 #include <casa/aips.h>
00032 #include <measures/Measures/MDirection.h>
00033 #include <measures/Measures/MEpoch.h>
00034 #include <synthesis/CalTables/NewCalTable.h>
00035 #include <synthesis/CalTables/CTMainColumns.h>
00036 #include <ms/MeasurementSets/MSAntennaColumns.h>
00037 #include <ms/MeasurementSets/MSFieldColumns.h>
00038 #include <ms/MeasurementSets/MSHistoryColumns.h>
00039 #include <ms/MeasurementSets/MSSpWindowColumns.h>
00040 
00041 namespace casa { //# NAMESPACE CASA - BEGIN
00042 
00043 class NewCalTable;
00044 // <summary>
00045 // A class to provide easy read-only access to new CalTable columns
00046 // </summary>
00047 
00048 // <use visibility=export>
00049 
00050 // <reviewed reviewer="" date="" tests="" demos="">
00051 // </reviewed>
00052 
00053 // <prerequisite>
00054 //   <li> NewCalTable
00055 //   <li> ArrayColumn
00056 //   <li> ScalarColumn
00057 // </prerequisite>
00058 //
00059 // <etymology>
00060 // ROCTColumns stands for Read-Only NewCalTable Table columns.
00061 // </etymology>
00062 //
00063 // <synopsis>
00064 // This class provides read-only access to the columns in the NewCalTable, similar
00065 // to the ROMSColumns for MeasurementSet.
00066 // It does the declaration of all the Scalar and ArrayColumns with the
00067 // correct types, so the application programmer doesn't have to
00068 // worry about getting those right. There is an access function
00069 // for every predefined column. Access to non-predefined columns will still
00070 // have to be done with explicit declarations.
00071 // </synopsis>
00072 //
00073 // <example>
00074 // <srcblock>
00075 // // use as follows
00076 // NewCalTable newcalt("mynewcalt");
00077 // RONCTColumns nctc(newcalt);
00078 // // show time from row 5
00079 // cout << nctc.time()(5);
00080 // // show name of antenna on row 3 in antenna table
00081 // cout << nctc.antenna().name();
00082 // </srcblock>
00083 // </example>
00084 //
00085 // <motivation>
00086 // See <linkto class=CTColumns> CTColumns</linkto> for the motivation.
00087 // </motivation>
00088 //
00089 // <todo asof="">
00090 // </todo>
00091 
00092 class ROCTColumns: public ROCTMainColumns
00093 {
00094 public:
00095   // Create a columns object that accesses the data in the specified MS
00096   ROCTColumns(const NewCalTable& caltable);
00097 
00098   // The destructor does nothing special
00099   ~ROCTColumns();
00100 
00101   // Access to required subtables
00102   // <group>
00103   const ROCTObservationColumns& observation() const {return observation_p;}
00104   const ROCTAntennaColumns& antenna() const {return antenna_p;}
00105   const ROCTFieldColumns& field() const {return field_p;}
00106   const ROCTHistoryColumns& history() const {return history_p;}
00107   const ROCTSpWindowColumns& spectralWindow() const {
00108     return spectralWindow_p;}
00109   // </group>
00110 
00111   // Access to optional subtables
00112   // <group>
00113   // </group>
00114 
00115 protected:
00116   friend class NewCalTable; 
00117 private:
00118   // Access to subtables
00119   ROCTObservationColumns observation_p;
00120   ROCTAntennaColumns antenna_p;
00121   ROCTFieldColumns field_p;
00122   ROCTHistoryColumns history_p;
00123   ROCTSpWindowColumns spectralWindow_p;
00124 
00125 };
00126 
00127 // <summary>
00128 // A class to provide easy read-write access to NewCalTable columns
00129 // </summary>
00130 
00131 // <use visibility=export>
00132 
00133 // <reviewed reviewer="" date="" tests="" demos="">
00134 // </reviewed>
00135 
00136 // <prerequisite>
00137 //   <li> NewCalTable
00138 //   <li> ArrayColumn
00139 //   <li> ScalarColumn
00140 // </prerequisite>
00141 //
00142 // <etymology>
00143 // CTColumns stands for  NewCalTable columns.
00144 // </etymology>
00145 //
00146 // <synopsis>
00147 // This class provides access to all the subtables and direct access to all the
00148 // columns in the NewCalTable.  It does the declaration of all the Scalar
00149 // and ArrayColumns with the correct types, so the application programmer
00150 // doesn't have to worry about getting those right. There is an access function
00151 // for every predefined column. Access to non-predefined columns will still
00152 // have to be done with explicit declarations.
00153 // </synopsis>
00154 //
00155 // <example>
00156 // <srcblock>
00157 // // use as follows
00158 // NewCalTable newcalt("mynewcalt",Table::Update);
00159 // CTColumns nctc(newcalt);
00160 // // show time from row 5
00161 // cout << nctc.time()(5);
00162 // // change name of antenna on row 3 in antenna table
00163 // nctc.antenna().name().put(3,"NewAnt-3");
00164 // </srcblock>
00165 // </example>
00166 //
00167 // <motivation>
00168 // Having to type long lists of Scalar and Array column declarations gets
00169 // very tedious. This class attempts to relieve some of that tedium, while
00170 // at the same time concentrating all the declarations in one place,
00171 // making Type errors in the column declaration (only caught at run-time) less
00172 // probable. Type errors in the use of the columns is caught at compile
00173 // time.
00174 // </motivation>
00175 //
00176 // <todo asof="">
00177 // </todo>
00178 
00179 class CTColumns: public CTMainColumns
00180 {   
00181 public:
00182   // Create a columns object that accesses the data in the specified caltable 
00183   CTColumns(NewCalTable& caltable);
00184 
00185   // The destructor does nothing special
00186   ~CTColumns();
00187 
00188   // Read-write access to required subtables
00189   // <group>
00190   CTObservationColumns& observation() {return observation_p;}
00191   CTAntennaColumns& antenna() {return antenna_p;}
00192   CTFieldColumns& field() {return field_p;}
00193   CTHistoryColumns& history() {return history_p;}
00194   CTSpWindowColumns& spectralWindow() {return spectralWindow_p;}
00195 
00196   // </group>
00197 
00198   // Read-write access to optional subtables
00199   // <group>
00200   // </group>
00201 
00202   // Read-only access to required subtables
00203   // <group>
00204   const ROCTObservationColumns& observation() const {return observation_p;}
00205   const ROCTAntennaColumns& antenna() const {return antenna_p;}
00206   const ROCTFieldColumns& field() const {return field_p;}
00207   const ROCTHistoryColumns& history() const {return history_p;}
00208   const ROCTSpWindowColumns& spectralWindow() const {
00209     return spectralWindow_p;}
00210 
00211 //protected:
00212 //  friend class NewCalTable; 
00213 
00214 private:
00215   // Access to subtables
00216   CTObservationColumns observation_p;
00217   CTAntennaColumns antenna_p;
00218   CTFieldColumns field_p;
00219   CTHistoryColumns history_p;
00220   CTSpWindowColumns spectralWindow_p;
00221 };
00222 
00223 
00224 } //# NAMESPACE CASA - END
00225 
00226 #endif
00227