Library of Assembled Shared Sources
lass::util::ProgressIndicator Class Reference

Prints a progress indication to console. More...

#include <progress_indicator.h>

Public Member Functions

 ProgressIndicator (const std::string &iDescription, size_t iConsoleWidth=80)
 
 ~ProgressIndicator ()
 print final message on destruction
 
void operator() (double iProgress)
 update progress indicator
 

Detailed Description

Prints a progress indication to console.

{
ProgressIndicator indicator("doing something")
const int n = 1000;
for (int i = 0; i < n; ++i)
{
doSomething();
indicator(double(i) / n);
}
} // when indicator goes out of scope, it prints a final message.
ProgressIndicator(const std::string &iDescription, size_t iConsoleWidth=80)

Definition at line 70 of file progress_indicator.h.

Constructor & Destructor Documentation

◆ ProgressIndicator()

lass::util::ProgressIndicator::ProgressIndicator ( const std::string & iDescription,
size_t iConsoleWidth = 80 )
Parameters
iDescriptordescription printed at begin of the line
iConsoleWidthmaximum number of characters on one console text line (default=80)

Definition at line 55 of file progress_indicator.cpp.

Member Function Documentation

◆ operator()()

void lass::util::ProgressIndicator::operator() ( double iProgress)

update progress indicator

Parameters
iProgressvalue in range [0, 1]

Definition at line 79 of file progress_indicator.cpp.

References lass::num::clamp(), and lass::num::lerp().


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