StdAir Logo  0.43.0
C++ Standard Airline IT 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 serialisationImplementation();
00146 
00147 
00148   protected:
00149     // ////////// Constructors and destructors /////////
00153     Bucket (const Key_T&);
00154 
00158     virtual ~Bucket();
00159 
00160   private:
00164     Bucket();
00165 
00169     Bucket (const Bucket&);
00170 
00171 
00172   protected:
00173     // //////////////////// Children ///////////////////
00177     Key_T _key;
00178 
00182     BomAbstract* _parent;
00183 
00187     HolderMap_T _holderMap;
00188 
00189 
00190   protected:
00191     // //////////////////// Attributes ///////////////////
00195     Yield_T _yieldRangeUpperValue;
00196 
00200     CabinCapacity_T _availability;
00201 
00205     NbOfSeats_T _soldSeats;
00206   };
00207 
00208 }
00209 #endif // __STDAIR_BOM_BUCKET_HPP
00210