Provides a simple progress bar interface for command line applications. Dots, ., characters are printed to OEPlatform_oeerr to indicate to the user of the command line application that progress is indeed being made and the program is not hung indefinitely.
A version of this class that is safe to used from multiple threads of computation: OEThreadedDots.
OEDots(unsigned int bigstep, unsigned int smallstep, const char *objectname="", char *action = "processed")
Controls how the following output gets updated:
.......... 10000 things processed. .......... 20000 things processed. .......... 30000 things processed. .......... 40000 things processed. .......... 50000 things processed. .......... 60000 things processed. .......... 70000 things processed. .......... 80000 things processed.
- The number of elements before a new line is generated. The above example is a bigstep of 10000.
- The number of elements before a single new dot, ., is printed. The above example is a smallstep of 1000. Or 10 dots per line.
- A description of what is being processed. In the above example, this is “things”.
- A description of what is done to the ‘objects’. In the above example, this is “processed”.
unsigned int GetBigStep()
Returns the bigstep size used to construct this instance.
unsigned int GetCounts()
Returns the current number of elements counted by this instance.
unsigned int GetSmallStep()
Returns the smallstep size used to construct this instance.
void SetBigStep(unsigned int s)
Sets a new bigstep size for this instance.
void SetSmallStep(unsigned int s)
Sets a new smallstep size for this instance.
Prints a final summary line like the following:
Total: 80000 things processed.
Typically only run once at the end of all processing.
void Update(unsigned int step=1) void Update(const char symbol, unsigned int step = 1)
Update the progress with the number of elements specified by step. The default is 1 element, but any number can be specified. However, 0 is not a valid step size and will throw an error. The second overload allows to specify a symbol to be displayed as progress, instead of a dot.
Not thread-safe, see OEThreadedDots if this method needs to be called from multiple threads.
- Example program dots.py