Line data Source code
1 : //# Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2015 2 : //# Associated Universities, Inc. Washington DC, USA. 3 : //# 4 : //# This library is free software; you can redistribute it and/or modify it 5 : //# under the terms of the GNU Library General Public License as published by 6 : //# the Free Software Foundation; either version 2 of the License, or (at your 7 : //# option) any later version. 8 : //# 9 : //# This library is distributed in the hope that it will be useful, but WITHOUT 10 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 12 : //# License for more details. 13 : //# 14 : //# You should have received a copy of the GNU Library General Public License 15 : //# along with this library; if not, write to the Free Software Foundation, 16 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 17 : //# 18 : //# Correspondence concerning AIPS++ should be addressed as follows: 19 : //# Internet email: aips2-request@nrao.edu. 20 : //# Postal address: AIPS++ Project Office 21 : //# National Radio Astronomy Observatory 22 : //# 520 Edgemont Road 23 : //# Charlottesville, VA 22903-2475 USA 24 : //# 25 : #include <msvis/MSVis/statistics/Vi2StatsWeightsIterator.h> 26 : 27 : using namespace casacore; 28 : namespace casa { 29 : 30 0 : Vi2StatsWeightsCubeIterator::Vi2StatsWeightsCubeIterator(vi::VisBuffer2 *vb2) 31 : : Vi2StatsWeightsIterator(vb2) 32 : , correlation(0) 33 0 : , nCorrelations(vb2->nCorrelations()) 34 : , channel(0) 35 0 : , nChannels(vb2->nChannels()) 36 : , row(0) 37 0 : , nRows(vb2->nRows()) {} 38 : 39 265480 : Vi2StatsWeightsCubeIterator::Vi2StatsWeightsCubeIterator() 40 265480 : : Vi2StatsWeightsIterator() {} 41 : 42 : Vi2StatsWeightsCubeIterator& 43 0 : Vi2StatsWeightsCubeIterator::operator++() 44 : { 45 0 : if (++correlation == nCorrelations) { 46 0 : correlation = 0; 47 0 : if (++channel == nChannels) { 48 0 : channel = 0; 49 0 : ++row; 50 : } 51 : } 52 0 : return *this; 53 : } 54 : 55 : Vi2StatsWeightsCubeIterator 56 0 : Vi2StatsWeightsCubeIterator::operator++(int) 57 : { 58 0 : Vi2StatsWeightsCubeIterator tmp(*this); 59 0 : operator++(); 60 0 : return tmp; 61 : } 62 : 63 : bool 64 0 : Vi2StatsWeightsCubeIterator::operator==(const Vi2StatsWeightsCubeIterator& rhs) 65 : { 66 0 : return (correlation == rhs.correlation 67 0 : && channel == rhs.channel 68 0 : && row == rhs.row); 69 : } 70 : 71 : bool 72 0 : Vi2StatsWeightsCubeIterator::operator!=(const Vi2StatsWeightsCubeIterator& rhs) 73 : { 74 0 : return (correlation != rhs.correlation 75 0 : || channel != rhs.channel 76 0 : || row != rhs.row); 77 : } 78 : 79 : Float 80 0 : Vi2StatsWeightsCubeIterator::operator*() 81 : { 82 0 : return vb2->getWeightScaled(correlation, channel, row); 83 : } 84 : 85 : bool 86 0 : Vi2StatsWeightsCubeIterator::atEnd() 87 : { 88 0 : return (correlation == 0 && channel == 0 && row == nRows); 89 : } 90 : 91 : 92 : 93 0 : Vi2StatsWeightsRowIterator::Vi2StatsWeightsRowIterator(vi::VisBuffer2 *vb2) 94 : : Vi2StatsWeightsIterator(vb2) 95 0 : , nRows(vb2->nRows()) {} 96 : 97 607920 : Vi2StatsWeightsRowIterator::Vi2StatsWeightsRowIterator() 98 607920 : : Vi2StatsWeightsIterator() {} 99 : 100 : Vi2StatsWeightsRowIterator& 101 0 : Vi2StatsWeightsRowIterator::operator++() 102 : { 103 0 : ++row; 104 0 : return *this; 105 : } 106 : 107 : Vi2StatsWeightsRowIterator 108 0 : Vi2StatsWeightsRowIterator::operator++(int) 109 : { 110 0 : Vi2StatsWeightsRowIterator tmp(*this); 111 0 : operator++(); 112 0 : return tmp; 113 : } 114 : 115 : bool 116 0 : Vi2StatsWeightsRowIterator::operator==(const Vi2StatsWeightsRowIterator& rhs) 117 : { 118 0 : return row == rhs.row; 119 : } 120 : 121 : bool 122 0 : Vi2StatsWeightsRowIterator::operator!=(const Vi2StatsWeightsRowIterator& rhs) 123 : { 124 0 : return row != rhs.row; 125 : } 126 : 127 : Float 128 0 : Vi2StatsWeightsRowIterator::operator*() 129 : { 130 0 : return vb2->getWeightScaled(row); 131 : } 132 : 133 : bool 134 0 : Vi2StatsWeightsRowIterator::atEnd() 135 : { 136 0 : return row == nRows; 137 : } 138 : 139 : using namespace casacore; 140 : } // namespace casa