casa
$Rev:20696$
|
00001 //# VBRemapper.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_VBREMAPPER_H 00029 #define MSVIS_VBREMAPPER_H 00030 00031 #include <casa/aips.h> 00032 #include <casa/Arrays/Vector.h> 00033 #include <synthesis/MSVis/VisBufferComponents.h> 00034 #include <map> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 class VisBuffer; 00039 00040 //<summary>VBRemappers remap VisBuffers</summary> 00041 // 00042 // <use visibility=export> 00043 // 00044 // <reviewed reviewer="" date="" tests="" demos=""> 00045 00046 // <prerequisite> 00047 // <li> <linkto class="VisBuffer">VisBuffer</linkto> 00048 // <li> <linkto class="SubMS">SubMS</linkto> 00049 // </prerequisite> 00050 // 00051 // <etymology> 00052 // VBRemappers remap VisBuffers. 00053 // </etymology> 00054 // 00055 // <synopsis> 00056 // When selected parts of an MS are written to a new MS, it may be necessary to 00057 // remap metadata indices like Field ID, DDID, ObservationID, etc.. 00058 // </synopsis> 00059 // 00060 // <example> 00061 // // DDIDs 1, 4, and 7, and field ID 3 is selected. They should become 0, 1, 00062 // // and 2, and 0, in the output. 00063 // </example> 00064 //<todo> 00065 // <li> 00066 //</todo> 00067 class VBRemapper 00068 { 00069 public: 00070 // Defaults to no remapping. 00071 VBRemapper(); 00072 00073 VBRemapper(const std::map<VisBufferComponents::EnumType, 00074 std::map<Int, Int> >& inToOutMaps); 00075 00077 //VBRemapper(const VBRemapper& gw) {} 00078 00079 // Destructor 00080 virtual ~VBRemapper() {} 00081 00083 //virtual VBRemapper& operator=(const VBRemapper& gw) {} 00084 00085 const std::map<VisBufferComponents::EnumType, std::map<Int, Int> >& getMaps() const 00086 { 00087 return inToOutMaps_p; 00088 } 00089 00090 void setMaps(const std::map<VisBufferComponents::EnumType, std::map<Int, Int> >& maps) 00091 { 00092 inToOutMaps_p = maps; 00093 } 00094 00095 // Remaps vb and returns its success value. 00096 Bool remap(VisBuffer& vb, const Bool squawk=True) const; 00097 00098 protected: 00099 // Remaps col using mapper. 00100 // Returns False if col has a value that is not in mapper's keys (those 00101 // values are left unchanged), True otherwise. 00102 Bool remapScalar(Int& colref, const std::map<Int, Int>& mapper) const; 00103 Bool remapVector(Vector<Int>& col, const std::map<Int, Int>& mapper) const; 00104 00105 // Set of maps from input ID to output ID, keyed by VisBufferComponent. 00106 std::map<VisBufferComponents::EnumType, std::map<Int, Int> > inToOutMaps_p; 00107 }; 00108 00109 } //# NAMESPACE CASA - END 00110 00111 #endif 00112