xmscore  1.0
Observer.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 ObserverT;
26 class Observer
27 {
28  friend ObserverT;
29 public:
30  Observer();
31  virtual ~Observer();
32 
33  bool ProgressStatus(double a_percentComplete);
34  void BeginOperationString(const std::string& a_operation);
35  void EndOperation();
36  void UpdateMessage(const std::string& a_message);
37 
38 private:
41  virtual void OnProgressStatus(double a_percentComplete) = 0;
42  virtual void OnBeginOperationString(const std::string& a_operation);
43  virtual void OnEndOperation();
44  virtual void OnUpdateMessage(const std::string& a_message);
45  virtual void TimeRemainingInSeconds(double a_remainingSeconds);
46  virtual void TimeElapsedInSeconds(double a_elapsedSeconds);
47 
48  class impl;
49  BSHP<impl> m_p;
50 }; // class Observer
51 
52 } // namespace xms
53 
54 //----- Function prototypes ----------------------------------------------------
virtual void TimeRemainingInSeconds(double a_remainingSeconds)
Virtual method to publish the time remaining.
Definition: Observer.cpp:98
virtual void TimeElapsedInSeconds(double a_elapsedSeconds)
Virtual method to publish the elasped time.
Definition: Observer.cpp:106
void UpdateMessage(const std::string &a_message)
Updates the message but not the percent complete.
Definition: Observer.cpp:135
virtual void OnEndOperation()
Virtual function for derived class to get end operation event.
Definition: Observer.cpp:151
void BeginOperationString(const std::string &a_operation)
Publishes the name of the operation and starts the timing of the operation.
Definition: Observer.cpp:116
Implementation of the observer class.
Definition: Observer.cpp:42
friend ObserverT
testing class
Definition: Observer.h:28
virtual void OnUpdateMessage(const std::string &a_message)
Definition: Observer.cpp:158
bool ProgressStatus(double a_percentComplete)
Method to publish the progress status.
Definition: Observer.cpp:78
Macros etc that make boost more convenient to use.
BSHP< impl > m_p
implementation class
Definition: Observer.h:48
virtual void OnBeginOperationString(const std::string &a_operation)
Virtual function for derived class to get the operation string.
Definition: Observer.cpp:144
virtual void OnProgressStatus(double a_percentComplete)=0
void EndOperation()
Ends the operation.
Definition: Observer.cpp:125
Class used with the observer pattern.
Definition: Observer.h:26