PLearn 0.1
|
Similar to TextProgressBarPlugin with a different output format so that remote servers can update progress bars on a client. More...
#include <ProgressBar.h>
Public Member Functions | |
virtual void | addProgressBar (ProgressBar *pb) |
virtual void | update (ProgressBar *pb, uint32_t newpos) |
RemoteProgressBarPlugin (ostream &_out, unsigned int nticks_=20) | |
RemoteProgressBarPlugin (PStream &_out, unsigned int nticks_=20) | |
virtual void | killProgressBar (ProgressBar *pb) |
Protected Member Functions | |
void | printTitle (ProgressBar *pb) |
Static Protected Member Functions | |
static unsigned int | getPBarID (ProgressBar *pb) |
Protected Attributes | |
unsigned int | nticks |
Static Protected Attributes | |
static map< ProgressBar *, unsigned int > | pb_ids |
static unsigned int | next_pb_id = 0 |
Similar to TextProgressBarPlugin with a different output format so that remote servers can update progress bars on a client.
Definition at line 96 of file ProgressBar.h.
PLearn::RemoteProgressBarPlugin::RemoteProgressBarPlugin | ( | ostream & | _out, |
unsigned int | nticks_ = 20 |
||
) |
Definition at line 183 of file ProgressBar.cc.
:TextProgressBarPlugin(_out), nticks(nticks_) {}
PLearn::RemoteProgressBarPlugin::RemoteProgressBarPlugin | ( | PStream & | _out, |
unsigned int | nticks_ = 20 |
||
) |
Definition at line 187 of file ProgressBar.cc.
:TextProgressBarPlugin(_out), nticks(nticks_) {}
void PLearn::RemoteProgressBarPlugin::addProgressBar | ( | ProgressBar * | pb | ) | [virtual] |
Reimplemented from PLearn::TextProgressBarPlugin.
Definition at line 191 of file ProgressBar.cc.
References printTitle().
{ printTitle(pb); }
unsigned int PLearn::RemoteProgressBarPlugin::getPBarID | ( | ProgressBar * | pb | ) | [static, protected] |
Definition at line 197 of file ProgressBar.cc.
References next_pb_id, and pb_ids.
Referenced by killProgressBar(), printTitle(), and update().
{ if(pb_ids.find(pb) == pb_ids.end()) pb_ids[pb]= ++next_pb_id; return pb_ids[pb]; }
void PLearn::RemoteProgressBarPlugin::killProgressBar | ( | ProgressBar * | pb | ) | [virtual] |
Reimplemented from PLearn::ProgressBarPlugin.
Definition at line 229 of file ProgressBar.cc.
References PLearn::endl(), getPBarID(), PLearn::TextProgressBarPlugin::out, and PLearn::PStream::write().
void PLearn::RemoteProgressBarPlugin::printTitle | ( | ProgressBar * | pb | ) | [protected] |
Definition at line 222 of file ProgressBar.cc.
References PLearn::endl(), getPBarID(), PLearn::ProgressBar::maxpos, PLearn::TextProgressBarPlugin::out, PLearn::ProgressBar::title, PLearn::tostring(), and PLearn::PStream::write().
Referenced by addProgressBar(), and update().
{ string fulltitle = string(" ") + pb->title + " (" + tostring(pb->maxpos) + ") "; out.write("*PA "); out << getPBarID(pb) << pb->maxpos << fulltitle << endl; }
void PLearn::RemoteProgressBarPlugin::update | ( | ProgressBar * | pb, |
uint32_t | newpos | ||
) | [virtual] |
Reimplemented from PLearn::TextProgressBarPlugin.
Definition at line 205 of file ProgressBar.cc.
References PLearn::ProgressBar::currentpos, PLearn::endl(), getPBarID(), PLearn::ProgressBar::maxpos, nticks, PLearn::TextProgressBarPlugin::out, printTitle(), and PLearn::PStream::write().
{ // this handles the case where we reuse the same progress bar if(newpos < pb->currentpos) { pb->currentpos=0; printTitle(pb); } if(0 < (int( newpos / (double(pb->maxpos) / nticks) ) - int(round( pb->currentpos / (double(pb->maxpos) / nticks) )))) { out.write("*PU "); out << getPBarID(pb) << newpos << endl; pb->currentpos = newpos; } }
unsigned int PLearn::RemoteProgressBarPlugin::next_pb_id = 0 [static, protected] |
Definition at line 109 of file ProgressBar.h.
Referenced by getPBarID().
unsigned int PLearn::RemoteProgressBarPlugin::nticks [protected] |
Definition at line 112 of file ProgressBar.h.
Referenced by update().
map< ProgressBar *, unsigned int > PLearn::RemoteProgressBarPlugin::pb_ids [static, protected] |
Definition at line 108 of file ProgressBar.h.
Referenced by getPBarID().