StdAir Logo  0.44.0
C++ Standard Airline IT Object Library
GuillotineBlock.hpp
Go to the documentation of this file.
00001 #ifndef __STDAIR_BOM_GUILLOTINEBLOCK_HPP
00002 #define __STDAIR_BOM_GUILLOTINEBLOCK_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/GuillotineBlockKey.hpp>
00014 #include <stdair/bom/GuillotineBlockTypes.hpp>
00015 
00017 namespace boost {
00018   namespace serialization {
00019     class access;
00020   }
00021 }
00022 
00023 namespace stdair {
00024   // Forward declarations
00025   class SegmentCabin;
00026 
00031   class GuillotineBlock : 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 GuillotineBlockKey Key_T;
00042 
00043     
00044   public:
00045     // /////////// Getters ///////////////
00047     const Key_T& getKey() const {
00048       return _key;
00049     }
00050 
00052     BomAbstract* const getParent() const {
00053       return _parent;
00054     }
00055     
00057     const GuillotineNumber_T& getGuillotineNumber() const {
00058       return _key.getGuillotineNumber();
00059     }
00060 
00064     const HolderMap_T& getHolderMap() const {
00065       return _holderMap;
00066     }
00067 
00069     const SegmentCabinIndexMap_T& getSegmentCabinIndexMap() const {
00070       return _segmentCabinIndexMap;
00071     }
00072 
00074     const ValueTypeIndexMap_T& getValueTypeIndexMap() const {
00075       return _valueTypesIndexMap;
00076     }
00077 
00079     const BlockIndex_T& getBlockIndex (const MapKey_T&) const;
00080 
00082     const BlockNumber_T& getBlockNumber (const SegmentCabin&) const;
00083 
00086     ConstSegmentCabinDTDSnapshotView_T
00087     getConstSegmentCabinDTDBookingSnapshotView (const BlockNumber_T,
00088                                                 const BlockNumber_T,
00089                                                 const DTD_T) const;
00090 
00093     ConstSegmentCabinDTDRangeSnapshotView_T
00094     getConstSegmentCabinDTDRangeBookingSnapshotView (const BlockNumber_T,
00095                                                      const BlockNumber_T,
00096                                                      const DTD_T,
00097                                                      const DTD_T) const;
00098 
00101     SegmentCabinDTDSnapshotView_T
00102     getSegmentCabinDTDBookingSnapshotView (const BlockNumber_T,
00103                                            const BlockNumber_T, const DTD_T);
00104 
00107     SegmentCabinDTDRangeSnapshotView_T
00108     getSegmentCabinDTDRangeBookingSnapshotView (const BlockNumber_T,
00109                                                 const BlockNumber_T,
00110                                                 const DTD_T, const DTD_T);
00111 
00114     ConstSegmentCabinDTDSnapshotView_T
00115     getConstSegmentCabinDTDCancellationSnapshotView (const BlockNumber_T,
00116                                                 const BlockNumber_T,
00117                                                 const DTD_T) const;
00118 
00121     ConstSegmentCabinDTDRangeSnapshotView_T
00122     getConstSegmentCabinDTDRangeCancellationSnapshotView (const BlockNumber_T,
00123                                                           const BlockNumber_T,
00124                                                           const DTD_T,
00125                                                           const DTD_T) const;
00126 
00129     SegmentCabinDTDSnapshotView_T
00130     getSegmentCabinDTDCancellationSnapshotView (const BlockNumber_T,
00131                                                 const BlockNumber_T,
00132                                                 const DTD_T);
00133 
00136     SegmentCabinDTDRangeSnapshotView_T
00137     getSegmentCabinDTDRangeCancellationSnapshotView (const BlockNumber_T,
00138                                                      const BlockNumber_T,
00139                                                      const DTD_T, const DTD_T);
00140 
00143     ConstSegmentCabinDTDSnapshotView_T
00144     getConstSegmentCabinDTDProductAndPriceOrientedBookingSnapshotView
00145     (const BlockNumber_T, const BlockNumber_T, const DTD_T) const;
00146 
00149     ConstSegmentCabinDTDRangeSnapshotView_T
00150     getConstSegmentCabinDTDRangeProductAndPriceOrientedBookingSnapshotView
00151     (const BlockNumber_T, const BlockNumber_T, const DTD_T, const DTD_T) const;
00152 
00155     SegmentCabinDTDSnapshotView_T
00156     getSegmentCabinDTDProductAndPriceOrientedBookingSnapshotView
00157     (const BlockNumber_T, const BlockNumber_T, const DTD_T);
00158 
00161     SegmentCabinDTDRangeSnapshotView_T
00162     getSegmentCabinDTDRangeProductAndPriceOrientedBookingSnapshotView
00163     (const BlockNumber_T, const BlockNumber_T, const DTD_T, const DTD_T);
00164 
00167     ConstSegmentCabinDTDSnapshotView_T
00168     getConstSegmentCabinDTDAvailabilitySnapshotView (const BlockNumber_T,
00169                                                      const BlockNumber_T,
00170                                                      const DTD_T) const;
00171     
00174     ConstSegmentCabinDTDRangeSnapshotView_T
00175     getConstSegmentCabinDTDRangeAvailabilitySnapshotView (const BlockNumber_T,
00176                                                           const BlockNumber_T,
00177                                                           const DTD_T,
00178                                                           const DTD_T) const;
00179     
00182     SegmentCabinDTDSnapshotView_T
00183     getSegmentCabinDTDAvailabilitySnapshotView (const BlockNumber_T,
00184                                                 const BlockNumber_T,
00185                                                 const DTD_T);
00186 
00189     SegmentCabinDTDRangeSnapshotView_T
00190     getSegmentCabinDTDRangeAvailabilitySnapshotView (const BlockNumber_T,
00191                                                      const BlockNumber_T,
00192                                                      const DTD_T, const DTD_T);
00193 
00194 
00195   public:
00196     // //////////// Setters /////////////
00199     void initSnapshotBlocks (const SegmentCabinIndexMap_T&,
00200                              const ValueTypeIndexMap_T&);
00201     
00202   public:
00203     // /////////// Display support methods /////////
00209     void toStream (std::ostream& ioOut) const {
00210       ioOut << toString();
00211     }
00212 
00218     void fromStream (std::istream& ioIn) {
00219     }
00220 
00224     std::string toString() const;
00225     
00229     const std::string describeKey() const {
00230       return _key.toString();
00231     }
00232     
00233     
00234   public:
00235     // /////////// (Boost) Serialisation support methods /////////
00239     template<class Archive>
00240     void serialize (Archive& ar, const unsigned int iFileVersion);
00241 
00242   private:
00247     void serialisationImplementationExport() const;
00248     void serialisationImplementationImport();
00249 
00250 
00251   protected:
00252     // ////////// Constructors and destructors /////////
00256     GuillotineBlock (const Key_T&);
00257 
00261     virtual ~GuillotineBlock();
00262 
00263   private:
00267     GuillotineBlock();
00268 
00272     GuillotineBlock (const GuillotineBlock&);
00273     
00274 
00275   protected:
00276     // ////////// Attributes /////////
00278     Key_T _key;
00279 
00281     BomAbstract* _parent;
00282 
00284     HolderMap_T _holderMap;
00285 
00287     SegmentCabinIndexMap_T _segmentCabinIndexMap;
00288 
00291     ValueTypeIndexMap_T _valueTypesIndexMap;
00292 
00294     SnapshotBlock_T _bookingSnapshotBlock;
00295 
00297     SnapshotBlock_T _cancellationSnapshotBlock;
00298 
00300     SnapshotBlock_T _productAndPriceOrientedBookingSnapshotBlock;
00301 
00303     SnapshotBlock_T _availabilitySnapshotBlock;
00304   };
00305 
00306 }
00307 #endif // __STDAIR_BOM_GUILLOTINEBLOCK_HPP
00308