Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
BIAS::ConsoleProgress Class Reference

Visualises the progress of some computation in the console. More...

#include <Utils/ConsoleProgress.hh>

Public Member Functions

 ConsoleProgress (unsigned int maxValue=0)
 Constructor. More...
 
void PrintPercentage (unsigned int curValue)
 Prints the current percentage if it is equal or greater than all integral percentage values that have been printed before. More...
 
void PrintProgressBar (unsigned int curValue, unsigned int size=25)
 Prints progress bar showing the current percentage. More...
 
void Reset (unsigned int maxValue=0)
 Resets the internal counter and sets the maximum value to reach. More...
 

Detailed Description

Visualises the progress of some computation in the console.

This class is intended to show the progress of an iteration over a large number of elements. It only prints itegral percentage values and so doesn't spam the console.

If you only iterate over a small number of elements (e.g. 100), performance may be hit drastically because output is flushed after each integral percentage (i.e. an I/O operation is performed).

Author
rwulff
Date
03/2011

Definition at line 50 of file ConsoleProgress.hh.

Constructor & Destructor Documentation

BIAS::ConsoleProgress::ConsoleProgress ( unsigned int  maxValue = 0)
inlineexplicit

Constructor.

Parameters
maxValuethe maximum value to reach, equivalent to 100%

Definition at line 62 of file ConsoleProgress.hh.

Member Function Documentation

void BIAS::ConsoleProgress::PrintPercentage ( unsigned int  curValue)
inline

Prints the current percentage if it is equal or greater than all integral percentage values that have been printed before.

Note
No endl is appended. You may want to print it on your own after the iteration is finished.
Parameters
curValuethe current value within interval [0, maxValue]

Definition at line 95 of file ConsoleProgress.hh.

void BIAS::ConsoleProgress::PrintProgressBar ( unsigned int  curValue,
unsigned int  size = 25 
)
inline

Prints progress bar showing the current percentage.

Note
No end line is appended.
Parameters
curValueThe current value within interval [0, maxValue].
sizeThe length of the progress bar in characters.

Definition at line 124 of file ConsoleProgress.hh.

void BIAS::ConsoleProgress::Reset ( unsigned int  maxValue = 0)
inline

Resets the internal counter and sets the maximum value to reach.

Parameters
maxValuethe maximum value to reach, equivalent to 100%. if set to 0, the current maxValue will not be changed.

Definition at line 76 of file ConsoleProgress.hh.


The documentation for this class was generated from the following file: