5 * Created by Pat Schloss on 8/14/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
11 #include "progress.hpp"
13 const int totalTicks = 50;
14 const char marker = '|';
17 /***********************************************************************/
21 m = MothurOut::getInstance();
22 m->mothurOut("********************#****#****#****#****#****#****#****#****#****#****#");
28 m->errorOut(e, "Progress", "Progress");
33 /***********************************************************************/
35 Progress::Progress(string job, int end){
37 m = MothurOut::getInstance();
39 m->mothurOut("********************#****#****#****#****#****#****#****#****#****#****#\n");
40 cout << setw(20) << left << job << setw(1) << marker;
41 m->mothurOutJustToLog(job);
42 m->mothurOut(toString(marker));
50 m->errorOut(e, "Progress", "Progress");
55 /***********************************************************************/
57 void Progress::newLine(string job, int end){
59 m->mothurOutEndLine();
60 cout << setw(20) << left << job << setw(1) << marker;
61 m->mothurOutJustToLog(job);
62 m->mothurOut(toString(marker));
69 m->errorOut(e, "Progress", "newLine");
74 /***********************************************************************/
76 void Progress::update(const int currentPos){
78 int ratio = int(totalTicks * (float)currentPos / finalPos);
81 for(int i=nTicks;i<ratio;i++){
82 m->mothurOut(toString(marker));
89 m->errorOut(e, "Progress", "update");
94 /***********************************************************************/
96 void Progress::finish(){
98 for(int i=nTicks;i<totalTicks;i++){
99 m->mothurOut(toString(marker));
104 m->mothurOutEndLine();
105 m->mothurOut("***********************************************************************\n");
108 catch(exception& e) {
109 m->errorOut(e, "Progress", "finish");
114 /***********************************************************************/