StdAir Logo  0.45.0
C++ Standard Airline IT Object Library
Bucket.hpp
Go to the documentation of this file.
00001 #ifndef __STDAIR_BOM_BUCKET_HPP
00002 #define __STDAIR_BOM_BUCKET_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/BucketKey.hpp>
00014 #include <stdair/bom/BucketTypes.hpp>
00015 
00017 namespace boost {
00018   namespace serialization {
00019     class access;
00020   }
00021 }
00022 
00023 namespace stdair {
00024 
00029   class Bucket : public BomAbstract {
00030     template <typename BOM> friend class FacBom;
00031     friend class FacBomManager;
00032     friend class boost::serialization::access;
00033     
00034   public:
00035     // //////////////// Type definitions //////////////////
00039     typedef BucketKey Key_T;
00040 
00041   public:
00042     // /////////// Getters ////////////
00046     const Key_T& getKey() const {
00047       return _key;
00048     }
00049 
00053     BomAbstract* const getParent() const {
00054       return _parent;
00055     }
00056 
00058     const HolderMap_T& getHolderMap() const {
00059       return _holderMap;
00060     }
00061 
00063     const SeatIndex_T& getSeatIndex() const {
00064       return _key.getSeatIndex();
00065     }
00066 
00068     const Yield_T& getYieldRangeUpperValue() const {
00069       return _yieldRangeUpperValue;
00070     }
00071 
00073     const CabinCapacity_T& getAvailability() const {
00074       return _availability;
00075     }
00076 
00078     const NbOfSeats_T& getSoldSeats() const {
00079       return _soldSeats;
00080     }
00081 
00082 
00083     // /////////// Setters ////////////
00085     void setYieldRangeUpperValue (const Yield_T& iYield) {
00086       _yieldRangeUpperValue = iYield;
00087     }
00088 
00090     void setAvailability (const CabinCapacity_T& iAvl) {
00091       _availability = iAvl;
00092     }
00093 
00095     void setSoldSeats (const NbOfSeats_T& iSoldSeats) {
00096       _soldSeats = iSoldSeats;
00097     }
00098 
00099 
00100   public:
00101     // /////////// Display support methods /////////
00107     void toStream (std::ostream& ioOut) const {
00108       ioOut << toString();
00109     }
00110 
00116     void fromStream (std::istream& ioIn) {
00117     }
00118 
00122     std::string toString() const;
00123     
00127     const std::string describeKey() const {
00128       return _key.toString();
00129     }
00130     
00131 
00132   public:
00133     // /////////// (Boost) Serialisation support methods /////////
00137     template<class Archive>
00138     void serialize (Archive& ar, const unsigned int iFileVersion);
00139 
00140   private:
00145     void serialisationImplementationExport() const;
00146     void serialisationImplementationImport();
00147 
00148 
00149   protected:
00150     // ////////// Constructors and destructors /////////
00154     Bucket (const Key_T&);
00155 
00159     virtual ~Bucket();
00160 
00161   private:
00165     Bucket();
00166 
00170     Bucket (const Bucket&);
00171 
00172 
00173   protected:
00174     // //////////////////// Children ///////////////////
00178     Key_T _key;
00179 
00183     BomAbstract* _parent;
00184 
00188     HolderMap_T _holderMap;
00189 
00190 
00191   protected:
00192     // //////////////////// Attributes ///////////////////
00196     Yield_T _yieldRangeUpperValue;
00197 
00201     CabinCapacity_T _availability;
00202 
00206     NbOfSeats_T _soldSeats;
00207   };
00208 
00209 }
00210 #endif // __STDAIR_BOM_BUCKET_HPP
00211