$treeview $search $mathjax
AirInv Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

LegStruct.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <sstream>
00007 // STDAIR
00008 #include <stdair/basic/BasConst_General.hpp>
00009 #include <stdair/bom/LegDate.hpp>
00010 // AIRINV
00011 #include <airinv/bom/LegStruct.hpp>
00012 
00013 namespace AIRINV {
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   LegStruct::LegStruct ()
00017     : _boardingDate (stdair::DEFAULT_DATE), _offDate (stdair::DEFAULT_DATE) {
00018   }
00019     
00020   // //////////////////////////////////////////////////////////////////////
00021   const std::string LegStruct::describe() const {
00022     std::ostringstream ostr;
00023     ostr << "    " << _boardingPoint << " / " << _boardingDate << " "
00024          << boost::posix_time::to_simple_string(_boardingTime)
00025          << " -- " << _offPoint << " / " << _offDate << " "
00026          << boost::posix_time::to_simple_string(_offTime)
00027          << " --> "
00028          << boost::posix_time::to_simple_string(_elapsed)
00029          << std::endl;
00030     for (LegCabinStructList_T::const_iterator itCabin = _cabinList.begin();
00031          itCabin != _cabinList.end(); itCabin++) {
00032       const LegCabinStruct& lCabin = *itCabin;
00033       ostr << lCabin.describe();
00034     }
00035     ostr << std::endl;
00036     
00037     return ostr.str();
00038   }
00039 
00040   // //////////////////////////////////////////////////////////////////////
00041   void LegStruct::fill (const stdair::Date_T& iRefDate,
00042                           stdair::LegDate& ioLegDate) const {
00043     // Set the Off Point
00044     ioLegDate.setOffPoint (_offPoint);
00045     // Set the Boarding Date
00046     ioLegDate.setBoardingDate (iRefDate + _boardingDateOffset);
00047     // Set the Boarding Time
00048     ioLegDate.setBoardingTime (_boardingTime);
00049     // Set the Off Date
00050     ioLegDate.setOffDate (iRefDate + _offDateOffset);
00051     // Set the Off Time
00052     ioLegDate.setOffTime (_offTime);
00053     // Set the Elapsed Time
00054     ioLegDate.setElapsedTime (_elapsed);
00055     // Set the operating airline code
00056     ioLegDate.setOperatingAirlineCode (_airlineCode);
00057     // Set the operating flight number
00058     ioLegDate.setOperatingFlightNumber (_flightNumber);
00059   }
00060 
00061   // //////////////////////////////////////////////////////////////////////
00062   void LegStruct::fill (stdair::LegDate& ioLegDate) const {
00063     // Set the Off Point
00064     ioLegDate.setOffPoint (_offPoint);
00065     // Set the Boarding Date
00066     ioLegDate.setBoardingDate (_offDate);
00067     // Set the Boarding Time
00068     ioLegDate.setBoardingTime (_boardingTime);
00069     // Set the Off Date
00070     ioLegDate.setOffDate (_offDate);
00071     // Set the Off Time
00072     ioLegDate.setOffTime (_offTime);
00073     // Set the Elapsed Time
00074     ioLegDate.setElapsedTime (_elapsed);
00075     // Set the operating airline code
00076     ioLegDate.setOperatingAirlineCode (_airlineCode);
00077     // Set the operating flight number
00078     ioLegDate.setOperatingFlightNumber (_flightNumber);
00079   }
00080 
00081 }