StdAir Logo  0.45.1
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
BookingClass.hpp
Go to the documentation of this file.
00001 #ifndef __STDAIR_BOM_BOOKINGCLASS_HPP
00002 #define __STDAIR_BOM_BOOKINGCLASS_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/stdair_maths_types.hpp>
00013 #include <stdair/stdair_rm_types.hpp>
00014 #include <stdair/bom/BomAbstract.hpp>
00015 #include <stdair/bom/BookingClassKey.hpp>
00016 #include <stdair/bom/BookingClassTypes.hpp>
00017 
00018 namespace stdair {
00019 
00024   class BookingClass : public BomAbstract {
00025     template <typename BOM> friend class FacBom;
00026     friend class FacBomManager;
00027 
00028   public:
00029     // ////////// Type definitions ////////////
00031     typedef BookingClassKey Key_T;
00032 
00033   public:
00034     // /////////// Getters ////////////
00036     const Key_T& getKey() const {
00037       return _key;
00038     }
00039     
00041     const ClassCode_T& getClassCode() const {
00042       return _key.getClassCode();
00043     }
00044 
00046     BomAbstract* const getParent() const {
00047       return _parent;
00048     }
00049 
00051     const HolderMap_T& getHolderMap() const {
00052       return _holderMap;
00053     }
00054 
00056     const SubclassCode_T& getSubclassCode() const {
00057       return _subclassCode;
00058     }
00059 
00061     const AuthorizationLevel_T& getAuthorizationLevel() const {
00062       return _au;
00063     }
00064 
00066     const ProtectionLevel_T& getProtection() const {
00067       return _protection;
00068     }
00069 
00071     const ProtectionLevel_T& getCumulatedProtection() const {
00072       return _cumulatedProtection;
00073     }
00074 
00076     const BookingLimit_T& getCumulatedBookingLimit() const {
00077       return _cumulatedBookingLimit;
00078     }
00079 
00081     const NbOfSeats_T& getNegotiatedSpace() const {
00082       return _nego;
00083     }
00084 
00086     const OverbookingRate_T& getNoShowPercentage() const {
00087       return _noShowPercentage;
00088     }
00089 
00091     const OverbookingRate_T& getCancellationPercentage() const {
00092       return _cancellationPercentage;
00093     }
00094 
00096     const NbOfBookings_T& getNbOfBookings() const {
00097       return _nbOfBookings;
00098     }
00099 
00101     const NbOfBookings_T& getNbOfGroupBookings() const {
00102       return _groupNbOfBookings;
00103     }
00104 
00106     const NbOfBookings_T& getNbOfPendingGroupBookings() const {
00107       return _groupPendingNbOfBookings;
00108     }
00109 
00111     const NbOfBookings_T& getNbOfStaffBookings() const {
00112       return _staffNbOfBookings;
00113     }
00114 
00116     const NbOfBookings_T& getNbOfWLBookings() const {
00117       return _wlNbOfBookings;
00118     }
00119 
00121     const NbOfCancellations_T& getNbOfCancellations() const {
00122       return _nbOfCancellations;
00123     }
00124 
00126     const NbOfBookings_T& getETB() const {
00127       return _etb;
00128     }
00129 
00131     const Availability_T& getNetClassAvailability() const {
00132       return _netClassAvailability;
00133     }
00134 
00136     const Availability_T& getSegmentAvailability() const {
00137       return _segmentAvailability;
00138     }
00139 
00141     const Availability_T& getNetRevenueAvailability() const {
00142       return _netRevenueAvailability;
00143     }
00144 
00146     const Yield_T& getYield () const { return _yield; }
00147     
00149     const MeanValue_T& getMean () const { return _mean; }
00150     const StdDevValue_T& getStdDev () const {return _stdDev; }
00151 
00153     const GeneratedDemandVector_T& getGeneratedDemandVector () const {
00154       return _generatedDemandVector;
00155     }
00156   
00157   public:
00158     // /////////// Setters ////////////
00160     void setCumulatedProtection (const ProtectionLevel_T& iPL) {
00161       _cumulatedProtection = iPL;
00162     }
00163 
00165     void setProtection (const ProtectionLevel_T& iPL) {
00166       _protection = iPL;
00167     }
00168     
00170     void setCumulatedBookingLimit (const BookingLimit_T& iBL) {
00171       _cumulatedBookingLimit = iBL;
00172     }
00173 
00175     void setAuthorizationLevel (const AuthorizationLevel_T& iAU) {
00176       _au = iAU;
00177     }
00178 
00180     void setSegmentAvailability (const Availability_T& iAvl) {
00181       _segmentAvailability = iAvl;
00182     }
00183 
00185     void setYield (const Yield_T& iYield) { _yield = iYield; }
00186     
00188     void setMean (const MeanValue_T& iMean) { _mean = iMean; }
00189     void setStdDev (const StdDevValue_T& iStdDev) { _stdDev = iStdDev; }
00190 
00191   public:
00192     // /////////// Display support methods /////////
00195     void toStream (std::ostream& ioOut) const {
00196       ioOut << toString();
00197     }
00198 
00201     void fromStream (std::istream& ioIn) {
00202     }
00203 
00205     std::string toString() const;
00206     
00208     const std::string describeKey() const {
00209       return _key.toString();
00210     }
00211 
00212   public:
00213     // ////////////// Business Methods /////////////////
00215     void sell (const NbOfBookings_T&);
00216     
00218     void cancel (const NbOfBookings_T&);
00219 
00222     void generateDemandSamples (const int&);
00223 
00226     void generateDemandSamples (const int&, const RandomSeed_T&);
00227 
00228   protected:
00229     // ////////// Constructors and destructors /////////
00231     BookingClass (const Key_T&);
00233     virtual ~BookingClass();
00234 
00235   private:
00237     BookingClass();
00239     BookingClass (const BookingClass&);
00240 
00241 
00242   protected:
00243     // ////////// Attributes /////////
00245     Key_T _key;
00246 
00248     BomAbstract* _parent;
00249 
00251     HolderMap_T _holderMap;
00252 
00254     SubclassCode_T _subclassCode;
00255 
00257     ProtectionLevel_T _cumulatedProtection;
00258 
00260     ProtectionLevel_T _protection;
00261 
00263     BookingLimit_T _cumulatedBookingLimit;
00264 
00266     AuthorizationLevel_T _au;
00267 
00269     NbOfSeats_T _nego;
00270 
00272     OverbookingRate_T _noShowPercentage;
00273 
00275     OverbookingRate_T _cancellationPercentage;
00276 
00278     NbOfBookings_T _nbOfBookings;
00279 
00281     NbOfBookings_T _groupNbOfBookings;
00282 
00284     NbOfBookings_T _groupPendingNbOfBookings;
00285 
00287     NbOfBookings_T _staffNbOfBookings;
00288 
00290     NbOfBookings_T _wlNbOfBookings;
00291 
00293     NbOfCancellations_T _nbOfCancellations;
00294 
00296     NbOfBookings_T _etb;
00297 
00299     Availability_T _netClassAvailability;
00300 
00302     Availability_T _segmentAvailability;
00303 
00305     Availability_T _netRevenueAvailability;
00306 
00308     Yield_T _yield;
00309 
00311     MeanValue_T _mean;
00312     StdDevValue_T _stdDev;
00313 
00315     GeneratedDemandVector_T _generatedDemandVector;
00316   };
00317 
00318 }
00319 #endif // __STDAIR_BOM_BOOKINGCLASS_HPP