xmscore  1.0
Progress.h
Go to the documentation of this file.
1 #pragma once
2 //------------------------------------------------------------------------------
7 //------------------------------------------------------------------------------
8 
9 //----- Included files ---------------------------------------------------------
10 
12 
13 //----- Forward declarations ---------------------------------------------------
14 
15 //----- Namespace declaration --------------------------------------------------
16 
17 //----- Constants / Enumerations -----------------------------------------------
18 
19 //----- Structs / Classes ------------------------------------------------------
20 namespace xms
21 {
22 class Progress
23 {
24 public:
25  Progress(const std::string& a_message);
26  ~Progress();
27 
28  void UpdateMessage(const std::string& a_message);
29 
30  void SetItemCount(long long a_count);
31  void CurrentItem(long long a_item);
32 
33  void ProgressStatus(double a_percentComplete);
34 
35 private:
37  long long m_itemCount;
38 };
39 
43 {
44 public:
45  virtual ~ProgressListener();
46 
50  virtual void OnProgressStatus(int a_stackIndex, double a_fractionComplete) = 0;
51 
55  virtual int OnBeginOperationString(const std::string& a_operation) = 0;
56 
59  virtual void OnEndOperation(int a_stackIndex) = 0;
60 
64  virtual void OnUpdateMessage(int a_stackIndex, const std::string& a_message) = 0;
65 
66  static void SetListener(BSHP<ProgressListener> a_listener);
67  static BSHP<ProgressListener> GetListener();
68 };
69 
70 } // namespace xms
71 
72 //----- Function prototypes ----------------------------------------------------
Stack based class to give notification of progress for a long task. Progress can be stacked by making...
Definition: Progress.h:22
void CurrentItem(long long a_item)
Give notification for the number of items completed. Used with SetItemCount.
Definition: Progress.cpp:102
void UpdateMessage(const std::string &a_message)
Update the current progress message.
Definition: Progress.cpp:82
Progress(const std::string &a_message)
Constructor.
Definition: Progress.cpp:59
Listen to progress reported from Progress class.
Definition: Progress.h:42
Macros etc that make boost more convenient to use.
void SetItemCount(long long a_count)
Set the number of items to be processed. Used with CurrentItem.
Definition: Progress.cpp:93
void ProgressStatus(double a_percentComplete)
Give notification for the progress percent complete.
Definition: Progress.cpp:116
~Progress()
Destructor.
Definition: Progress.cpp:71
int m_stackIndex
instances index on stack of instances
Definition: Progress.h:36
long long m_itemCount
number of items to process
Definition: Progress.h:37