MSTransformIteratorFactory.h

Go to the documentation of this file.
00001 //# MSTransformIteratorFactory.h: This file contains the interface definition of the MSTransformManager class.
00002 //#
00003 //#  CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
00004 //#  Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
00005 //#  Copyright (C) European Southern Observatory, 2011, All rights reserved.
00006 //#
00007 //#  This library is free software; you can redistribute it and/or
00008 //#  modify it under the terms of the GNU Lesser General Public
00009 //#  License as published by the Free software Foundation; either
00010 //#  version 2.1 of the License, or (at your option) any later version.
00011 //#
00012 //#  This library is distributed in the hope that it will be useful,
00013 //#  but WITHOUT ANY WARRANTY, without even the implied warranty of
00014 //#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //#  Lesser General Public License for more details.
00016 //#
00017 //#  You should have received a copy of the GNU Lesser General Public
00018 //#  License along with this library; if not, write to the Free Software
00019 //#  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00020 //#  MA 02111-1307  USA
00021 //# $Id: $
00022 
00023 #ifndef MSTransformIteratorFactory_H_
00024 #define MSTransformIteratorFactory_H_
00025 
00026 // Where ViFactory interface is defined
00027 #include <msvis/MSVis/VisibilityIterator2.h>
00028 
00029 // Class containing the actual transformation logic
00030 #include <mstransform/MSTransform/MSTransformManager.h>
00031 
00032 // Implementation returned by the factory method
00033 #include <mstransform/MSTransform/MSTransformIterator.h>
00034 #include <casa/Utilities/CountedPtr.h>
00035 
00036 namespace casa {
00037 
00038 // <summary>
00039 // A top level class defining the data handling interface for the MSTransform module
00040 // </summary>
00041 //
00042 // <use visibility=export>
00043 //
00044 // <prerequisite>
00045 //   <li> <linkto class="VisibilityIterator2:description">VisibilityIterator2</linkto>
00046 //   <li> <linkto class="MSTransformIterator:description">MSTransformIterator</linkto>
00047 //   <li> <linkto class="MSTransformManager:description">MSTransformManager</linkto>
00048 // </prerequisite>
00049 //
00050 // <etymology>
00051 // MSTransformFactory is a class that generates a Visibility Iterator implementation based on mstransform
00052 // </etymology>
00053 //
00054 // <synopsis>
00055 // MSTransformFactory generates a Visibility Iterator implementation (ViImplementation2)
00056 // object that can be plugged into a Visibility Iterator (VisibilityIterator2) object,
00057 // so that the user can access the data using the Visibility Iterator interface.
00058 // </synopsis>
00059 //
00060 // <motivation>
00061 // The idea is that an external application (plotms, imaging) can consume data
00062 // transformed using the mstransform code via a Visibility Iterator interface
00063 // </motivation>
00064 //
00065 // <example>
00066 // External usage is quite simple, and compliant with the 'normal' VI/VB framework.
00067 //
00068 // The user defines a dictionary with the parameters that would be normally passed to test_mstransform
00069 // (therefore I point to task_mstransform help for doubts regarding the parameters)
00070 //
00071 // <srcblock>
00072 //      Record configuration;
00073 //      configuration.define ("inputms", filename);
00074 //      configuration.define ("spw", "8,9,10,11");
00075 //      configuration.define ("antenna", "1&&2");
00076 //      configuration.define ("combinespws", True);
00077 //      configuration.define ("regridms", True);
00078 //      configuration.define ("mode", "channel");
00079 //      configuration.define ("width", "2");
00080 //      configuration.define ("timeaverage", True);
00081 //      configuration.define ("timebin", "30s");
00082 // </srcblock>
00083 //
00084 // Notice that some parameters don't make sense in the context of a VI/VB interface:
00085 // * outputms
00086 // * tileshape
00087 // * datacolumn
00088 // * realmodelcol
00089 // * usewtspectrum
00090 //
00091 // With this configuration record the factory class  MSTransformIteratorFactory will
00092 // create internally a  MSTransformIterator and return a pointer to a VisibilityIterator2
00093 // object whose implementation  is the newly created  MSTransformIterator.
00094 //
00095 // <srcblock>
00096 //      MSTransformIteratorFactory factory(configuration);
00097 //      vi::VisibilityIterator2 *visIter = new vi::VisibilityIterator2 (factory);
00098 //      vi::VisBuffer2 *visBuffer = visIter->getVisBuffer();
00099 // </srcblock>
00100 //
00101 // Once this is done one can normally iterate and access the transformed data:
00102 //
00103 // <srcblock>
00104 //      while (visIter->moreChunks())
00105 //      {
00106 //              visIter->origin();
00107 //
00108 //              while (visIter->more())
00109 //              {
00110 //
00111 //                      Vector<Int> ddi = visBuffer->dataDescriptionIds();
00112 //                      Vector<Int> antenna1 = visBuffer->antenna1();
00113 //                      Vector<Int> antenna2 = visBuffer->antenna2();
00114 //                      // Etc
00115 //
00116 //                      visIter->next();
00117 //              }
00118 //
00119 //              visIter->nextChunk();
00120 //      }
00121 // </srcblock>
00122 //
00123 // It is also possible to access the transformed Sub-Tables
00124 // (loaded in memory thanks to the Memory Resident Sub-Tables mechanism):
00125 //
00126 // <srcblock>
00127 //      MSSpectralWindow transformedSpwTable = visIter->ms().spectralWindow();
00128 // </srcblock>
00129 //
00130 // Notice that it is the responsibility of the application layer to delete the VisibilityIterator2
00131 // pointer returned by the factory method. However the life cycle of the VisBuffer2 object is
00132 // responsibility of the VisibilityIterator2 object.
00133 //
00134 // <srcblock>
00135 //      delete visIter;
00136 // </srcblock>
00137 //
00138 // </example>
00139 
00140 class MSTransformIteratorFactory : public vi::ViFactory
00141 {
00142 
00143 public:
00144 
00145         MSTransformIteratorFactory(Record &configuration);
00146         MSTransformIteratorFactory(Record &configuration, MrsEligibility &eligibleSubTables);
00147         ~MSTransformIteratorFactory();
00148 
00149         std::vector<IPosition> getVisBufferStructure();
00150         vi::VisibilityIterator2 * getInputVI() {return manager_p->getVisIter();}
00151 
00152 protected:
00153 
00154         void setConfiguration(Record &configuration);
00155         void initializeManager();
00156         vi::ViImplementation2 * createVi () const;
00157 
00158 private:
00159 
00160         Record configuration_p;
00161         String tmpMSFileName_p;
00162         mutable SHARED_PTR<MSTransformManager> manager_p;
00163         MrsEligibility eligibleSubTables_p;
00164 };
00165 
00166 } //# NAMESPACE CASA - END
00167 
00168 
00169 #endif /* MSTransformIteratorFactory_H_ */
00170 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1