library of assembled shared sources |
http://lass.cocamware.com |
#include <progress_indicator.h>
Public Member Functions | |
ProgressIndicator (const std::string &iDescription, int iConsoleWidth=80) | |
~ProgressIndicator () | |
print final message on destruction | |
void | operator() (double iProgress) |
update progress indicator | |
Private Attributes | |
Clock | clock_ |
Clock::TTime | timeLeftBuffer_ |
Clock::TTime | previousTimeElapsed_ |
std::string | description_ |
std::string | backslash_ |
std::string | whitespace_ |
int | consoleWidth_ |
int | current_ |
int | timeLeftIndex_ |
{ 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.
Definition at line 70 of file progress_indicator.h.
lass::util::ProgressIndicator::ProgressIndicator | ( | const std::string & | iDescription, | |
int | iConsoleWidth = 80 | |||
) |
iDescriptor | description printed at begin of the line | |
iConsoleWidth | maximum number of characters on one console text line (default=80) |
Definition at line 55 of file progress_indicator.cpp.
References consoleWidth_, lass::io::cout(), description_, and whitespace_.
lass::util::ProgressIndicator::~ProgressIndicator | ( | ) |
void lass::util::ProgressIndicator::operator() | ( | double | iProgress | ) |
update progress indicator
iProgress | value in range [0, 1] |
Definition at line 80 of file progress_indicator.cpp.
References lass::num::clamp(), clock_, consoleWidth_, lass::io::cout(), current_, description_, lass::util::Clock::humanize(), previousTimeElapsed_, lass::util::Clock::time(), timeLeftBuffer_, and whitespace_.
Clock lass::util::ProgressIndicator::clock_ [private] |
std::string lass::util::ProgressIndicator::description_ [private] |
Definition at line 81 of file progress_indicator.h.
Referenced by operator()(), and ProgressIndicator().
std::string lass::util::ProgressIndicator::backslash_ [private] |
Definition at line 82 of file progress_indicator.h.
std::string lass::util::ProgressIndicator::whitespace_ [private] |
Definition at line 83 of file progress_indicator.h.
Referenced by operator()(), and ProgressIndicator().
int lass::util::ProgressIndicator::consoleWidth_ [private] |
Definition at line 84 of file progress_indicator.h.
Referenced by operator()(), and ProgressIndicator().
int lass::util::ProgressIndicator::current_ [private] |
int lass::util::ProgressIndicator::timeLeftIndex_ [private] |
Definition at line 86 of file progress_indicator.h.
Generated on Mon Nov 10 14:22:17 2008 for Library of Assembled Shared Sources by 1.5.7.1 |