casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
GroupWorker.h
Go to the documentation of this file.
00001 //# GroupWorker.h: Base classes for objects that process VisBuffGroups
00002 //# as fed to them by GroupProcessor.
00003 //# Copyright (C) 2011
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 
00028 #ifndef MSVIS_GROUPWORKER_H
00029 #define MSVIS_GROUPWORKER_H
00030 
00031 #include <casa/aips.h>
00032 #include <ms/MeasurementSets/MeasurementSet.h>
00033 #include <ms/MeasurementSets/MSColumns.h>
00034 #include <synthesis/MSVis/VisibilityIterator.h>
00035 #include <synthesis/MSVis/VisBufferComponents.h>
00036 #include <synthesis/MSVis/VBRemapper.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 //# forward decl
00041 class VisBuffGroup;
00042 
00043 //<summary>Abstract base class for GroupWorkers</summary>
00044 //
00045 // <use visibility=export>
00046 //
00047 // <reviewed reviewer="" date="" tests="" demos="">
00048 
00049 // <prerequisite>
00050 //   <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto>
00051 //   <li> <linkto class="GroupProcessor">GroupProcessor</linkto>
00052 // </prerequisite>
00053 //
00054 // <etymology>
00055 // A GroupWorker works on VisBuffGroups.
00056 // </etymology>
00057 //
00058 //<synopsis>
00059 // This class cannot be directly used, but it defines an interface so that its
00060 // derived classes may be called by
00061 // <linkto class="GroupProcessor">GroupProcessor</linkto>.
00062 //
00063 // The interface used by GroupProcessor is process(VisBuffGroup&), which
00064 // derived classes would define to use or process the given VisBuffGroup.
00065 // Any information that process(VisBuffGroup&) needs which is not included
00066 // in the VisBuffGroup must be given to the derived class before c'ting the
00067 // GroupProcessor.
00068 //</synopsis>
00069 //
00070 //<todo>
00071 // <li> 
00072 //</todo>
00073 class GroupWorkerBase
00074 {
00075 public:
00076   // Create empty GroupWorkerBase you can assign to or attach.
00077   GroupWorkerBase() {}
00078 
00080   //GroupWorkerBase(const GroupWorkerBase& other) {}
00081 
00082   // Destructor
00083   virtual ~GroupWorkerBase() {}
00084 
00086   //virtual GroupWorkerBase& operator=(const GroupWorkerBase& gw) {}
00087 
00088   // // Returns which columns need to be prefetched for process to work.
00089   virtual const asyncio::PrefetchColumns *prefetchColumns() const;
00090 
00091   // This is where all the work gets done!
00092   virtual Bool process(VisBuffGroup& vbg) = 0;
00093 
00094 protected:
00095   asyncio::PrefetchColumns prefetchColumns_p;
00096 };
00097 
00098 //<summary>ROGroupWorkers process VisBuffGroups without modifying the input MS(es)</summary>
00099 //
00100 // <use visibility=export>
00101 //
00102 // <reviewed reviewer="" date="" tests="" demos="">
00103 
00104 // <prerequisite>
00105 //   <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto>
00106 //   <li> <linkto class="GroupProcessor">GroupProcessor</linkto>
00107 // </prerequisite>
00108 //
00109 // <etymology>
00110 // ROGroupWorker works on VisBuffGroups and is readonly W.R.T. the input MS(es).
00111 // </etymology>
00112 //
00113 //<synopsis>
00114 // This class cannot be directly used, but it defines an interface so that its
00115 // derived classes may be called by
00116 // <linkto class="GroupProcessor">GroupProcessor</linkto>.
00117 //
00118 // Essentially an alias for GroupWorkerBase, since it is also RO.
00119 //</synopsis>
00120 //
00121 //<todo>
00122 // <li> 
00123 //</todo>
00124 class ROGroupWorker : public GroupWorkerBase
00125 {
00126 };
00127 
00128 //<summary>A base class for GroupWorkers that can modify their input MS.</summary>
00129 //
00130 // <use visibility=export>
00131 //
00132 // <reviewed reviewer="" date="" tests="" demos="">
00133 
00134 // <prerequisite>
00135 //   <li> <linkto class="ROGroupWorker">ROGroupWorker</linkto>
00136 // </prerequisite>
00137 //
00138 // <etymology>
00139 //   Its derived classes work on VisBuffGroups.
00140 // </etymology>
00141 //
00142 //<synopsis>
00143 // This class cannot be directly used, but it provides a starting point for
00144 // derived GroupWorkers.
00145 //</synopsis>
00146 //
00147 //<todo>
00148 // <li> 
00149 //</todo>
00150 class GroupWorker : public GroupWorkerBase
00151 {
00152 public:
00153   GroupWorker(const ROVisibilityIterator& invi);
00154 
00156   //GroupWorker(const GroupWorker& gw) {}
00157 
00158   // Destructor
00159   virtual ~GroupWorker() {}
00160 
00162   //virtual GroupWorker& operator=(const GroupWorker& gw) {}
00163 protected:
00164   ROVisibilityIterator invi_p;
00165   VisibilityIterator   outvi_p;
00166 private:
00167   // Disable default c'tor.
00168   GroupWorker() {}
00169 };
00170 
00171 //<summary>A base class for ROGroupWorkers that write to a new MS.</summary>
00172 //
00173 // <use visibility=export>
00174 //
00175 // <reviewed reviewer="" date="" tests="" demos="">
00176 
00177 // <prerequisite>
00178 //   <li> <linkto class="ROGroupWorker">ROGroupWorker</linkto>
00179 // </prerequisite>
00180 //
00181 // <etymology>
00182 //      Its derived classes are ROGroupWorkers that write to a new MS.
00183 // </etymology>
00184 //
00185 //<synopsis>
00186 // This class cannot be directly used, but it provides a starting point for
00187 // derived ROGroupWorkers that write to a new MS.
00188 //</synopsis>
00189 //
00190 //<todo>
00191 // <li> 
00192 //</todo>
00193 class GroupWriteToNewMS : public GroupWorkerBase
00194 {
00195 public:
00196   GroupWriteToNewMS(MeasurementSet& outms, MSColumns *msc,
00197                     const VBRemapper& remapper);
00198 
00199   //GroupWriteToNewMS(GroupWriteToNewMS& other);
00200   virtual ~GroupWriteToNewMS() {}
00201 
00202   // Writes vb to outms/msc, and returns the number of rows in outms afterwards.
00203   // vb's ID columns may be remapped by remapper.
00204   // rowsdone: How many rows have been done so far.
00205   // doFC: do FLAG_CATEGORY?
00206   // doFloat: do FLOAT_DATA?
00207   // doSpWeight: do WEIGHT_SPECTRUM?
00208   static uInt write(MeasurementSet& outms, MSColumns *msc, VisBuffer& vb,
00209                     uInt rowsdone, const VBRemapper& remapper, const Bool doFC,
00210                     const Bool doFloat, const Bool doSpWeight);
00211 protected:
00212   MeasurementSet outms_p;
00213   MSColumns      *msc_p;
00214   VBRemapper     remapper_p;
00215   uInt           rowsdone_p;  // how many rows have been written.
00216 
00217 private:
00218   // Disable default construction.
00219   GroupWriteToNewMS();
00220 };
00221 
00222 } //# NAMESPACE CASA - END
00223 
00224 #endif
00225