casa
$Rev:20696$
|
00001 //# LatticeProgress.h: Abstract base class to monitor progress in lattice operations 00002 //# Copyright (C) 1997 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: LatticeProgress.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef LATTICES_LATTICEPROGRESS_H 00029 #define LATTICES_LATTICEPROGRESS_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 //# Forward Declarations 00038 template <class T> class Vector; 00039 class IPosition; 00040 00041 // <summary> 00042 // Abstract base class to monitor progress in lattice operations 00043 // </summary> 00044 00045 // <use visibility=export> 00046 00047 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00048 // </reviewed> 00049 00050 // <synopsis> 00051 // This is an abstract base class for classes to monitor the 00052 // progress of an operation on a Lattice. The default implementation 00053 // offered by this class does nothing. 00054 // However, a derived class could show the progress using for example 00055 // a <linkto class=ProgressMeter>ProgressMeter</linkto>. A derived 00056 // class should override the virtual functions from this class. 00057 // 00058 // The user of the LatticeProgress object should first call 00059 // function <src>init</src> with the total number of steps 00060 // that are to be done. Thereafter, after each step has been 00061 // executed, function <src>nstepsDone</src> should be called 00062 // after each step. Finally, function <src>done</src> should 00063 // be called. 00064 // </synopsis> 00065 00066 // <example> 00067 // <srcblock> 00068 // </srcblock> 00069 // </example> 00070 00071 // <motivation> 00072 // Since operations on Lattices can take a while, it can be useful 00073 // to show the progress. However, making module Lattices dependent on 00074 // the class ProgressMeter sounded bad. This abstract class serves 00075 // as a bridge between the Lattice module and the ProgressMeter class 00076 // (or any other class showing the progress). 00077 // </motivation> 00078 // 00079 //# <todo asof="1997/08/01"> 00080 //# <li> 00081 //# </todo> 00082 00083 00084 class LatticeProgress 00085 { 00086 public: 00087 LatticeProgress() 00088 : itsExpectedNsteps(0) {} 00089 00090 virtual ~LatticeProgress(); 00091 00092 // Initialize the process. 00093 // It sets the expected number of steps and 00094 // calls initDerived, so a derived class can initialize itself. 00095 void init (uInt expectedNsteps); 00096 00097 // Tell the number of steps done so far. 00098 // The default implementation does nothing. A derived class 00099 // should call the ProgressMeter function <src>update</src> 00100 virtual void nstepsDone (uInt nsteps); 00101 00102 // The process has ended. 00103 virtual void done(); 00104 00105 // Recovers the expected number of total steps. 00106 uInt expectedNsteps() const 00107 { return itsExpectedNsteps; } 00108 00109 protected: 00110 // Let a derived class initialize itself. 00111 // This function is called by <src>init</src>. 00112 // The derived class should create the <src>ProgressMeter</src> 00113 // in here. 00114 virtual void initDerived(); 00115 00116 private: 00117 uInt itsExpectedNsteps; 00118 }; 00119 00120 00121 00122 } //# NAMESPACE CASA - END 00123 00124 #endif