barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
progress.hpp
Go to the documentation of this file.
1 #ifndef BARRY_PROGRESS_HPP
2 #define BARRY_PROGRESS_HPP
3 
4 #ifndef BARRY_PROGRESS_BAR_WIDTH
5 #define BARRY_PROGRESS_BAR_WIDTH 80
6 #endif
7 
11 class Progress {
12 private:
13  int width;
14  int n;
15  double step_size;
16  int last_loc;
17  int cur_loc;
18  int i;
19 
20 public:
21 
22  Progress(int n_, int width_);
23  ~Progress() {};
24 
25  void next();
26  void end();
27 
28 };
29 
30 inline Progress::Progress(int n_, int width_) {
31 
32 
33  width = std::max(7, width_ - 7);
34  n = n_;
35  step_size = static_cast<double>(width)/static_cast<double>(n);
36  last_loc = 0;
37  i = 0;
38 
39 }
40 
41 inline void Progress::next() {
42 
43  cur_loc = std::floor((++i) * step_size);
44 
45  for (int j = 0; j < (cur_loc - last_loc); ++j)
46  printf_barry("|");
47 
48  last_loc = cur_loc;
49 
50 }
51 
52 inline void Progress::end() {
53 
54  printf_barry(" done.\n");
55 
56 }
57 
58 #endif
#define printf_barry
A simple progress bar.
Definition: progress.hpp:11
void end()
Definition: progress.hpp:52
~Progress()
Definition: progress.hpp:23
void next()
Definition: progress.hpp:41
Progress(int n_, int width_)
Definition: progress.hpp:30
size_t size_t j