AirInv Logo  1.00.0
C++ Simulated Airline Inventory Management System library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LegStruct.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // STDAIR
8 #include <stdair/basic/BasConst_General.hpp>
9 #include <stdair/bom/LegDate.hpp>
10 // AIRINV
11 #include <airinv/bom/LegStruct.hpp>
12 
13 namespace AIRINV {
14 
15  // //////////////////////////////////////////////////////////////////////
17  : _boardingDate (stdair::DEFAULT_DATE), _offDate (stdair::DEFAULT_DATE) {
18  }
19 
20  // //////////////////////////////////////////////////////////////////////
21  const std::string LegStruct::describe() const {
22  std::ostringstream ostr;
23  ostr << " " << _boardingPoint << " / " << _boardingDate << " "
24  << boost::posix_time::to_simple_string(_boardingTime)
25  << " -- " << _offPoint << " / " << _offDate << " "
26  << boost::posix_time::to_simple_string(_offTime)
27  << " --> "
28  << boost::posix_time::to_simple_string(_elapsed)
29  << std::endl;
30  for (LegCabinStructList_T::const_iterator itCabin = _cabinList.begin();
31  itCabin != _cabinList.end(); itCabin++) {
32  const LegCabinStruct& lCabin = *itCabin;
33  ostr << lCabin.describe();
34  }
35  ostr << std::endl;
36 
37  return ostr.str();
38  }
39 
40  // //////////////////////////////////////////////////////////////////////
41  void LegStruct::fill (const stdair::Date_T& iRefDate,
42  stdair::LegDate& ioLegDate) const {
43  // Set the Off Point
44  ioLegDate.setOffPoint (_offPoint);
45  // Set the Boarding Date
46  ioLegDate.setBoardingDate (iRefDate + _boardingDateOffset);
47  // Set the Boarding Time
48  ioLegDate.setBoardingTime (_boardingTime);
49  // Set the Off Date
50  ioLegDate.setOffDate (iRefDate + _offDateOffset);
51  // Set the Off Time
52  ioLegDate.setOffTime (_offTime);
53  // Set the Elapsed Time
54  ioLegDate.setElapsedTime (_elapsed);
55  // Set the operating airline code
56  ioLegDate.setOperatingAirlineCode (_airlineCode);
57  // Set the operating flight number
58  ioLegDate.setOperatingFlightNumber (_flightNumber);
59  }
60 
61  // //////////////////////////////////////////////////////////////////////
62  void LegStruct::fill (stdair::LegDate& ioLegDate) const {
63  // Set the Off Point
64  ioLegDate.setOffPoint (_offPoint);
65  // Set the Boarding Date
66  ioLegDate.setBoardingDate (_offDate);
67  // Set the Boarding Time
68  ioLegDate.setBoardingTime (_boardingTime);
69  // Set the Off Date
70  ioLegDate.setOffDate (_offDate);
71  // Set the Off Time
72  ioLegDate.setOffTime (_offTime);
73  // Set the Elapsed Time
74  ioLegDate.setElapsedTime (_elapsed);
75  // Set the operating airline code
76  ioLegDate.setOperatingAirlineCode (_airlineCode);
77  // Set the operating flight number
78  ioLegDate.setOperatingFlightNumber (_flightNumber);
79  }
80 
81 }