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("********************#****#****#****#****#****#****#****#****#****#****#\n");
38 cout << setw(20) << left << job << setw(1) << marker;
39 m->mothurOutJustToLog(job);
40 m->mothurOut(toString(marker));
47 m->errorOut(e, "Progress", "Progress");
52 /***********************************************************************/
54 void Progress::newLine(string job, int end){
56 m->mothurOutEndLine();
57 cout << setw(20) << left << job << setw(1) << marker;
58 m->mothurOutJustToLog(job);
59 m->mothurOut(toString(marker));
66 m->errorOut(e, "Progress", "newLine");
71 /***********************************************************************/
73 void Progress::update(const int currentPos){
75 int ratio = int(totalTicks * (float)currentPos / finalPos);
78 for(int i=nTicks;i<ratio;i++){
79 m->mothurOut(toString(marker));
86 m->errorOut(e, "Progress", "update");
91 /***********************************************************************/
93 void Progress::finish(){
95 for(int i=nTicks;i<totalTicks;i++){
96 m->mothurOut(toString(marker));
101 m->mothurOutEndLine();
102 m->mothurOut("***********************************************************************\n");
105 catch(exception& e) {
106 m->errorOut(e, "Progress", "finish");
111 /***********************************************************************/