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 0 : FiltrationTVIFactory::FiltrationTVIFactory(casacore::Record const &configuration, 46 0 : ViImplementation2 *inputVII) : 47 0 : inputVII_p(inputVII), configuration_p(configuration) { 48 0 : } 49 : 50 0 : FiltrationTVIFactory::~FiltrationTVIFactory() { 51 0 : } 52 : 53 0 : ViImplementation2 * FiltrationTVIFactory::createVi() const { 54 0 : ViImplementation2 *vii = nullptr; 55 : 56 0 : if (!configuration_p.isDefined("type")) { 57 0 : throw AipsError(String("You have to specify Filtering type")); 58 : } 59 : 60 0 : Int const type_indicator = configuration_p.asInt("type"); 61 : 62 0 : switch(type_indicator) { 63 0 : case FilteringType::SDDoubleCircleFilter: 64 : { 65 : // new filter impl 66 0 : vii = new FiltrationTVI<SDDoubleCircleFilter>(inputVII_p, configuration_p); 67 0 : 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 0 : return vii; 78 : } 79 : 80 : // LayerFactory 81 0 : FiltrationTVILayerFactory::FiltrationTVILayerFactory(Record const &configuration) : 82 0 : ViiLayerFactory(), configuration_p(configuration) { 83 0 : } 84 : 85 0 : ViImplementation2 * FiltrationTVILayerFactory::createInstance( 86 : ViImplementation2* vii0) const { 87 : // Make the FiltrationTVI, using supplied ViImplementation2, and return it 88 0 : FiltrationTVIFactory factory(configuration_p, vii0); 89 0 : ViImplementation2 *vii = nullptr; 90 : try { 91 0 : vii = factory.createVi(); 92 0 : } catch (...) { 93 0 : if (vii0) { 94 0 : delete vii0; 95 : } 96 0 : throw; 97 0 : } 98 0 : return vii; 99 0 : } 100 : 101 : } //# NAMESPACE vi - END 102 : 103 : } //# NAMESPACE CASA - END