$treeview $search $mathjax
StdAir Logo  1.00.2
$projectbrief
$projectbrief
$searchbox

stdair/bom/Policy.hpp

Go to the documentation of this file.
00001 #ifndef __STDAIR_BOM_POLICY_HPP
00002 #define __STDAIR_BOM_POLICY_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <cmath>
00009 // StdAir
00010 #include <stdair/stdair_basic_types.hpp>
00011 #include <stdair/stdair_rm_types.hpp>
00012 #include <stdair/bom/BomAbstract.hpp>
00013 #include <stdair/bom/BookingClassTypes.hpp>
00014 #include <stdair/bom/PolicyKey.hpp>
00015 
00017 namespace boost {
00018   namespace serialization {
00019     class access;
00020   }
00021 }
00022 
00023 namespace stdair {    
00024 
00030   class Policy : public BomAbstract {
00031     template <typename BOM> friend class FacBom;
00032     friend class FacBomManager;
00033     friend class boost::serialization::access;
00034 
00035   public:
00036     // ////////// Type definitions ////////////
00040     typedef PolicyKey Key_T;
00041       
00042   public:
00043     // /////////////////// Getters ////////////////////////
00045     const Key_T& getKey() const {
00046       return _key;
00047     }
00048 
00050     BomAbstract* const getParent() const {
00051       return _parent;
00052     }
00053 
00057     const HolderMap_T& getHolderMap() const {
00058       return _holderMap;
00059     }
00060 
00062     const BookingClassList_T& getBookingClassList() const;
00063     
00065     const NbOfBookings_T& getDemand() const {
00066       return _demand;
00067     }
00068     
00070     const StdDevValue_T& getStdDev() const {
00071       return _stdDev;
00072     }
00073     
00075     const Yield_T& getYield() const {
00076       return _yield;
00077     }
00078 
00080     const Revenue_T getTotalRevenue () const;
00081     
00082   public:
00083     // ///////////////////// Setters /////////////////////
00085     void setDemand (const NbOfBookings_T& iDemand) {
00086       _demand = iDemand;
00087     }
00088     
00090     void setStdDev (const StdDevValue_T& iStdDev) {
00091       _stdDev = iStdDev;
00092     }
00093     
00095     void setYield (const Yield_T& iYield) {
00096       _yield = iYield;
00097     }
00098 
00100     void resetDemandForecast () {
00101       _demand = 0.0;
00102       _stdDev = 0.0;
00103       _yieldDemandMap.clear();
00104     }
00105 
00107     void addYieldDemand (const Yield_T&, const NbOfBookings_T&);  
00108     
00109   public:
00110     // /////////// Display support methods /////////
00116     void toStream (std::ostream& ioOut) const {
00117       ioOut << toString();
00118     }
00119 
00125     void fromStream (std::istream& ioIn) {
00126     }
00127 
00131     std::string toString() const;
00132     
00136     const std::string describeKey() const {
00137       return _key.toString();
00138     }
00139     
00140     
00141   public:
00142     // /////////// (Boost) Serialisation support methods /////////
00146     template<class Archive>
00147     void serialize (Archive& ar, const unsigned int iFileVersion);
00148 
00149   private:
00157     void serialisationImplementationExport() const;
00158     void serialisationImplementationImport();
00159 
00160       
00161   protected:
00162     // /////////// Constructors and destructor. ////////////
00166     Policy (const Key_T&);
00167       
00171     virtual ~Policy();
00172 
00173   private:
00177     Policy();
00178 
00182     Policy (const Policy&);
00183     
00184       
00185   private:
00186     // //////////// Attributes ////////////
00190     Key_T _key;
00191 
00195     BomAbstract* _parent;
00196 
00200     HolderMap_T _holderMap;
00201 
00205     NbOfBookings_T _demand;
00206 
00210     StdDevValue_T _stdDev;
00211 
00215     Yield_T _yield;
00216 
00220     YieldDemandMap_T _yieldDemandMap;
00221 
00222   };
00223 }
00224 #endif // __STDAIR_BOM_POLICY_HPP