]> git.donarmstrong.com Git - mothur.git/blobdiff - progress.cpp
changed random forest output filename
[mothur.git] / progress.cpp
index a01ae71fb413031260df2202e3aa56cf6ccbc812..ff93b348e521009fac30e72bc3e0c34f46327400 100644 (file)
@@ -10,8 +10,6 @@
 
 #include "progress.hpp"
 
-using namespace std;
-
 const int totalTicks = 50;
 const char marker = '|';
 
@@ -20,17 +18,14 @@ const char marker = '|';
 
 Progress::Progress(){
        try {
-               cout << "********************#****#****#****#****#****#****#****#****#****#****#";
+               m = MothurOut::getInstance();
+               m->mothurOut("********************#****#****#****#****#****#****#****#****#****#****#");
                
                nTicks = 0;
                finalPos = 0;
        }
        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";
+               m->errorOut(e, "Progress", "Progress");
                exit(1);
        }
 }
@@ -39,19 +34,20 @@ Progress::Progress(){
 
 Progress::Progress(string job, int end){
        try {
-               cout << "********************#****#****#****#****#****#****#****#****#****#****#\n";
+               m = MothurOut::getInstance();
+               
+               m->mothurOut("********************#****#****#****#****#****#****#****#****#****#****#\n");
                cout << setw(20) << left << job << setw(1) << marker;
+               m->mothurOutJustToLog(job);
+               m->mothurOut(toString(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";
+               m->errorOut(e, "Progress", "Progress");
                exit(1);
        }
 }
@@ -60,19 +56,17 @@ Progress::Progress(string job, int end){
 
 void Progress::newLine(string job, int end){
        try {
-               cout << endl;
+               m->mothurOutEndLine();
                cout << setw(20) << left << job << setw(1) << marker;
+               m->mothurOutJustToLog(job);
+               m->mothurOut(toString(marker));
                cout.flush();
                
                nTicks = 0;
                finalPos = end;
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Progress class Function newline. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the Progress class function newline. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               m->errorOut(e, "Progress", "newLine");
                exit(1);
        }
 }
@@ -85,18 +79,14 @@ void Progress::update(const int currentPos){
        
                if(ratio > nTicks){
                        for(int i=nTicks;i<ratio;i++){
-                               cout << marker;
+                               m->mothurOut(toString(marker));
                                cout.flush();
                        }
                        nTicks = ratio;
                }
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Progress class Function update. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the Progress class function update. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               m->errorOut(e, "Progress", "update");
                exit(1);
        }
 }
@@ -106,21 +96,17 @@ void Progress::update(const int currentPos){
 void Progress::finish(){
        try {
                for(int i=nTicks;i<totalTicks;i++){
-                       cout << marker;
+                       m->mothurOut(toString(marker));
                        cout.flush();
                }
        
        
-               cout << endl;
-               cout << "***********************************************************************\n";
+               m->mothurOutEndLine();
+               m->mothurOut("***********************************************************************\n");
                cout.flush();
        }
        catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the Progress class Function finish. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the Progress class function finish. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               m->errorOut(e, "Progress", "finish");
                exit(1);
        }
 }