LCOV - code coverage report
Current view: top level - msvis/MSVis - VBRemapper.h (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 0 1 0.0 %
Date: 2023-10-25 08:47:59 Functions: 0 2 0.0 %

          Line data    Source code
       1             : //# VBRemapper.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_VBREMAPPER_H
      29             : #define MSVIS_VBREMAPPER_H
      30             : 
      31             : #include <casacore/casa/aips.h>
      32             : #include <casacore/casa/Arrays/Vector.h>
      33             : #include <msvis/MSVis/VisBufferComponents.h>
      34             : #include <map>
      35             : 
      36             : namespace casa { //# NAMESPACE CASA - BEGIN
      37             : 
      38             : class VisBuffer;
      39             : 
      40             : //<summary>VBRemappers remap VisBuffers</summary>
      41             : //
      42             : // <use visibility=export>
      43             : //
      44             : // <reviewed reviewer="" date="" tests="" demos="">
      45             : 
      46             : // <prerequisite>
      47             : //   <li> <linkto class="VisBuffer">VisBuffer</linkto>
      48             : //   <li> <linkto class="SubMS">SubMS</linkto>
      49             : // </prerequisite>
      50             : //
      51             : // <etymology>
      52             : // VBRemappers remap VisBuffers.
      53             : // </etymology>
      54             : //
      55             : // <synopsis>
      56             : // When selected parts of an casacore::MS are written to a new casacore::MS, it may be necessary to
      57             : // remap metadata indices like Field ID, DDID, ObservationID, etc..
      58             : // </synopsis>
      59             : //
      60             : // <example>
      61             : // // DDIDs 1, 4, and 7, and field ID 3 is selected.  They should become 0, 1,
      62             : // // and 2, and 0, in the output.
      63             : // </example>
      64             : //<todo>
      65             : // <li> 
      66             : //</todo>
      67             : class VBRemapper
      68             : {
      69             : public:
      70             :   // Defaults to no remapping.
      71             :   VBRemapper();
      72             : 
      73             :   VBRemapper(const std::map<VisBufferComponents::EnumType,
      74             :              std::map<casacore::Int, casacore::Int> >& inToOutMaps);
      75             : 
      76             :   //// Copy construct
      77             :   //VBRemapper(const VBRemapper& gw) {}
      78             : 
      79             :   // Destructor
      80           0 :   virtual ~VBRemapper() {}
      81             : 
      82             :   //// Assignment
      83             :   //virtual VBRemapper& operator=(const VBRemapper& gw) {}
      84             : 
      85             :   const std::map<VisBufferComponents::EnumType, std::map<casacore::Int, casacore::Int> >& getMaps() const
      86             :   {
      87             :     return inToOutMaps_p;
      88             :   }
      89             : 
      90             :   void setMaps(const std::map<VisBufferComponents::EnumType, std::map<casacore::Int, casacore::Int> >& maps)
      91             :   {
      92             :     inToOutMaps_p = maps;
      93             :   }
      94             : 
      95             :   // Remaps vb and returns its success value.
      96             :   casacore::Bool remap(VisBuffer& vb, const casacore::Bool squawk=true) const;
      97             : 
      98             : protected:
      99             :   // Remaps col using mapper.
     100             :   // Returns false if col has a value that is not in mapper's keys (those
     101             :   // values are left unchanged), true otherwise.
     102             :   casacore::Bool remapScalar(casacore::Int& colref, const std::map<casacore::Int, casacore::Int>& mapper) const;
     103             :   casacore::Bool remapVector(casacore::Vector<casacore::Int>& col, const std::map<casacore::Int, casacore::Int>& mapper) const;
     104             : 
     105             :   // Set of maps from input ID to output ID, keyed by VisBufferComponent.
     106             :   std::map<VisBufferComponents::EnumType, std::map<casacore::Int, casacore::Int> > inToOutMaps_p;
     107             : };
     108             : 
     109             : } //# NAMESPACE CASA - END
     110             : 
     111             : #endif
     112             : 

Generated by: LCOV version 1.16