StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
ProgressStatus.hpp
Go to the documentation of this file.
1 #ifndef __STDAIR_BAS_PROGRESSSTATUS_HPP
2 #define __STDAIR_BAS_PROGRESSSTATUS_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <string>
9 // Boost Progress
10 #include <boost/progress.hpp>
11 // StdAir
16 
17 namespace stdair {
18 
27  struct ProgressStatus : public StructAbstract {
28  public:
29  // //////////////// Getters /////////////////
31  const Count_T& count() const {
32  return _currentNb;
33  }
34 
36  const Count_T& getCurrentNb() const {
37  return _currentNb;
38  }
39 
41  const Count_T& getExpectedNb() const {
42  return _expectedNb;
43  }
44 
46  const Count_T& getActualNb() const {
47  return _actualNb;
48  }
49 
52  if (_actualNb == 0) {
53  return 0;
54  }
55  Percentage_T lPercentage =
56  (static_cast<Percentage_T> (_currentNb)
57  / static_cast<Percentage_T> (_actualNb));
58  lPercentage *= MAXIMUM_PROGRESS_STATUS;
59  return lPercentage;
60  }
61 
62 
63  // //////////////// Setters /////////////////
65  void setCurrentNb (const Count_T& iCurrentNb) {
66  _currentNb = iCurrentNb;
67  }
68 
70  void setExpectedNb (const Count_T& iExpectedNb) {
71  _expectedNb = iExpectedNb;
72  }
73 
75  void setActualNb (const Count_T& iActualNb) {
76  _actualNb = iActualNb;
77  }
78 
80  void reset();
81 
83  Count_T operator+= (Count_T iIncrement) {
84  _currentNb += iIncrement;
85  return _currentNb;
86  }
87 
90  ++_currentNb;
91  return _currentNb;
92  }
93 
94 
95  public:
96  // //////////////// Display Support Methods /////////////////
98  const std::string describe() const;
99 
101  const std::string toString() const;
102 
103 
104  public:
112  ProgressStatus (const Count_T& iCurrentNb, const Count_T& iExpectedNb,
113  const Count_T& iActualNb);
114 
123  ProgressStatus (const Count_T& iExpectedNb, const Count_T& iActualNb);
124 
133  ProgressStatus (const Count_T& iActualNb);
134 
140  ProgressStatus();
141 
146 
147  private:
148  // //////////////// Attributes /////////////////
150  Count_T _currentNb;
151 
153  Count_T _expectedNb;
154 
156  Count_T _actualNb;
157  };
158 
159 }
160 #endif // __STDAIR_BAS_PROGRESSSTATUS_HPP
Handle on the StdAir library context.
void setActualNb(const Count_T &iActualNb)
unsigned int Count_T
Base class for the light structures.
const ProgressPercentage_T progress() const
void setExpectedNb(const Count_T &iExpectedNb)
float ProgressPercentage_T
Count_T operator+=(Count_T iIncrement)
const std::string toString() const
const Count_T & count() const
void setCurrentNb(const Count_T &iCurrentNb)
const std::string describe() const
const Count_T & getActualNb() const
const Count_T & getCurrentNb() const
const Count_T & getExpectedNb() const
double Percentage_T
const Percentage_T MAXIMUM_PROGRESS_STATUS