casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MS1ToMS2Converter.h
Go to the documentation of this file.
00001 //# MS1ToMS2Converter.h: Definition for ms1 to ms2 converter
00002 //# Copyright (C) 1994,1995,1996,1997,1998,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: MS1ToMS2Converter.h 18093 2004-11-30 17:51:10Z ddebonis $
00027 
00028 #ifndef MS_MS1TOMS2CONVERTER_H
00029 #define MS_MS1TOMS2CONVERTER_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <tables/Tables/Table.h>
00034 #include <casa/Logging/LogIO.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 //# Forward declarations
00039 class String;
00040 
00041 
00042 // <summary> 
00043 // Class to convert a MeasurementSet v1 to v2.
00044 // </summary>
00045 
00046 // <use visibility=export>
00047 
00048 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00049 // </reviewed>
00050 
00051 // <synopsis>
00052 // This class converts a version 1 MeasurementSet to version 2.
00053 // The keyword MS_VERSION tells the version. If not present it is 1.
00054 // If it is found that the MS is already a version 2 one, nothing is done.
00055 // <p>
00056 // It is possible to do the conversion in place. If not, first a copy
00057 // is made which is thereafter changed in place.
00058 // <br>
00059 // The conversion process does the following steps:
00060 // <ul>
00061 //  <li> Create the newly required columns and keywords
00062 //       and fill them with new or existing data.
00063 //  <li> Convert the old way of defining measure info to the new
00064 //       TableMeasures way.
00065 //  <li> Rename obsolete columns by prefixing their names with _OBSOLETE_.
00066 // </ul>
00067 //
00068 // The constructor only keeps the names of the input and output MS.
00069 // The actual conversion is done by the <src>convert</src> function.
00070 // </synopsis>
00071 
00072 
00073 class MS1ToMS2Converter
00074 {
00075 public:
00076   // Create the converter for the given output (ms2) and input (ms1) name.
00077   // The input name has to be an MS version 1. If not, nothing will be done.
00078   // <br>If <src>inPlace==True</src>, the ms2 name is ignored. In that
00079   // case the ms is changed in place.
00080   MS1ToMS2Converter (const String& ms2,
00081                      const String& ms1,
00082                      Bool inPlace);
00083 
00084   ~MS1ToMS2Converter();
00085 
00086   // Do the actual conversion.
00087   Bool convert();
00088 
00089 private:
00090   // Forbid copy constrcutor and assignment.
00091   // <group>
00092   MS1ToMS2Converter (const MS1ToMS2Converter&);
00093   MS1ToMS2Converter& operator= (const MS1ToMS2Converter&);
00094   // </group>
00095 
00096   // If possible remove a column from the table.
00097   // Otherwise rename it by prefixing it with _OBSOLETE_.
00098   void removeColumn(Table& t, const String& col);
00099 
00100 
00101   String ms1_p;
00102   String ms2_p;
00103   Bool inPlace_p;
00104 
00105   // Logger
00106   LogIO os_p;
00107 };
00108 
00109 
00110 
00111 } //# NAMESPACE CASA - END
00112 
00113 #endif