casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeProgress.h
Go to the documentation of this file.
1 //# LatticeProgress.h: Abstract base class to monitor progress in lattice operations
2 //# Copyright (C) 1997
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: aips2-request@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$
27 
28 #ifndef LATTICES_LATTICEPROGRESS_H
29 #define LATTICES_LATTICEPROGRESS_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 //# Forward Declarations
38 template <class T> class Vector;
39 class IPosition;
40 
41 // <summary>
42 // Abstract base class to monitor progress in lattice operations
43 // </summary>
44 
45 // <use visibility=export>
46 
47 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
48 // </reviewed>
49 
50 // <synopsis>
51 // This is an abstract base class for classes to monitor the
52 // progress of an operation on a Lattice. The default implementation
53 // offered by this class does nothing.
54 // However, a derived class could show the progress using for example
55 // a <linkto class=ProgressMeter>ProgressMeter</linkto>. A derived
56 // class should override the virtual functions from this class.
57 //
58 // The user of the LatticeProgress object should first call
59 // function <src>init</src> with the total number of steps
60 // that are to be done. Thereafter, after each step has been
61 // executed, function <src>nstepsDone</src> should be called
62 // after each step. Finally, function <src>done</src> should
63 // be called.
64 // </synopsis>
65 
66 // <example>
67 // <srcblock>
68 // </srcblock>
69 // </example>
70 
71 // <motivation>
72 // Since operations on Lattices can take a while, it can be useful
73 // to show the progress. However, making module Lattices dependent on
74 // the class ProgressMeter sounded bad. This abstract class serves
75 // as a bridge between the Lattice module and the ProgressMeter class
76 // (or any other class showing the progress).
77 // </motivation>
78 //
79 //# <todo asof="1997/08/01">
80 //# <li>
81 //# </todo>
82 
83 
85 {
86 public:
88  : itsExpectedNsteps(0) {}
89 
90  virtual ~LatticeProgress();
91 
92 // Initialize the process.
93 // It sets the expected number of steps and
94 // calls initDerived, so a derived class can initialize itself.
95  void init (uInt expectedNsteps);
96 
97 // Tell the number of steps done so far.
98 // The default implementation does nothing. A derived class
99 // should call the ProgressMeter function <src>update</src>
100  virtual void nstepsDone (uInt nsteps);
101 
102 // The process has ended.
103  virtual void done();
104 
105 // Recovers the expected number of total steps.
107  { return itsExpectedNsteps; }
108 
109 protected:
110  // Let a derived class initialize itself.
111  // This function is called by <src>init</src>.
112  // The derived class should create the <src>ProgressMeter</src>
113  // in here.
114  virtual void initDerived();
115 
116 private:
118 };
119 
120 
121 
122 } //# NAMESPACE CASACORE - END
123 
124 #endif
Abstract base class to monitor progress in lattice operations.
std::vector< double > Vector
Definition: ds9context.h:24
virtual void done()
The process has ended.
uInt expectedNsteps() const
Recovers the expected number of total steps.
virtual void initDerived()
Let a derived class initialize itself.
virtual void nstepsDone(uInt nsteps)
Tell the number of steps done so far.
void init(uInt expectedNsteps)
Initialize the process.
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42