File: mbl_progress_time.h

package info (click to toggle)
vxl 1.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 124,144 kB
  • ctags: 94,084
  • sloc: cpp: 652,168; ansic: 178,141; fortran: 27,980; sh: 5,248; python: 1,941; lisp: 1,107; makefile: 292; perl: 255; xml: 184
file content (65 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef mbl_progress_time_h_
#define mbl_progress_time_h_
#ifdef VCL_NEEDS_PRAGMA_INTERFACE
#pragma interface
#endif


//:
// \file
// \brief Progress class that outputs elapsed time reporting on progress
// \author Kevin de Souza
// \date 26 June 2008


#include <vcl_iostream.h>
#include <vul/vul_timer.h>
#include <vul/vul_ios_state.h>
#include <mbl/mbl_progress.h>


//========================================================================
//: \brief Progress class that outputs elapsed time reporting on progress
class mbl_progress_time : public mbl_progress
{
public:

  //: Constructor
  // \param os Ostream for text output (defaults to cout)
  mbl_progress_time(vcl_ostream& os=vcl_cout);

  //: Destructor
  ~mbl_progress_time();

  //: Name of the class
  virtual vcl_string is_a() const;


protected:

  //: Called when set_estimate_iterations() is called for a given identifier.
  //  \param identifier The operation being monitored.
  virtual void on_set_estimated_iterations(const vcl_string& identifier,
                                           const int total_iterations);

  //: Called when set_progress() is called for a given identifier.
  //  \param identifier The operation being monitored.
  //  \param progress The new progress status.
  virtual void on_set_progress(const vcl_string& identifier,
                               const int progress);

  //: Called when end_progress() is called for a given identifier.
  //  \param identifier The operation being monitored.
  virtual void on_end_progress(const vcl_string &identifier);


protected:

  vcl_ostream& os_;
  vul_timer timer_;
  vul_ios_state_saver ios_state_; // Restores stream format after this progress object is destroyed
};

//========================================================================

#endif // mbl_progress_time_h_