|
PLearn 0.1
|
Similar to TextProgressBarPlugin with a different output format so that updates appear on different lines of output. More...
#include <ProgressBar.h>


Public Member Functions | |
| virtual void | addProgressBar (ProgressBar *pb) |
| virtual void | update (ProgressBar *pb, uint32_t newpos) |
| LineOutputProgressBarPlugin (ostream &_out, unsigned int nticks_=100) | |
| LineOutputProgressBarPlugin (PStream &_out, unsigned int nticks_=100) | |
| virtual void | killProgressBar (ProgressBar *pb) |
Static Protected Member Functions | |
| static string | pbInfo (ProgressBar *pb) |
Protected Attributes | |
| unsigned int | nticks |
Similar to TextProgressBarPlugin with a different output format so that updates appear on different lines of output.
(for logging or when multiple progress bars are used simultaneously)
Definition at line 118 of file ProgressBar.h.
| PLearn::LineOutputProgressBarPlugin::LineOutputProgressBarPlugin | ( | ostream & | _out, |
| unsigned int | nticks_ = 100 |
||
| ) |
Definition at line 238 of file ProgressBar.cc.
:TextProgressBarPlugin(_out), nticks(nticks_) {}
| PLearn::LineOutputProgressBarPlugin::LineOutputProgressBarPlugin | ( | PStream & | _out, |
| unsigned int | nticks_ = 100 |
||
| ) |
Definition at line 242 of file ProgressBar.cc.
:TextProgressBarPlugin(_out), nticks(nticks_) {}
| void PLearn::LineOutputProgressBarPlugin::addProgressBar | ( | ProgressBar * | pb | ) | [virtual] |
Reimplemented from PLearn::TextProgressBarPlugin.
Definition at line 246 of file ProgressBar.cc.
References PLearn::endl(), PLearn::TextProgressBarPlugin::out, and pbInfo().

| void PLearn::LineOutputProgressBarPlugin::killProgressBar | ( | ProgressBar * | pb | ) | [virtual] |
Reimplemented from PLearn::ProgressBarPlugin.
Definition at line 263 of file ProgressBar.cc.
References PLearn::endl(), PLearn::TextProgressBarPlugin::out, and pbInfo().

| string PLearn::LineOutputProgressBarPlugin::pbInfo | ( | ProgressBar * | pb | ) | [static, protected] |
Definition at line 266 of file ProgressBar.cc.
References PLearn::ProgressBar::currentpos, PLearn::ProgressBar::maxpos, PLearn::ProgressBar::title, and PLearn::tostring().
Referenced by addProgressBar(), killProgressBar(), and update().
{
unsigned int curpos= pb->currentpos,
maxpos= pb->maxpos;
return string("[") + pb->title + "] "
+ tostring(curpos) + '/' + tostring(maxpos)
+ " (" + tostring(static_cast<double>(curpos)*100.0 / static_cast<double>(maxpos)) + "%)";
}


| void PLearn::LineOutputProgressBarPlugin::update | ( | ProgressBar * | pb, |
| uint32_t | newpos | ||
| ) | [virtual] |
Reimplemented from PLearn::TextProgressBarPlugin.
Definition at line 249 of file ProgressBar.cc.
References PLearn::ProgressBar::currentpos, PLearn::endl(), PLearn::ProgressBar::maxpos, nticks, PLearn::TextProgressBarPlugin::out, and pbInfo().
{
// this handles the case where we reuse the same progress bar
if(newpos < pb->currentpos)
{
pb->currentpos= newpos;
out << "In progress: ";//to be continued...
}
else if(0 < (int( newpos / (double(pb->maxpos) / nticks) ) -
int(round( pb->currentpos / (double(pb->maxpos) / nticks) ))))
pb->currentpos= newpos;
out << pbInfo(pb) << endl;
}

unsigned int PLearn::LineOutputProgressBarPlugin::nticks [protected] |
Definition at line 131 of file ProgressBar.h.
Referenced by update().
1.7.4