libatomprobe
Library for Atom Probe Tomography (APT) computation
progress.h
Go to the documentation of this file.
1 /*
2  * progress.h: Simple progress bar
3  * Copyright (C) 2015 D. Haley
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef ATOMPROBE_PROGRESSBAR_H
19 #define ATOMPROBE_PROGRESSBAR_H
20 
21 
22 namespace AtomProbe {
23 
24 
26 {
27  private:
29  unsigned int length;
31  unsigned int lastProg;
33  // Useful if e.g. error conditions arise
34  bool printEnd;
35  float accumulatedTicks;
36  public:
38  ~ProgressBar();
40  void setLength(unsigned int l){ length=l;}
41 
43  void init();
44 
46  void reset();
47 
49  void update(unsigned int newProgress);
50 
52  void finish();
53 
55  void abort(){printEnd=false;};
56 
57 };
58 
59 #ifdef DEBUG
60 bool testProgressBar();
61 #endif
62 
63 }
64 
65 #endif
void abort()
Abort drawing the progress.
Definition: progress.h:55
void finish()
Finalise the progress bar. It is not necessary for the progress to be set to 100%, this is done for you.
Definition: progress.cpp:52
void init()
Draw the initial progress bar.
Definition: progress.cpp:35
void setLength(unsigned int l)
Set the number of markers in the progress bar.
Definition: progress.h:40
void reset()
reset the progress bar internals, in case we want to re-use it
Definition: progress.cpp:43
void update(unsigned int newProgress)
Draw the progress bar as needed, using the given progress value [0,100].
Definition: progress.cpp:58