A composite of progress objects. More...
#include <mbl_progress_composite.h>
Public Member Functions | |
mbl_progress_composite () | |
Constructor. | |
virtual | ~mbl_progress_composite () |
Destructor. | |
void | add_progress (mbl_progress *progress) |
Adds a progress object to the composite. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual void | print_summary (vcl_ostream &) const |
Print class to os. | |
void | set_estimated_iterations (const vcl_string &identifier, const int iterations, const vcl_string &display_text) |
Estimated number of iterations for the given identifier. | |
void | set_throw_exception_on_cancel (bool t) |
If true set_progress() will throw an exception if cancel has been set. | |
void | set_progress (const vcl_string &identifier, const int progress) |
Sets progress for the given identifier. | |
void | increment_progress (const vcl_string &identifier, const int n=1) |
Increments progress for the given identifier by n. | |
void | end_progress (const vcl_string &identifier) |
Explicitly marks the end of loop for the given identifier. | |
int | progress (const vcl_string &identifier) const |
Gets progress for given identifier. | |
vcl_string | display_text (const vcl_string &identifier) const |
Gets display text for given identifier. | |
int | estimated_iterations (const vcl_string &identifier) const |
Gets estimated total iterations for given identifier. | |
void | set_cancelled (const vcl_string &identifier, const bool cancel) |
Modify the flag to cancel the current process. | |
bool | is_cancelled (const vcl_string &identifier) const |
Check whether progress object is marked as cancelled. | |
Protected Member Functions | |
virtual void | on_set_estimated_iterations (const vcl_string &identifier, const int total_iterations) |
Called when set_estimate_iterations() is called for a given identifier. | |
virtual void | on_set_progress (const vcl_string &identifier, const int progress) |
Called when set_progress() is called for a given identifier. | |
virtual void | on_end_progress (const vcl_string &identifier) |
Called when end_progress() is called for a given identifier. | |
Private Attributes | |
vcl_vector< mbl_progress * > | progress_objects_ |
Stores estimated iterations for each identifier. |
A composite of progress objects.
Individual progress objects are attached to an instance of mbl_progress_composite which is passed to an algorithm. The mbl_progress_composite will inform all attached progress objects if and when it is informed of any progress.
Definition at line 27 of file mbl_progress_composite.h.
mbl_progress_composite::mbl_progress_composite | ( | ) |
Constructor.
Definition at line 8 of file mbl_progress_composite.cxx.
mbl_progress_composite::~mbl_progress_composite | ( | ) | [virtual] |
Destructor.
Definition at line 14 of file mbl_progress_composite.cxx.
void mbl_progress_composite::add_progress | ( | mbl_progress * | progress | ) |
Adds a progress object to the composite.
These are assumed to exist for the lifetime of this object.
Definition at line 20 of file mbl_progress_composite.cxx.
vcl_string mbl_progress::display_text | ( | const vcl_string & | identifier | ) | const [inherited] |
Gets display text for given identifier.
identifier | to query. |
Definition at line 83 of file mbl_progress.cxx.
void mbl_progress::end_progress | ( | const vcl_string & | identifier | ) | [inherited] |
Explicitly marks the end of loop for the given identifier.
Definition at line 62 of file mbl_progress.cxx.
int mbl_progress::estimated_iterations | ( | const vcl_string & | identifier | ) | const [inherited] |
Gets estimated total iterations for given identifier.
identifier | to query. |
Definition at line 97 of file mbl_progress.cxx.
void mbl_progress::increment_progress | ( | const vcl_string & | identifier, |
const int | n = 1 |
||
) | [inherited] |
Increments progress for the given identifier by n.
Definition at line 48 of file mbl_progress.cxx.
vcl_string mbl_progress_composite::is_a | ( | ) | const [virtual] |
Name of the class.
Definition at line 34 of file mbl_progress_composite.cxx.
bool mbl_progress::is_cancelled | ( | const vcl_string & | identifier | ) | const [inherited] |
Check whether progress object is marked as cancelled.
identifier | Progress object to check. |
Definition at line 130 of file mbl_progress.cxx.
void mbl_progress_composite::on_end_progress | ( | const vcl_string & | identifier | ) | [protected, virtual] |
Called when end_progress() is called for a given identifier.
identifier | The operation being monitored. |
Implements mbl_progress.
Definition at line 61 of file mbl_progress_composite.cxx.
void mbl_progress_composite::on_set_estimated_iterations | ( | const vcl_string & | identifier, |
const int | total_iterations | ||
) | [protected, virtual] |
Called when set_estimate_iterations() is called for a given identifier.
identifier | The operation being monitored. |
Implements mbl_progress.
Definition at line 41 of file mbl_progress_composite.cxx.
void mbl_progress_composite::on_set_progress | ( | const vcl_string & | identifier, |
const int | progress | ||
) | [protected, virtual] |
Called when set_progress() is called for a given identifier.
identifier | The operation being monitored. |
progress | The new progress status. |
Implements mbl_progress.
Definition at line 51 of file mbl_progress_composite.cxx.
virtual void mbl_progress_composite::print_summary | ( | vcl_ostream & | ) | const [inline, virtual] |
Print class to os.
Definition at line 48 of file mbl_progress_composite.h.
int mbl_progress::progress | ( | const vcl_string & | identifier | ) | const [inherited] |
Gets progress for given identifier.
identifier | to query. |
Definition at line 69 of file mbl_progress.cxx.
void mbl_progress::set_cancelled | ( | const vcl_string & | identifier, |
const bool | cancel | ||
) | [inherited] |
Modify the flag to cancel the current process.
identifier | Progress object to cancel. |
Definition at line 114 of file mbl_progress.cxx.
void mbl_progress::set_estimated_iterations | ( | const vcl_string & | identifier, |
const int | iterations, | ||
const vcl_string & | display_text | ||
) | [inherited] |
Estimated number of iterations for the given identifier.
Definition at line 11 of file mbl_progress.cxx.
void mbl_progress::set_progress | ( | const vcl_string & | identifier, |
const int | progress | ||
) | [inherited] |
Sets progress for the given identifier.
Checks whether cancel has been set; if so calls end_progress(), and throws an exception if "throw_exception_on_cancel" is true.
Definition at line 24 of file mbl_progress.cxx.
void mbl_progress::set_throw_exception_on_cancel | ( | bool | t | ) | [inline, inherited] |
If true set_progress() will throw an exception if cancel has been set.
Definition at line 64 of file mbl_progress.h.
short mbl_progress_composite::version_no | ( | ) | const |
Version number for I/O.
Definition at line 27 of file mbl_progress_composite.cxx.
vcl_vector<mbl_progress*> mbl_progress_composite::progress_objects_ [private] |
Stores estimated iterations for each identifier.
Definition at line 70 of file mbl_progress_composite.h.