GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XtermProgressBar.h
Go to the documentation of this file.
1 #ifndef GW_XTERMPROGRESSBAR_H
2 #define GW_XTERMPROGRESSBAR_H
3 
4 #ifndef ROOT_Rtypes
5 #include "Rtypes.h"
6 #endif
7 
8 namespace Gw {
9 
35 {
36 private:
37  UInt_t fMaxSize;
38  UInt_t fCurrentSize;
39 
40  Double_t fMin;
41  Double_t fMax;
42 
43  Double_t fCurrent;
44 
45 public:
47  XtermProgressBar(Double_t min, Double_t max);
48  virtual ~XtermProgressBar();
49 
51  virtual void SetRange(Double_t min, Double_t max)
52  {
53  fMin = min; fMax = max;
54  }
55 
57  virtual void UpdateCurrentStatus();
58 
60  virtual void Start() ;
61 
63  virtual Double_t GetCurrentPosition() const
64  {
65  return fCurrent;
66  }
67 
69  virtual bool IsFinished() const { return (fCurrent > fMax); }
70 
73  { fCurrent++; if ( fMaxSize*(fCurrent-fMin)/(fMax-fMin) > fCurrentSize+1 ) { fCurrentSize++; UpdateCurrentStatus();} return *this; }
74 
77  { fCurrent++; if ( fMaxSize*(fCurrent-fMin)/(fMax-fMin) > fCurrentSize+1 ) { fCurrentSize++; UpdateCurrentStatus();} return *this; }
78 
80  virtual XtermProgressBar operator+=( int i )
81  { fCurrent+=i; if ( fMaxSize*(fCurrent-fMin)/(fMax-fMin) > fCurrentSize+1 ) { fCurrentSize++; UpdateCurrentStatus();} return *this; }
82 };
83 
84 }
85 
86 #endif
virtual XtermProgressBar operator+=(int i)
Add one event and change the display if needed.
virtual Double_t GetCurrentPosition() const
to get the current event number
virtual bool IsFinished() const
to get the current event number
virtual XtermProgressBar operator++()
Add one event and change the display if needed.
virtual XtermProgressBar operator++(int)
Add one event and change the display if needed.
Class to display a progress bar on the command line.
virtual void SetRange(Double_t min, Double_t max)
virtual void UpdateCurrentStatus()
Display current status on the standard output.
virtual void Start()
Re-initialised the counters.
XtermProgressBar(Double_t min, Double_t max)
Defines a ProgressBar that counts events from min to max.