StdAir Logo  0.45.1
C++ Standard Airline IT Object Library
SegmentCabin.hpp
Go to the documentation of this file.
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 getFareFamilyStatus() 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:
00246     void serialisationImplementationExport() const;
00247     void serialisationImplementationImport();
00248 
00249 
00250   protected:
00251     // ////////// Constructors and destructors /////////
00255     SegmentCabin (const Key_T&);
00256 
00260     virtual ~SegmentCabin();
00261 
00262   private:
00266     SegmentCabin();
00267 
00271     SegmentCabin (const SegmentCabin&);
00272 
00273 
00274   protected:
00275     // ////////// Attributes /////////
00279     Key_T _key;
00280 
00284     BomAbstract* _parent;
00285     
00289     HolderMap_T _holderMap;
00290 
00294     GuillotineBlock* _guillotineBlock;
00295 
00297     CabinCapacity_T _capacity;
00298 
00300     BlockSpace_T _blockSpace;     
00301 
00303     BlockSpace_T _min;
00304 
00306     UPR_T _upr;
00307 
00309     NbOfBookings_T _bookingCounter;
00310 
00312     CommittedSpace_T _committedSpace;
00313 
00315     Availability_T _availabilityPool;
00316 
00318     BidPriceVector_T _bidPriceVector;
00319 
00321     BidPrice_T _currentBidPrice;
00322 
00324     bool _fareFamilyActivation;
00325   };
00326 
00327 }
00328 #endif // __STDAIR_BOM_SEGMENTCABIN_HPP
00329 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines