00001 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00002 #pragma implementation 00003 #endif 00004 //: 00005 // \file 00006 // \brief Progress class that outputs simple text reporting on progress 00007 // \author Graham Vincent and Kevin de Souza 00008 // \date 25 Feb 2005 00009 00010 #include "mbl_progress_text.h" 00011 00012 00013 //======================================================================== 00014 // Constructor 00015 //======================================================================== 00016 mbl_progress_text::mbl_progress_text(vcl_ostream& os/*=vcl_cout*/) 00017 : os_(os) 00018 { 00019 } 00020 00021 00022 //======================================================================== 00023 // Destructor 00024 //======================================================================== 00025 mbl_progress_text::~mbl_progress_text() 00026 { 00027 } 00028 00029 00030 //======================================================================== 00031 // Name of the class 00032 //======================================================================== 00033 vcl_string mbl_progress_text::is_a() const 00034 { 00035 return "mbl_progress_text"; 00036 } 00037 00038 00039 //======================================================================== 00040 // Called when set_estimate_iterations() is called for a given identifier. 00041 //======================================================================== 00042 void mbl_progress_text::on_set_estimated_iterations(const vcl_string& identifier, 00043 const int /*total_iterations*/) 00044 { 00045 os_ << "Starting mbl_progress_text \"" << identifier << "\"" << vcl_endl; 00046 } 00047 00048 00049 //======================================================================== 00050 // Called when set_progress() is called for a given identifier. 00051 //======================================================================== 00052 void mbl_progress_text::on_set_progress(const vcl_string& identifier, 00053 const int progress) 00054 { 00055 os_ << "Progress for mbl_progress_text \"" << identifier << "\" is " << progress 00056 << " (out of " << estimated_iterations(identifier) << ')' 00057 << vcl_endl; 00058 } 00059 00060 00061 //======================================================================== 00062 // Called when end_progress() is called for a given identifier. 00063 //======================================================================== 00064 void mbl_progress_text::on_end_progress(const vcl_string &identifier) 00065 { 00066 os_ << "Finishing mbl_progress_text \"" << identifier << "\"" << vcl_endl; 00067 }