00001 #ifndef __STDAIR_BOM_SEGMENTCABIN_HPP 00002 #define __STDAIR_BOM_SEGMENTCABIN_HPP 00003 00004 // ////////////////////////////////////////////////////////////////////// 00005 // Import section 00006 // ////////////////////////////////////////////////////////////////////// 00007 // STL 00008 #include <iosfwd> 00009 #include <string> 00010 // StdAir 00011 #include <stdair/stdair_inventory_types.hpp> 00012 #include <stdair/bom/BomAbstract.hpp> 00013 #include <stdair/bom/SegmentCabinKey.hpp> 00014 #include <stdair/bom/SegmentCabinTypes.hpp> 00015 00017 namespace boost { 00018 namespace serialization { 00019 class access; 00020 } 00021 } 00022 00023 namespace stdair { 00024 // Forward declarations 00025 class GuillotineBlock; 00026 00031 class SegmentCabin : public BomAbstract { 00032 template <typename BOM> friend class FacBom; 00033 friend class FacBomManager; 00034 friend class boost::serialization::access; 00035 00036 public: 00037 // ////////// Type definitions //////////// 00041 typedef SegmentCabinKey Key_T; 00042 00043 00044 public: 00045 // /////////// Getters ///////////// 00049 const Key_T& getKey() const { 00050 return _key; 00051 } 00052 00056 BomAbstract* const getParent() const { 00057 return _parent; 00058 } 00059 00063 const HolderMap_T& getHolderMap() const { 00064 return _holderMap; 00065 } 00066 00070 const CabinCode_T& getCabinCode() const { 00071 return _key.getCabinCode(); 00072 } 00073 00082 const MapKey_T getFullerKey() const; 00083 00085 const GuillotineBlock& getGuillotineBlock() const { 00086 assert (_guillotineBlock != NULL); 00087 return *_guillotineBlock; 00088 } 00089 00091 const CabinCapacity_T& getCapacity() const { 00092 return _capacity; 00093 } 00094 00096 const BlockSpace_T& getBlockSpace() const { 00097 return _blockSpace; 00098 } 00099 00101 const BlockSpace_T& getMIN() const { 00102 return _min; 00103 } 00104 00106 const UPR_T& getUPR() const { 00107 return _upr; 00108 } 00109 00111 const NbOfBookings_T& getBookingCounter() const { 00112 return _bookingCounter; 00113 } 00114 00116 const CommittedSpace_T& getCommittedSpace() const { 00117 return _committedSpace; 00118 } 00119 00121 const Availability_T& getAvailabilityPool() const { 00122 return _availabilityPool; 00123 } 00124 00126 const BidPrice_T& getCurrentBidPrice() const { 00127 return _currentBidPrice; 00128 } 00129 00131 const BidPriceVector_T& getBidPriceVector() const { 00132 return _bidPriceVector; 00133 } 00134 00136 const bool getFareFamalyStatus() const { 00137 return _fareFamilyActivation; 00138 } 00139 00140 public: 00141 // ///////// Setters ////////// 00143 void setGuillotineBlock (GuillotineBlock& ioGuillotine) { 00144 _guillotineBlock = &ioGuillotine; 00145 } 00146 00148 void setCapacity (const CabinCapacity_T& iCapacity) { 00149 _capacity = iCapacity; 00150 } 00151 00153 void setBlockSpace (const BlockSpace_T& iBlockSpace) { 00154 _blockSpace = iBlockSpace; 00155 } 00156 00158 void setMIN (const BlockSpace_T& iMIN) { 00159 _min = iMIN; 00160 } 00161 00163 void setUPR (const UPR_T& iUPR) { 00164 _upr = iUPR; 00165 } 00166 00168 void setBookingCounter (const NbOfBookings_T& iBookingCounter) { 00169 _bookingCounter = iBookingCounter; 00170 } 00171 00173 void setCommittedSpace (const CommittedSpace_T& iCommittedSpace) { 00174 _committedSpace = iCommittedSpace; 00175 } 00176 00178 void setAvailabilityPool (const Availability_T& iAvailabilityPool) { 00179 _availabilityPool = iAvailabilityPool; 00180 } 00181 00183 void setBidPriceVector (const BidPriceVector_T& iBPV) { 00184 _bidPriceVector = iBPV; 00185 } 00186 00188 void activateFareFamily () { 00189 _fareFamilyActivation = true; 00190 } 00191 00192 public: 00193 // /////////// Business methods ////////// 00195 void updateFromReservation (const NbOfBookings_T&); 00196 00197 00198 public: 00199 // /////////// Display support methods ///////// 00205 void toStream (std::ostream& ioOut) const { 00206 ioOut << toString(); 00207 } 00208 00214 void fromStream (std::istream& ioIn) { 00215 } 00216 00220 std::string toString() const; 00221 00225 const std::string describeKey() const { 00226 return _key.toString(); 00227 } 00228 00229 00230 public: 00231 // /////////// (Boost) Serialisation support methods ///////// 00235 template<class Archive> 00236 void serialize (Archive& ar, const unsigned int iFileVersion); 00237 00238 private: 00243 void serialisationImplementation(); 00244 00245 00246 protected: 00247 // ////////// Constructors and destructors ///////// 00251 SegmentCabin (const Key_T&); 00252 00256 virtual ~SegmentCabin(); 00257 00258 private: 00262 SegmentCabin(); 00263 00267 SegmentCabin (const SegmentCabin&); 00268 00269 00270 protected: 00271 // ////////// Attributes ///////// 00275 Key_T _key; 00276 00280 BomAbstract* _parent; 00281 00285 HolderMap_T _holderMap; 00286 00290 GuillotineBlock* _guillotineBlock; 00291 00293 CabinCapacity_T _capacity; 00294 00296 BlockSpace_T _blockSpace; 00297 00299 BlockSpace_T _min; 00300 00302 UPR_T _upr; 00303 00305 NbOfBookings_T _bookingCounter; 00306 00308 CommittedSpace_T _committedSpace; 00309 00311 Availability_T _availabilityPool; 00312 00314 BidPriceVector_T _bidPriceVector; 00315 00317 BidPrice_T _currentBidPrice; 00318 00320 bool _fareFamilyActivation; 00321 }; 00322 00323 } 00324 #endif // __STDAIR_BOM_SEGMENTCABIN_HPP 00325