OpendTect-6_4  6.4
progressmeterimpl.h
Go to the documentation of this file.
1 #ifndef progressmeterimpl_h
2 #define progressmeterimpl_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl / Bert Bril
9  Date: 07-10-1999
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "progressmeter.h"
17 #include "bufstring.h"
18 #include "threadlock.h"
19 #include "callback.h"
20 #include "od_iosfwd.h"
21 class Task;
22 
23 
27 {
28 public:
29 
32  void reset();
33 
34  void setFrom(const Task&);
35 
36  void setForwardTo(ProgressMeter*);
37  virtual void setStarted();
38  virtual void setFinished();
39  virtual void setName(const char*);
40  virtual void setTotalNr(od_int64);
41  virtual void setNrDone(od_int64);
42  virtual void setMessage(const uiString&);
43  void setMessage(const uiString&,bool printtolog);
44  virtual void setNrDoneText(const uiString&);
45  virtual void operator++();
46 
47  const char* name() const;
48  virtual od_int64 nrDone() const;
49  od_int64 totalNr() const;
50  uiString message() const;
51  uiString nrDoneText() const;
52  bool isStarted() const;
53  bool isFinished() const;
54  ProgressMeter* forwardTo() const;
55 
56  virtual void skipProgress(bool);
57 
58 protected:
59 
65  bool isstarted_;
67  ProgressMeter* forwardto_;
68 
70 
71 };
72 
73 
77 {
78 public:
79 
81  unsigned short rowlen=cDefaultRowLen());
83 
84  static int cDefaultRowLen() { return 50; }
85  static int cNrCharsPerRow() { return 80; }
86 
87  void setName(const char*);
88  void setStarted();
89  void setFinished();
90  void setNrDone(od_int64);
92  {
93  Threads::Locker lock( lock_ );
94  totalnr_ = t;
95  }
96 
97  void setMessage(const uiString&);
98  void printMessage(const uiString&);
99 
101  void skipProgress( bool yn ) { skipprog_ = yn; }
102 
103  void operator++();
104  od_int64 nrDone() const { return nrdone_; }
105 
106  void reset();
107 
108 protected:
109 
110  void addProgress(int);
111 
115  unsigned short rowlen_;
116  unsigned char distcharidx_;
121  int oldtime_;
123  bool inited_;
124  bool finished_;
126  bool skipprog_;
127 
128  void annotate(bool);
129 };
130 
131 
132 #endif
#define mExpClass(module)
Definition: commondefs.h:160
virtual void setName(const char *)
Locks the lock, shutting out access from other threads if needed.
Definition: threadlock.h:85
bool isstarted_
Definition: progressmeterimpl.h:65
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
void skipProgress(bool yn)
Definition: progressmeterimpl.h:101
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
bool skipprog_
Definition: progressmeterimpl.h:126
is an interface where processes can report their progress.
Definition: progressmeter.h:21
uiString message_
Definition: progressmeterimpl.h:63
#define od_int64
Definition: plftypes.h:36
static int cDefaultRowLen()
Definition: progressmeterimpl.h:84
int64_t totalnr_
Definition: progressmeterimpl.h:120
uiString nrdonetext_
Definition: progressmeterimpl.h:64
Definition: uistring.h:89
int oldtime_
Definition: progressmeterimpl.h:121
unsigned short rowlen_
Definition: progressmeterimpl.h:115
unsigned char distcharidx_
Definition: progressmeterimpl.h:116
int64_t nrDone() const
Definition: progressmeterimpl.h:104
void message(const char *)
default: to stderr
bool finished_
Definition: progressmeterimpl.h:124
int64_t nrdoneperchar_
Definition: progressmeterimpl.h:117
od_ostream & strm_
Definition: progressmeterimpl.h:112
static int cNrCharsPerRow()
Definition: progressmeterimpl.h:85
bool inited_
Definition: progressmeterimpl.h:123
int64_t nrdone_
Definition: progressmeterimpl.h:118
Threads::Lock lock_
Definition: progressmeterimpl.h:125
int64_t totalnr_
Definition: progressmeterimpl.h:62
void setTotalNr(int64_t t)
Definition: progressmeterimpl.h:91
BufferString name_
Definition: progressmeterimpl.h:60
virtual const char * nrDoneText() const
Definition: task.h:75
int64_t nrdone_
Definition: progressmeterimpl.h:61
virtual int64_t totalNr() const
Definition: task.h:43
ProgressMeter * forwardto_
Definition: progressmeterimpl.h:67
bool isfinished_
Definition: progressmeterimpl.h:66
int nrdotsonline_
Definition: progressmeterimpl.h:122
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Textual progress indicator for batch programs.
Definition: progressmeterimpl.h:76
Threads::Lock & lock_
Definition: progressmeterimpl.h:69
virtual int64_t nrDone() const
Definition: task.h:37
ProgressMeter that helps unifying different tasks.
Definition: progressmeterimpl.h:26
int64_t lastannotatednrdone_
Definition: progressmeterimpl.h:119
uiString message_
Definition: progressmeterimpl.h:113
bool isFinished(const uiRetVal &)
virtual const OD::String & name() const
Definition: namedobj.h:47
Generalization of something (e.g. a computation) that needs to be done in multiple steps...
Definition: task.h:28
BufferString name_
Definition: progressmeterimpl.h:114

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019