All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Progress.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ctime>
4 #include <string>
5 
6 namespace ana
7 {
8  /// A simple ascii-art progress bar
9  class Progress
10  {
11  public:
12  /// Create and draw the progress bar
13  Progress(const std::string& title);
14  ~Progress();
15  /// Update the progress fraction between zero and one
16  void SetProgress(double frac);
17  /// Call this when action is completed
18  void Done();
19  protected:
20  std::string FormatTime(double sec) const;
21 
22  bool fDone; ///< Has \ref Done been called?
23  int fIFrac; ///< What character are we on? Prevents unnecessary redraws
24 
25  time_t fStart;
26  time_t fPrevCall;
27 
28  // Only one bar may be live at a time. Prevents overdrawing
29  bool fLive; ///< Is this bar live (drawable?)
30  static bool fAnyLive; ///< Are any bars live?
31  };
32 }
process_name opflashCryoW ana
bool fDone
Has Done been called?
Definition: Progress.h:22
time_t fStart
Definition: Progress.h:25
static bool fAnyLive
Are any bars live?
Definition: Progress.h:30
Progress(const std::string &title)
Create and draw the progress bar.
Definition: Progress.cxx:18
int fIFrac
What character are we on? Prevents unnecessary redraws.
Definition: Progress.h:23
time_t fPrevCall
Definition: Progress.h:26
void SetProgress(double frac)
Update the progress fraction between zero and one.
Definition: Progress.cxx:44
A simple ascii-art progress bar.
Definition: Progress.h:9
bool fLive
Is this bar live (drawable?)
Definition: Progress.h:29
std::string FormatTime(double sec) const
Definition: Progress.cxx:103
void Done()
Call this when action is completed.
Definition: Progress.cxx:91