StdAir Logo  0.43.0
C++ Standard Airline IT Library
LegCabin.hpp
Go to the documentation of this file.
00001 #ifndef __STDAIR_BOM_LEGCABIN_HPP
00002 #define __STDAIR_BOM_LEGCABIN_HPP
00003 // //////////////////////////////////////////////////////////////////////
00004 // Import section
00005 // //////////////////////////////////////////////////////////////////////
00006 // STL
00007 #include <iosfwd>
00008 #include <string>
00009 // StdAir
00010 #include <stdair/stdair_inventory_types.hpp>
00011 #include <stdair/stdair_maths_types.hpp>
00012 #include <stdair/bom/BomAbstract.hpp>
00013 #include <stdair/bom/LegCabinKey.hpp>
00014 #include <stdair/bom/LegCabinTypes.hpp>
00015 #include <stdair/bom/VirtualClassStruct.hpp>
00016 #include <stdair/bom/VirtualClassTypes.hpp>
00017 
00018 namespace stdair {
00019 
00024   class LegCabin : public BomAbstract {
00025     template <typename BOM> friend class FacBom;
00026     friend class FacBomManager;
00027 
00028   public:
00029     // ////////// Type definitions ////////////
00033     typedef LegCabinKey Key_T;
00034 
00035   public:
00036     // /////////// Getters ////////////
00040     const Key_T& getKey() const {
00041       return _key;
00042     }
00043 
00047     BomAbstract* const getParent() const {
00048       return _parent;
00049     }
00050     
00054     const CabinCode_T& getCabinCode() const {
00055       return _key.getCabinCode();
00056     }
00057 
00065     const MapKey_T getFullerKey() const;
00066 
00070     const HolderMap_T& getHolderMap() const {
00071       return _holderMap;
00072     }
00073 
00075     const CabinCapacity_T& getOfferedCapacity() const {
00076       return _offeredCapacity;
00077     }
00078 
00080     const CabinCapacity_T& getPhysicalCapacity() const {
00081       return _physicalCapacity;
00082     }
00083 
00085     const NbOfSeats_T& getSoldSeat() const {
00086       return _soldSeat;
00087     }
00088 
00090     const CommittedSpace_T& getCommittedSpace() const {
00091       return _committedSpace;
00092     }
00093 
00095     const Availability_T& getAvailabilityPool() const {
00096       return _availabilityPool;
00097     }
00098 
00100     const Availability_T& getAvailability() const {
00101       return _availability;
00102     }
00103 
00105     const BidPrice_T& getCurrentBidPrice() const {
00106       return _currentBidPrice;
00107     }
00108 
00110     const BidPrice_T& getPreviousBidPrice() const {
00111       return _previousBidPrice;
00112     }
00113     
00115     const BidPriceVector_T& getBidPriceVector() const {
00116       return _bidPriceVector;
00117     }
00118 
00120     const CapacityAdjustment_T& getRegradeAdjustment() const {
00121       return _dcsRegrade;
00122     }
00123 
00125     const AuthorizationLevel_T& getAuthorizationLevel() const {
00126       return _au;
00127     }
00128 
00130     const UPR_T& getUPR() const {
00131       return _upr;
00132     }
00133 
00135     const Availability_T& getNetAvailability() const {
00136       return _nav;
00137     }
00138 
00140     const Availability_T& getGrossAvailability() const {
00141       return _gav;
00142     }
00143 
00145     const OverbookingRate_T& getAvgCancellationPercentage() const {
00146       return _acp;
00147     }
00148 
00150     const NbOfSeats_T& getETB() const {
00151       return _etb;
00152     }
00153 
00155     const NbOfSeats_T& getStaffNbOfSeats() const {
00156       return _staffNbOfBookings;
00157     }
00158 
00160     const NbOfSeats_T& getWLNbOfSeats() const {
00161       return _wlNbOfBookings;
00162     }
00163 
00165     const NbOfSeats_T& getGroupNbOfSeats() const {
00166       return _groupNbOfBookings;
00167     }
00168 
00170     VirtualClassList_T& getVirtualClassList() {
00171       return _virtualClassList;
00172     }
00173 
00175     BidPriceVector_T& getBidPriceVector() {
00176       return _bidPriceVector;
00177     }
00178 
00179 
00181     const YieldLevelDemandMap_T getYieldLevelDemandMap() {
00182       return _yieldLevelDemandMap;
00183     }
00184 
00185 
00186   public:
00187     // ///////////// Setters ///////////////
00189     void setCapacities (const CabinCapacity_T& iCapacity) {
00190       _offeredCapacity = iCapacity;
00191       _physicalCapacity = iCapacity;
00192       setAvailabilityPool (iCapacity - _committedSpace);
00193     }
00194     
00196     void setSoldSeat (const NbOfSeats_T& iSoldSeat) {
00197       _soldSeat = iSoldSeat;
00198     }
00199 
00201     void setCommittedSpace (const CommittedSpace_T& iCommittedSpace) {
00202       _committedSpace = iCommittedSpace;
00203     }
00204 
00206     void setAvailabilityPool (const Availability_T& iAvailabilityPool) {
00207       _availabilityPool = iAvailabilityPool;
00208     }
00209 
00211     void setAvailability (const Availability_T& iAvailability) {
00212       _availability = iAvailability;
00213     }
00214 
00216     void setCurrentBidPrice (const BidPrice_T& iBidPrice) {
00217       _currentBidPrice = iBidPrice;
00218     }
00219 
00221     void setPreviousBidPrice (const BidPrice_T& iBidPrice) {
00222       _previousBidPrice = iBidPrice;
00223     }
00224 
00226     void updatePreviousBidPrice () {
00227       _previousBidPrice = _currentBidPrice;
00228     }   
00229 
00231     void setRegradeAdjustment (const CapacityAdjustment_T& iRegradeAdjustment) {
00232       _dcsRegrade = iRegradeAdjustment;
00233     }
00234 
00236     void setAuthorizationLevel (const AuthorizationLevel_T& iAU) {
00237       _au = iAU;
00238     }
00239 
00241     void setUPR (const UPR_T& iUPR) {
00242       _upr = iUPR;
00243     }
00244 
00246     void setNetAvailability (const Availability_T& iNAV) {
00247       _nav = iNAV;
00248     }
00249 
00251     void setGrossAvailability (const Availability_T& iGAV) {
00252       _gav = iGAV;
00253     }
00254 
00256     void setAvgCancellationPercentage (const OverbookingRate_T& iACP) {
00257       _acp = iACP;
00258     }
00259 
00261     void setETB (const NbOfSeats_T& iETB) {
00262       _etb = iETB;
00263     }
00264 
00266     void setStaffNbOfSeats (const NbOfSeats_T& iStaffSeats) {
00267       _staffNbOfBookings = iStaffSeats;
00268     }
00269 
00271     void setWLNbOfSeats (const NbOfSeats_T& iWLSeats) {
00272       _wlNbOfBookings = iWLSeats;
00273     }
00274 
00276     void setGroupNbOfSeats (const NbOfSeats_T& iGroupSeats) {
00277       _groupNbOfBookings = iGroupSeats;
00278     }
00279 
00281     void updateCurrentBidPrice () {
00282       if (_availabilityPool >= 1) {
00283         unsigned int lBidPriceVectorSize = _bidPriceVector.size();
00284         if (lBidPriceVectorSize >= _availabilityPool) {
00285         _currentBidPrice = _bidPriceVector.at(_availabilityPool - 1);
00286         }
00287       }
00288     }
00289 
00290   public:
00291     // /////////// Display support methods /////////
00294     void toStream (std::ostream& ioOut) const {
00295       ioOut << toString();
00296     }
00297 
00300     void fromStream (std::istream& ioIn) {
00301     }
00302 
00304     std::string toString() const;
00305     
00307     const std::string describeKey() const {
00308       return _key.toString();
00309     }
00310 
00312     const std::string displayVirtualClassList () const;
00313 
00314 
00315   public:
00316     // /////////// Business methods //////////
00318     void updateFromReservation (const NbOfBookings_T&);
00319 
00321     void addVirtualClass (const VirtualClassStruct& iVC) {
00322       _virtualClassList.push_back (iVC);
00323     }
00324 
00326     void emptyVirtualClassList() {
00327       _virtualClassList.clear();
00328     }
00329 
00331     void emptyBidPriceVector() {
00332       _bidPriceVector.clear();
00333     }
00334 
00336     void addDemandInformation (const YieldValue_T&,
00337                                const MeanValue_T&,
00338                                const StdDevValue_T&);
00339 
00341     void emptyYieldLevelDemandMap() {
00342       _yieldLevelDemandMap.clear();
00343     }
00344 
00345   protected:
00346     // ////////// Constructors and destructors /////////
00348     LegCabin (const Key_T&);
00350     ~LegCabin();
00351 
00352   private:
00354     LegCabin();
00356     LegCabin (const LegCabin&);
00357 
00358 
00359   protected:
00360     // ////////// Attributes /////////
00362     Key_T _key;
00363 
00365     BomAbstract* _parent;
00366     
00368     HolderMap_T _holderMap;
00369 
00371     CabinCapacity_T _offeredCapacity;
00372 
00374     CabinCapacity_T _physicalCapacity;
00375 
00377     NbOfSeats_T  _soldSeat;
00378 
00379     /* Committed space. */
00380     CommittedSpace_T  _committedSpace;
00381 
00383     Availability_T _availabilityPool;
00384 
00386     Availability_T _availability;
00387 
00389     BidPrice_T _currentBidPrice;
00390 
00392     BidPrice_T _previousBidPrice;
00393     
00395     BidPriceVector_T _bidPriceVector;
00396 
00398     VirtualClassList_T _virtualClassList;
00399 
00401     YieldLevelDemandMap_T _yieldLevelDemandMap;
00402 
00403   public:
00405     CapacityAdjustment_T _dcsRegrade;
00406 
00408     AuthorizationLevel_T _au;
00409 
00411     UPR_T _upr;
00412 
00414     Availability_T _nav;
00415 
00417     Availability_T _gav;
00418 
00420     OverbookingRate_T _acp;
00421 
00423     NbOfSeats_T _etb;
00424 
00426     NbOfSeats_T _staffNbOfBookings;
00427 
00429     NbOfSeats_T _wlNbOfBookings;
00430 
00432     NbOfSeats_T _groupNbOfBookings;
00433   };
00434 
00435 }
00436 #endif // __STDAIR_BOM_LEGCABIN_HPP
00437