LCOV - code coverage report
Current view: top level - imageanalysis/ImageAnalysis - ImageMomentsProgress.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 19 28 67.9 %
Date: 2024-12-11 20:54:31 Functions: 5 6 83.3 %

          Line data    Source code
       1             : //# ImageMomentsProgress.cc:  Class to display progress meter for ImageMoments
       2             : //# Copyright (C) 1995,1996,1997,1999
       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             : //# $Id: ImageMomentsProgress.cc 18093 2004-11-30 17:51:10Z ddebonis $
      27             : //
      28             : 
      29             : 
      30             : #include <imageanalysis/ImageAnalysis/ImageMomentsProgress.h>
      31             : #include <imageanalysis/ImageAnalysis/ImageMomentsProgressMonitor.h>
      32             : #include <casacore/casa/BasicMath/Math.h>
      33             : #include <casacore/casa/BasicSL/String.h>
      34             : 
      35             : using namespace casacore;
      36             : namespace casa { //# NAMESPACE CASA - BEGIN
      37             : 
      38          84 : ImageMomentsProgress::~ImageMomentsProgress()
      39             : {
      40          42 :     delete itsMeter;
      41          84 : }
      42             : 
      43          42 : void ImageMomentsProgress::initDerived()
      44             : {
      45          42 :     delete itsMeter;
      46          42 :     itsMeter = new ProgressMeter(0.0, Double(expectedNsteps()), String("Compute Moments"),
      47          84 :                                  String("Vectors extracted"), String(""), String(""),
      48          42 :                                  true, max(1,Int(expectedNsteps()/20)));
      49          42 :     maxReported = false;
      50          42 : }
      51             : 
      52          84 : void ImageMomentsProgress::nstepsDone (uInt nsteps)
      53             : {
      54          84 :     itsMeter->update (nsteps);
      55          84 :     if ( progressMonitor != NULL ){
      56           0 :         if ( !maxReported ){
      57           0 :                 int max = static_cast<int>(itsMeter->max());
      58           0 :                 progressMonitor->setStepCount( max );
      59           0 :                 maxReported = true;
      60             :         }
      61           0 :         progressMonitor->setStepsCompleted( nsteps );
      62             :     }
      63          84 : }
      64             : 
      65           0 : void ImageMomentsProgress::setProgressMonitor( ImageMomentsProgressMonitor* monitor ){
      66           0 :         progressMonitor = monitor;
      67             : 
      68           0 : }
      69             : 
      70          42 : void ImageMomentsProgress::done()
      71             : {   
      72          42 :         if ( progressMonitor != NULL ){
      73           0 :                 progressMonitor->done();
      74             :         }
      75          42 :     delete itsMeter;
      76          42 :     itsMeter = 0;
      77          42 : }
      78             :  
      79             :  
      80             : 
      81             : } //# NAMESPACE CASA - END
      82             : 

Generated by: LCOV version 1.16