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 00192 void setSoldSeat (const NbOfSeats_T& iSoldSeat) { 00193 _soldSeat = iSoldSeat; 00194 } 00195 00197 void setCommittedSpace (const CommittedSpace_T& iCommittedSpace) { 00198 _committedSpace = iCommittedSpace; 00199 } 00200 00202 void setAvailabilityPool (const Availability_T& iAvailabilityPool) { 00203 _availabilityPool = iAvailabilityPool; 00204 } 00205 00207 void setAvailability (const Availability_T& iAvailability) { 00208 _availability = iAvailability; 00209 } 00210 00212 void setCurrentBidPrice (const BidPrice_T& iBidPrice) { 00213 _currentBidPrice = iBidPrice; 00214 } 00215 00217 void setPreviousBidPrice (const BidPrice_T& iBidPrice) { 00218 _previousBidPrice = iBidPrice; 00219 } 00220 00222 void updatePreviousBidPrice () { 00223 _previousBidPrice = _currentBidPrice; 00224 } 00225 00227 void setRegradeAdjustment (const CapacityAdjustment_T& iRegradeAdjustment) { 00228 _dcsRegrade = iRegradeAdjustment; 00229 } 00230 00232 void setAuthorizationLevel (const AuthorizationLevel_T& iAU) { 00233 _au = iAU; 00234 } 00235 00237 void setUPR (const UPR_T& iUPR) { 00238 _upr = iUPR; 00239 } 00240 00242 void setNetAvailability (const Availability_T& iNAV) { 00243 _nav = iNAV; 00244 } 00245 00247 void setGrossAvailability (const Availability_T& iGAV) { 00248 _gav = iGAV; 00249 } 00250 00252 void setAvgCancellationPercentage (const OverbookingRate_T& iACP) { 00253 _acp = iACP; 00254 } 00255 00257 void setETB (const NbOfSeats_T& iETB) { 00258 _etb = iETB; 00259 } 00260 00262 void setStaffNbOfSeats (const NbOfSeats_T& iStaffSeats) { 00263 _staffNbOfBookings = iStaffSeats; 00264 } 00265 00267 void setWLNbOfSeats (const NbOfSeats_T& iWLSeats) { 00268 _wlNbOfBookings = iWLSeats; 00269 } 00270 00272 void setGroupNbOfSeats (const NbOfSeats_T& iGroupSeats) { 00273 _groupNbOfBookings = iGroupSeats; 00274 } 00275 00277 void updateCurrentBidPrice(); 00278 00279 00280 public: 00281 // /////////// Display support methods ///////// 00286 void toStream (std::ostream& ioOut) const { 00287 ioOut << toString(); 00288 } 00289 00294 void fromStream (std::istream& ioIn) { 00295 } 00296 00300 std::string toString() const; 00301 00305 const std::string describeKey() const { 00306 return _key.toString(); 00307 } 00308 00312 const std::string displayVirtualClassList() const; 00313 00314 00315 public: 00316 // /////////// Business methods ////////// 00320 void updateFromReservation (const NbOfBookings_T&); 00321 00325 void addVirtualClass (const VirtualClassStruct& iVC) { 00326 _virtualClassList.push_back (iVC); 00327 } 00328 00332 void emptyVirtualClassList() { 00333 _virtualClassList.clear(); 00334 } 00335 00339 void emptyBidPriceVector() { 00340 _bidPriceVector.clear(); 00341 } 00342 00346 void addDemandInformation (const YieldValue_T&, const MeanValue_T&, 00347 const StdDevValue_T&); 00348 00352 void emptyYieldLevelDemandMap() { 00353 _yieldLevelDemandMap.clear(); 00354 } 00355 00356 00357 protected: 00358 // ////////// Constructors and destructors ///////// 00362 LegCabin (const Key_T&); 00366 ~LegCabin(); 00367 00368 private: 00372 LegCabin(); 00376 LegCabin (const LegCabin&); 00377 00378 00379 00380 protected: 00381 // ////////// Attributes ///////// 00385 Key_T _key; 00386 00390 BomAbstract* _parent; 00391 00395 HolderMap_T _holderMap; 00396 00398 CabinCapacity_T _offeredCapacity; 00399 00401 CabinCapacity_T _physicalCapacity; 00402 00404 NbOfSeats_T _soldSeat; 00405 00406 /* Committed space. */ 00407 CommittedSpace_T _committedSpace; 00408 00410 Availability_T _availabilityPool; 00411 00413 Availability_T _availability; 00414 00416 BidPrice_T _currentBidPrice; 00417 00419 BidPrice_T _previousBidPrice; 00420 00422 BidPriceVector_T _bidPriceVector; 00423 00425 VirtualClassList_T _virtualClassList; 00426 00428 YieldLevelDemandMap_T _yieldLevelDemandMap; 00429 00430 00431 public: 00433 CapacityAdjustment_T _dcsRegrade; 00434 00436 AuthorizationLevel_T _au; 00437 00439 UPR_T _upr; 00440 00442 Availability_T _nav; 00443 00445 Availability_T _gav; 00446 00448 OverbookingRate_T _acp; 00449 00451 NbOfSeats_T _etb; 00452 00454 NbOfSeats_T _staffNbOfBookings; 00455 00457 NbOfSeats_T _wlNbOfBookings; 00458 00460 NbOfSeats_T _groupNbOfBookings; 00461 }; 00462 00463 } 00464 #endif // __STDAIR_BOM_LEGCABIN_HPP 00465