X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=progress.cpp;fp=progress.cpp;h=94ad41607064445a2307e5fcd2298403de8424a5;hb=20a2d0350a737a434c89f303662d64a8eeea7b05;hp=0000000000000000000000000000000000000000;hpb=bbb5879a7e566935c23d63d42bb945072424b939;p=mothur.git diff --git a/progress.cpp b/progress.cpp new file mode 100644 index 0000000..94ad416 --- /dev/null +++ b/progress.cpp @@ -0,0 +1,90 @@ +/* + * progress.cpp + * + * + * Created by Pat Schloss on 8/14/08. + * Copyright 2008 Patrick D. Schloss. All rights reserved. + * + */ + +#include +#include +#include "progress.hpp" +#include + +using namespace std; + +const int totalTicks = 50; +const char marker = '|'; + + +/***********************************************************************/ + +Progress::Progress(string job, int end){ + try { + cout << "*******************#****#****#****#****#****#****#****#****#****#****#\n"; + cout << job << marker; + cout.flush(); + + nTicks = 0; + finalPos = end; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the Progress class Function Progress. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the Progress class function Progress. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ + +void Progress::update(const int currentPos){ + try { + int ratio = int(totalTicks * (float)currentPos / finalPos); + + if(ratio > nTicks){ + for(int i=nTicks;i