Line data Source code
1 : //# GroupWorker.h: Base classes for objects that process VisBuffGroups 2 : //# as fed to them by GroupProcessor. 3 : //# Copyright (C) 2011 4 : //# Associated Universities, Inc. Washington DC, USA. 5 : //# 6 : //# This library is free software; you can redistribute it and/or modify it 7 : //# under the terms of the GNU Library General Public License as published by 8 : //# the Free Software Foundation; either version 2 of the License, or (at your 9 : //# option) any later version. 10 : //# 11 : //# This library is distributed in the hope that it will be useful, but WITHOUT 12 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 14 : //# License for more details. 15 : //# 16 : //# You should have received a copy of the GNU Library General Public License 17 : //# along with this library; if not, write to the Free Software Foundation, 18 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 19 : //# 20 : //# Correspondence concerning AIPS++ should be addressed as follows: 21 : //# Internet email: aips2-request@nrao.edu. 22 : //# Postal address: AIPS++ Project Office 23 : //# National Radio Astronomy Observatory 24 : //# 520 Edgemont Road 25 : //# Charlottesville, VA 22903-2475 USA 26 : //# 27 : 28 : #ifndef MSVIS_GROUPWORKER_H 29 : #define MSVIS_GROUPWORKER_H 30 : 31 : #include <casacore/casa/aips.h> 32 : #include <casacore/ms/MeasurementSets/MeasurementSet.h> 33 : #include <casacore/ms/MeasurementSets/MSColumns.h> 34 : #include <msvis/MSVis/VisibilityIterator.h> 35 : #include <msvis/MSVis/VisBufferComponents.h> 36 : #include <msvis/MSVis/VBRemapper.h> 37 : 38 : namespace casa { //# NAMESPACE CASA - BEGIN 39 : 40 : //# forward decl 41 : class VisBuffGroup; 42 : 43 : //<summary>Abstract base class for GroupWorkers</summary> 44 : // 45 : // <use visibility=export> 46 : // 47 : // <reviewed reviewer="" date="" tests="" demos=""> 48 : 49 : // <prerequisite> 50 : // <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto> 51 : // <li> <linkto class="GroupProcessor">GroupProcessor</linkto> 52 : // </prerequisite> 53 : // 54 : // <etymology> 55 : // A GroupWorker works on VisBuffGroups. 56 : // </etymology> 57 : // 58 : //<synopsis> 59 : // This class cannot be directly used, but it defines an interface so that its 60 : // derived classes may be called by 61 : // <linkto class="GroupProcessor">GroupProcessor</linkto>. 62 : // 63 : // The interface used by GroupProcessor is process(VisBuffGroup&), which 64 : // derived classes would define to use or process the given VisBuffGroup. 65 : // Any information that process(VisBuffGroup&) needs which is not included 66 : // in the VisBuffGroup must be given to the derived class before c'ting the 67 : // GroupProcessor. 68 : //</synopsis> 69 : // 70 : //<todo> 71 : // <li> 72 : //</todo> 73 : class GroupWorkerBase 74 : { 75 : public: 76 : // Create empty GroupWorkerBase you can assign to or attach. 77 0 : GroupWorkerBase() {} 78 : 79 : //// Copy construct 80 : //GroupWorkerBase(const GroupWorkerBase& other) {} 81 : 82 : // Destructor 83 0 : virtual ~GroupWorkerBase() {} 84 : 85 : //// Assignment 86 : //virtual GroupWorkerBase& operator=(const GroupWorkerBase& gw) {} 87 : 88 : // // Returns which columns need to be prefetched for process to work. 89 : virtual const asyncio::PrefetchColumns *prefetchColumns() const; 90 : 91 : // This is where all the work gets done! 92 : virtual casacore::Bool process(VisBuffGroup& vbg) = 0; 93 : 94 : protected: 95 : asyncio::PrefetchColumns prefetchColumns_p; 96 : }; 97 : 98 : //<summary>ROGroupWorkers process VisBuffGroups without modifying the input casacore::MS(es)</summary> 99 : // 100 : // <use visibility=export> 101 : // 102 : // <reviewed reviewer="" date="" tests="" demos=""> 103 : 104 : // <prerequisite> 105 : // <li> <linkto class="VisBuffGroup">VisBuffGroup</linkto> 106 : // <li> <linkto class="GroupProcessor">GroupProcessor</linkto> 107 : // </prerequisite> 108 : // 109 : // <etymology> 110 : // ROGroupWorker works on VisBuffGroups and is readonly W.R.T. the input casacore::MS(es). 111 : // </etymology> 112 : // 113 : //<synopsis> 114 : // This class cannot be directly used, but it defines an interface so that its 115 : // derived classes may be called by 116 : // <linkto class="GroupProcessor">GroupProcessor</linkto>. 117 : // 118 : // Essentially an alias for GroupWorkerBase, since it is also RO. 119 : //</synopsis> 120 : // 121 : //<todo> 122 : // <li> 123 : //</todo> 124 : class ROGroupWorker : public GroupWorkerBase 125 : { 126 : }; 127 : 128 : //<summary>A base class for GroupWorkers that can modify their input MS.</summary> 129 : // 130 : // <use visibility=export> 131 : // 132 : // <reviewed reviewer="" date="" tests="" demos=""> 133 : 134 : // <prerequisite> 135 : // <li> <linkto class="ROGroupWorker">ROGroupWorker</linkto> 136 : // </prerequisite> 137 : // 138 : // <etymology> 139 : // Its derived classes work on VisBuffGroups. 140 : // </etymology> 141 : // 142 : //<synopsis> 143 : // This class cannot be directly used, but it provides a starting point for 144 : // derived GroupWorkers. 145 : //</synopsis> 146 : // 147 : //<todo> 148 : // <li> 149 : //</todo> 150 : class GroupWorker : public GroupWorkerBase 151 : { 152 : public: 153 : GroupWorker(const ROVisibilityIterator& invi); 154 : 155 : //// Copy construct 156 : //GroupWorker(const GroupWorker& gw) {} 157 : 158 : // Destructor 159 0 : virtual ~GroupWorker() {} 160 : 161 : //// Assignment 162 : //virtual GroupWorker& operator=(const GroupWorker& gw) {} 163 : protected: 164 : ROVisibilityIterator invi_p; 165 : VisibilityIterator outvi_p; 166 : private: 167 : // Disable default c'tor. 168 : GroupWorker() {} 169 : }; 170 : 171 : //<summary>A base class for ROGroupWorkers that write to a new MS.</summary> 172 : // 173 : // <use visibility=export> 174 : // 175 : // <reviewed reviewer="" date="" tests="" demos=""> 176 : 177 : // <prerequisite> 178 : // <li> <linkto class="ROGroupWorker">ROGroupWorker</linkto> 179 : // </prerequisite> 180 : // 181 : // <etymology> 182 : // Its derived classes are ROGroupWorkers that write to a new MS. 183 : // </etymology> 184 : // 185 : //<synopsis> 186 : // This class cannot be directly used, but it provides a starting point for 187 : // derived ROGroupWorkers that write to a new MS. 188 : //</synopsis> 189 : // 190 : //<todo> 191 : // <li> 192 : //</todo> 193 : class GroupWriteToNewMS : public GroupWorkerBase 194 : { 195 : public: 196 : GroupWriteToNewMS(casacore::MeasurementSet& outms, casacore::MSColumns *msc, 197 : const VBRemapper& remapper); 198 : 199 : //GroupWriteToNewMS(GroupWriteToNewMS& other); 200 0 : virtual ~GroupWriteToNewMS() {} 201 : 202 : // Writes vb to outms/msc, and returns the number of rows in outms afterwards. 203 : // vb's ID columns may be remapped by remapper. 204 : // rowsdone: How many rows have been done so far. 205 : // doFC: do FLAG_CATEGORY? 206 : // doFloat: do FLOAT_DATA? 207 : // doSpWeight: do WEIGHT_SPECTRUM? 208 : static casacore::uInt write(casacore::MeasurementSet& outms, casacore::MSColumns *msc, VisBuffer& vb, 209 : casacore::uInt rowsdone, const VBRemapper& remapper, const casacore::Bool doFC, 210 : const casacore::Bool doFloat, const casacore::Bool doSpWeight); 211 : protected: 212 : casacore::MeasurementSet outms_p; 213 : casacore::MSColumns *msc_p; 214 : VBRemapper remapper_p; 215 : casacore::uInt rowsdone_p; // how many rows have been written. 216 : 217 : private: 218 : // Disable default construction. 219 : GroupWriteToNewMS(); 220 : }; 221 : 222 : } //# NAMESPACE CASA - END 223 : 224 : #endif 225 :