RMOL Logo  0.25.3
C++ library of Revenue Management and Optimisation classes and functions
HistoricalBooking.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <sstream>
00006 #include <cassert>
00007 #include <iomanip>
00008 #include <iostream>
00009 // RMOL
00010 #include <rmol/bom/HistoricalBooking.hpp>
00011 
00012 namespace RMOL {
00013     
00014   // ////////////////////////////////////////////////////////////////////
00015   HistoricalBooking::HistoricalBooking () : 
00016     _numberOfBookings (0.0),_unconstrainedDemand (0.0), _flag (false) {
00017   }
00018 
00019   // ////////////////////////////////////////////////////////////////////
00020   HistoricalBooking::
00021   HistoricalBooking (const stdair::NbOfBookings_T iNbOfBookings,
00022                      const stdair::Flag_T iFlag)
00023     : _numberOfBookings (iNbOfBookings),
00024       _unconstrainedDemand (iNbOfBookings), _flag (iFlag) {
00025   }
00026     
00027   // ////////////////////////////////////////////////////////////////////
00028   HistoricalBooking::HistoricalBooking 
00029   (const HistoricalBooking& iHistoricalBooking) :
00030     _numberOfBookings (iHistoricalBooking.getNbOfBookings()), 
00031     _unconstrainedDemand (iHistoricalBooking.getUnconstrainedDemand()),
00032     _flag (iHistoricalBooking.getFlag()) {
00033   }
00034     
00035   // ////////////////////////////////////////////////////////////////////
00036   HistoricalBooking::~HistoricalBooking() {
00037   }
00038 
00039   // ////////////////////////////////////////////////////////////////////
00040   void HistoricalBooking::setParameters
00041   (const stdair::NbOfBookings_T iNbOfBookings, const stdair::Flag_T iFlag) {
00042     _numberOfBookings = iNbOfBookings;
00043     _unconstrainedDemand = iNbOfBookings;
00044     _flag = iFlag;
00045   }
00046 
00047   // ////////////////////////////////////////////////////////////////////
00048   const std::string HistoricalBooking::describe() const {
00049     std::ostringstream ostr;
00050     ostr << "Struct of hitorical booking, unconstrained demand and flag of "
00051          << "censorship for a FlightDate/Class.";
00052      
00053     return ostr.str();
00054   }
00055     
00056   // ////////////////////////////////////////////////////////////////////
00057   void HistoricalBooking::toStream (std::ostream& ioOut) const {
00058     const stdair::NbOfBookings_T bj = getNbOfBookings();
00059     const stdair::NbOfBookings_T uj = getUnconstrainedDemand();
00060     const stdair::Flag_T fj = getFlag();
00061     ioOut << std::fixed << std::setprecision (2)
00062           << bj << "; " << uj << "; " << fj << std::endl;
00063   }
00064     
00065   // ////////////////////////////////////////////////////////////////////
00066   void HistoricalBooking::display () const {
00067     toStream (std::cout);
00068   }
00069 }