StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
Policy.hpp
Go to the documentation of this file.
1 #ifndef __STDAIR_BOM_POLICY_HPP
2 #define __STDAIR_BOM_POLICY_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <cmath>
9 // StdAir
14 #include <stdair/bom/PolicyKey.hpp>
15 
17 namespace boost {
18  namespace serialization {
19  class access;
20  }
21 }
22 
23 namespace stdair {
24 
30  class Policy : public BomAbstract {
31  template <typename BOM> friend class FacBom;
32  friend class FacBomManager;
34 
35  public:
36  // ////////// Type definitions ////////////
40  typedef PolicyKey Key_T;
41 
42  public:
43  // /////////////////// Getters ////////////////////////
45  const Key_T& getKey() const {
46  return _key;
47  }
48 
50  BomAbstract* const getParent() const {
51  return _parent;
52  }
53 
57  const HolderMap_T& getHolderMap() const {
58  return _holderMap;
59  }
60 
63 
65  const NbOfBookings_T& getDemand() const {
66  return _demand;
67  }
68 
70  const StdDevValue_T& getStdDev() const {
71  return _stdDev;
72  }
73 
75  const Yield_T& getYield() const {
76  return _yield;
77  }
78 
80  const Revenue_T getTotalRevenue () const;
81 
82  public:
83  // ///////////////////// Setters /////////////////////
85  void setDemand (const NbOfBookings_T& iDemand) {
86  _demand = iDemand;
87  }
88 
90  void setStdDev (const StdDevValue_T& iStdDev) {
91  _stdDev = iStdDev;
92  }
93 
95  void setYield (const Yield_T& iYield) {
96  _yield = iYield;
97  }
98 
101  _demand = 0.0;
102  _stdDev = 0.0;
103  _yieldDemandMap.clear();
104  }
105 
107  void addYieldDemand (const Yield_T&, const NbOfBookings_T&);
108 
109  public:
110  // /////////// Display support methods /////////
116  void toStream (std::ostream& ioOut) const {
117  ioOut << toString();
118  }
119 
125  void fromStream (std::istream& ioIn) {
126  }
127 
131  std::string toString() const;
132 
136  const std::string describeKey() const {
137  return _key.toString();
138  }
139 
140 
141  public:
142  // /////////// (Boost) Serialisation support methods /////////
146  template<class Archive>
147  void serialize (Archive& ar, const unsigned int iFileVersion);
148 
149  private:
157  void serialisationImplementationExport() const;
158  void serialisationImplementationImport();
159 
160 
161  protected:
162  // /////////// Constructors and destructor. ////////////
166  Policy (const Key_T&);
167 
171  virtual ~Policy();
172 
173  private:
177  Policy();
178 
182  Policy (const Policy&);
183 
184 
185  private:
186  // //////////// Attributes ////////////
190  Key_T _key;
191 
195  BomAbstract* _parent;
196 
200  HolderMap_T _holderMap;
201 
205  NbOfBookings_T _demand;
206 
210  StdDevValue_T _stdDev;
211 
215  Yield_T _yield;
216 
220  YieldDemandMap_T _yieldDemandMap;
221 
222  };
223 }
224 #endif // __STDAIR_BOM_POLICY_HPP
void toStream(std::ostream &ioOut) const
Definition: Policy.hpp:116
void addYieldDemand(const Yield_T &, const NbOfBookings_T &)
Definition: Policy.cpp:70
const BookingClassList_T & getBookingClassList() const
Definition: Policy.cpp:52
Utility class for linking StdAir-based objects.
Handle on the StdAir library context.
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:24
void setDemand(const NbOfBookings_T &iDemand)
Definition: Policy.hpp:85
NbOfRequests_T NbOfBookings_T
void resetDemandForecast()
Definition: Policy.hpp:100
double Revenue_T
const StdDevValue_T & getStdDev() const
Definition: Policy.hpp:70
const std::string describeKey() const
Definition: Policy.hpp:136
const Revenue_T getTotalRevenue() const
Definition: Policy.cpp:57
std::list< BookingClass * > BookingClassList_T
std::map< const Yield_T, double > YieldDemandMap_T
const Yield_T & getYield() const
Definition: Policy.hpp:75
virtual ~Policy()
Definition: Policy.cpp:35
double StdDevValue_T
Base class for Factory layer.
Definition: FacBom.hpp:22
const Key_T & getKey() const
Definition: Policy.hpp:45
void setStdDev(const StdDevValue_T &iStdDev)
Definition: Policy.hpp:90
void setYield(const Yield_T &iYield)
Definition: Policy.hpp:95
PolicyKey Key_T
Definition: Policy.hpp:40
Forward declarations.
friend class boost::serialization::access
Definition: Policy.hpp:33
BomAbstract *const getParent() const
Definition: Policy.hpp:50
Key of a given policy, made of a policy code.
Definition: PolicyKey.hpp:26
const HolderMap_T & getHolderMap() const
Definition: Policy.hpp:57
const NbOfBookings_T & getDemand() const
Definition: Policy.hpp:65
std::string toString() const
Definition: Policy.cpp:39
void fromStream(std::istream &ioIn)
Definition: Policy.hpp:125
const std::string toString() const
Definition: PolicyKey.cpp:46
void serialize(Archive &ar, const unsigned int iFileVersion)