00001 #ifndef mbl_progress_composite_h_ 00002 #define mbl_progress_composite_h_ 00003 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00004 #pragma interface 00005 #endif 00006 00007 00008 //: 00009 // \file 00010 // \brief A composite of progress objects. 00011 // \author Graham Vincent 00012 // \date 25 Feb 2005 00013 00014 #include <vsl/vsl_binary_io.h> 00015 #include <mbl/mbl_progress.h> 00016 #include <vcl_vector.h> 00017 #include <vcl_string.h> 00018 #include <vcl_iosfwd.h> 00019 00020 //======================================================================= 00021 //: A composite of progress objects. 00022 // 00023 // Individual progress objects are attached to an instance of 00024 // mbl_progress_composite which is passed to an algorithm. 00025 // The mbl_progress_composite will inform all attached progress objects 00026 // if and when it is informed of any progress. 00027 class mbl_progress_composite : public mbl_progress 00028 { 00029 public: 00030 00031 //: Constructor 00032 mbl_progress_composite(); 00033 00034 //: Destructor 00035 virtual ~mbl_progress_composite(); 00036 00037 //: Adds a progress object to the composite. 00038 // These are assumed to exist for the lifetime of this object. 00039 void add_progress(mbl_progress *progress); 00040 00041 //: Version number for I/O 00042 short version_no() const; 00043 00044 //: Name of the class 00045 virtual vcl_string is_a() const; 00046 00047 //: Print class to os 00048 virtual void print_summary(vcl_ostream& ) const {} 00049 00050 protected: 00051 00052 //: Called when set_estimate_iterations() is called for a given identifier. 00053 // \param identifier The operation being monitored. 00054 virtual void on_set_estimated_iterations(const vcl_string &identifier, 00055 const int total_iterations); 00056 00057 //: Called when set_progress() is called for a given identifier. 00058 // \param identifier The operation being monitored. 00059 // \param progress The new progress status. 00060 virtual void on_set_progress(const vcl_string &identifier, 00061 const int progress); 00062 00063 //: Called when end_progress() is called for a given identifier. 00064 // \param identifier The operation being monitored. 00065 virtual void on_end_progress(const vcl_string &identifier); 00066 00067 private: 00068 00069 //: Stores estimated iterations for each identifier 00070 vcl_vector<mbl_progress*> progress_objects_; 00071 }; 00072 00073 //======================================================================= 00074 00075 #endif