StdAir Logo  1.00.13
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 // StdAir
14 
15 namespace stdair {
16 
25  struct ProgressStatus : public StructAbstract {
26  public:
27  // //////////////// Getters /////////////////
29  const Count_T& count() const {
30  return _currentNb;
31  }
32 
34  const Count_T& getCurrentNb() const {
35  return _currentNb;
36  }
37 
39  const Count_T& getExpectedNb() const {
40  return _expectedNb;
41  }
42 
44  const Count_T& getActualNb() const {
45  return _actualNb;
46  }
47 
50  if (_actualNb == 0) {
51  return 0;
52  }
53  Percentage_T lPercentage =
54  (static_cast<Percentage_T> (_currentNb)
55  / static_cast<Percentage_T> (_actualNb));
56  lPercentage *= MAXIMUM_PROGRESS_STATUS;
57  return lPercentage;
58  }
59 
60 
61  // //////////////// Setters /////////////////
63  void setCurrentNb (const Count_T& iCurrentNb) {
64  _currentNb = iCurrentNb;
65  }
66 
68  void setExpectedNb (const Count_T& iExpectedNb) {
69  _expectedNb = iExpectedNb;
70  }
71 
73  void setActualNb (const Count_T& iActualNb) {
74  _actualNb = iActualNb;
75  }
76 
78  void reset();
79 
81  Count_T operator+= (Count_T iIncrement) {
82  _currentNb += iIncrement;
83  return _currentNb;
84  }
85 
88  ++_currentNb;
89  return _currentNb;
90  }
91 
92 
93  public:
94  // //////////////// Display Support Methods /////////////////
96  const std::string describe() const;
97 
99  const std::string toString() const;
100 
101 
102  public:
110  ProgressStatus (const Count_T& iCurrentNb, const Count_T& iExpectedNb,
111  const Count_T& iActualNb);
112 
121  ProgressStatus (const Count_T& iExpectedNb, const Count_T& iActualNb);
122 
131  ProgressStatus (const Count_T& iActualNb);
132 
138  ProgressStatus();
139 
144 
145  private:
146  // //////////////// Attributes /////////////////
148  Count_T _currentNb;
149 
151  Count_T _expectedNb;
152 
154  Count_T _actualNb;
155  };
156 
157 }
158 #endif // __STDAIR_BAS_PROGRESSSTATUS_HPP
Handle on the StdAir library context.
float ProgressPercentage_T
double Percentage_T
const Percentage_T MAXIMUM_PROGRESS_STATUS
unsigned int Count_T
const Count_T & getExpectedNb() const
Count_T operator+=(Count_T iIncrement)
void setActualNb(const Count_T &iActualNb)
const Count_T & getActualNb() const
const std::string toString() const
void setCurrentNb(const Count_T &iCurrentNb)
void setExpectedNb(const Count_T &iExpectedNb)
const Count_T & count() const
const ProgressPercentage_T progress() const
const Count_T & getCurrentNb() const
const std::string describe() const
Base class for the light structures.