LCOV - code coverage report
Current view: top level - synthesis/MeasurementComponents - FiltrationTVI.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 24 32 75.0 %
Date: 2024-12-11 20:54:31 Functions: 5 6 83.3 %

          Line data    Source code
       1             : //# FiltrationTVI.cc: Template class for data filtering TVI
       2             : //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the Implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : #include <synthesis/MeasurementComponents/FiltrationTVI.h>
      27             : #include <synthesis/MeasurementComponents/FiltrationTVI.tcc>
      28             : #include <synthesis/MeasurementComponents/SDDoubleCircleFilter.h>
      29             : 
      30             : #include <casacore/casa/Exceptions/Error.h>
      31             : 
      32             : #include <msvis/MSVis/VisibilityIterator2.h>
      33             : #include <msvis/MSVis/ViiLayerFactory.h>
      34             : 
      35             : using namespace casacore;
      36             : 
      37             : namespace casa { //# NAMESPACE CASA - BEGIN
      38             : 
      39             : namespace vi { //# NAMESPACE vi - BEGIN
      40             : 
      41             : // explicit instantiation of template class
      42             : template class FiltrationTVI<SDDoubleCircleFilter>;
      43             : 
      44             : // Factory
      45           9 : FiltrationTVIFactory::FiltrationTVIFactory(casacore::Record const &configuration,
      46           9 :     ViImplementation2 *inputVII) :
      47           9 :     inputVII_p(inputVII), configuration_p(configuration) {
      48           9 : }
      49             : 
      50           9 : FiltrationTVIFactory::~FiltrationTVIFactory() {
      51           9 : }
      52             : 
      53           9 : ViImplementation2 * FiltrationTVIFactory::createVi() const {
      54           9 :   ViImplementation2 *vii = nullptr;
      55             : 
      56           9 :   if (!configuration_p.isDefined("type")) {
      57           0 :     throw AipsError(String("You have to specify Filtering type"));
      58             :   }
      59             : 
      60           9 :   Int const type_indicator = configuration_p.asInt("type");
      61             : 
      62           9 :   switch(type_indicator) {
      63           9 :   case FilteringType::SDDoubleCircleFilter:
      64             :   {
      65             :     // new filter impl
      66           9 :     vii = new FiltrationTVI<SDDoubleCircleFilter>(inputVII_p, configuration_p);
      67           9 :     break;
      68             :   }
      69           0 :   default:
      70             :   {
      71             :     // unsupported type, throw exception
      72           0 :     throw AipsError(String("Invalid FilteringType for FiltrationTVI: ")+String::toString(type_indicator));
      73             :     break;
      74             :   }
      75             :   }
      76             : 
      77           9 :   return vii;
      78             : }
      79             : 
      80             : // LayerFactory
      81           9 : FiltrationTVILayerFactory::FiltrationTVILayerFactory(Record const &configuration) :
      82           9 :     ViiLayerFactory(), configuration_p(configuration) {
      83           9 : }
      84             : 
      85           9 : ViImplementation2 * FiltrationTVILayerFactory::createInstance(
      86             :     ViImplementation2* vii0) const {
      87             :   // Make the FiltrationTVI, using supplied ViImplementation2, and return it
      88           9 :   FiltrationTVIFactory factory(configuration_p, vii0);
      89           9 :   ViImplementation2 *vii = nullptr;
      90             :   try {
      91           9 :     vii = factory.createVi();
      92           0 :   } catch (...) {
      93           0 :     if (vii0) {
      94           0 :       delete vii0;
      95             :     }
      96           0 :     throw;
      97           0 :   }
      98           9 :   return vii;
      99           9 : }
     100             : 
     101             : } //# NAMESPACE vi - END
     102             : 
     103             : } //# NAMESPACE CASA - END

Generated by: LCOV version 1.16