$treeview $search $mathjax
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 #include <stdair/bom/PolicyTypes.hpp> 00016 00018 namespace boost { 00019 namespace serialization { 00020 class access; 00021 } 00022 } 00023 00024 namespace stdair { 00025 // Forward declarations 00026 class SegmentSnapshotTable; 00027 class Policy; 00028 00033 class SegmentCabin : public BomAbstract { 00034 template <typename BOM> friend class FacBom; 00035 template <typename BOM> friend class FacCloneBom; 00036 friend class FacBomManager; 00037 friend class boost::serialization::access; 00038 00039 public: 00040 // ////////// Type definitions //////////// 00044 typedef SegmentCabinKey Key_T; 00045 00046 00047 public: 00048 // /////////// Getters ///////////// 00052 const Key_T& getKey() const { 00053 return _key; 00054 } 00055 00059 BomAbstract* const getParent() const { 00060 return _parent; 00061 } 00062 00066 const HolderMap_T& getHolderMap() const { 00067 return _holderMap; 00068 } 00069 00073 const CabinCode_T& getCabinCode() const { 00074 return _key.getCabinCode(); 00075 } 00076 00085 const MapKey_T getFullerKey() const; 00086 00088 const SegmentSnapshotTable& getSegmentSnapshotTable() const { 00089 assert (_segmentSnapshotTable != NULL); 00090 return *_segmentSnapshotTable; 00091 } 00092 00094 const CabinCapacity_T& getCapacity() const { 00095 return _capacity; 00096 } 00097 00099 const BlockSpace_T& getBlockSpace() const { 00100 return _blockSpace; 00101 } 00102 00104 const BlockSpace_T& getMIN() const { 00105 return _min; 00106 } 00107 00109 const UPR_T& getUPR() const { 00110 return _upr; 00111 } 00112 00114 const NbOfBookings_T& getBookingCounter() const { 00115 return _bookingCounter; 00116 } 00117 00119 const CommittedSpace_T& getCommittedSpace() const { 00120 return _committedSpace; 00121 } 00122 00124 const Availability_T& getAvailabilityPool() const { 00125 return _availabilityPool; 00126 } 00127 00129 const BidPrice_T& getCurrentBidPrice() const { 00130 return _currentBidPrice; 00131 } 00132 00134 const BidPriceVector_T& getBidPriceVector() const { 00135 return _bidPriceVector; 00136 } 00137 00139 const bool getFareFamilyStatus() const { 00140 return _fareFamilyActivation; 00141 } 00142 00144 const PolicyList_T& getConvexHull() const { 00145 return _convexHull; 00146 } 00147 00148 public: 00149 // ///////// Setters ////////// 00151 void setSegmentSnapshotTable (SegmentSnapshotTable& ioTable) { 00152 _segmentSnapshotTable = &ioTable; 00153 } 00154 00156 void setCapacity (const CabinCapacity_T& iCapacity) { 00157 _capacity = iCapacity; 00158 } 00159 00161 void setBlockSpace (const BlockSpace_T& iBlockSpace) { 00162 _blockSpace = iBlockSpace; 00163 } 00164 00166 void setMIN (const BlockSpace_T& iMIN) { 00167 _min = iMIN; 00168 } 00169 00171 void setUPR (const UPR_T& iUPR) { 00172 _upr = iUPR; 00173 } 00174 00176 void setBookingCounter (const NbOfBookings_T& iBookingCounter) { 00177 _bookingCounter = iBookingCounter; 00178 } 00179 00181 void setCommittedSpace (const CommittedSpace_T& iCommittedSpace) { 00182 _committedSpace = iCommittedSpace; 00183 } 00184 00186 void setAvailabilityPool (const Availability_T& iAvailabilityPool) { 00187 _availabilityPool = iAvailabilityPool; 00188 } 00189 00191 void setBidPriceVector (const BidPriceVector_T& iBPV) { 00192 _bidPriceVector = iBPV; 00193 } 00194 00196 void activateFareFamily () { 00197 _fareFamilyActivation = true; 00198 } 00199 00200 public: 00201 // /////////// Business methods ////////// 00203 void updateFromReservation (const NbOfBookings_T&); 00204 00206 void resetConvexHull () { _convexHull.clear(); } 00207 00212 void addPolicy (Policy&); 00213 00214 public: 00215 // /////////// Display support methods ///////// 00221 void toStream (std::ostream& ioOut) const { 00222 ioOut << toString(); 00223 } 00224 00230 void fromStream (std::istream& ioIn) { 00231 } 00232 00236 std::string toString() const; 00237 00241 const std::string describeKey() const { 00242 return _key.toString(); 00243 } 00244 00248 const std::string describeConvexHull() const; 00249 00250 00251 public: 00252 // /////////// (Boost) Serialisation support methods ///////// 00256 template<class Archive> 00257 void serialize (Archive& ar, const unsigned int iFileVersion); 00258 00259 private: 00267 void serialisationImplementationExport() const; 00268 void serialisationImplementationImport(); 00269 00270 00271 protected: 00272 // ////////// Constructors and destructors ///////// 00276 SegmentCabin (const Key_T&); 00277 00281 virtual ~SegmentCabin(); 00282 00283 private: 00287 SegmentCabin(); 00288 00292 SegmentCabin (const SegmentCabin&); 00293 00294 00295 protected: 00296 // ////////// Attributes ///////// 00300 Key_T _key; 00301 00305 BomAbstract* _parent; 00306 00310 HolderMap_T _holderMap; 00311 00315 SegmentSnapshotTable* _segmentSnapshotTable; 00316 00318 CabinCapacity_T _capacity; 00319 00321 BlockSpace_T _blockSpace; 00322 00324 BlockSpace_T _min; 00325 00327 UPR_T _upr; 00328 00330 NbOfBookings_T _bookingCounter; 00331 00333 CommittedSpace_T _committedSpace; 00334 00336 Availability_T _availabilityPool; 00337 00339 BidPriceVector_T _bidPriceVector; 00340 00342 BidPrice_T _currentBidPrice; 00343 00345 bool _fareFamilyActivation; 00346 00348 PolicyList_T _convexHull; 00349 00350 }; 00351 00352 } 00353 #endif // __STDAIR_BOM_SEGMENTCABIN_HPP 00354