AirInv Logo  0.1.2
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  }
56 
57  // //////////////////////////////////////////////////////////////////////
58  void LegStruct::fill (stdair::LegDate& ioLegDate) const {
59  // Set the Off Point
60  ioLegDate.setOffPoint (_offPoint);
61  // Set the Boarding Date
62  ioLegDate.setBoardingDate (_offDate);
63  // Set the Boarding Time
64  ioLegDate.setBoardingTime (_boardingTime);
65  // Set the Off Date
66  ioLegDate.setOffDate (_offDate);
67  // Set the Off Time
68  ioLegDate.setOffTime (_offTime);
69  // Set the Elapsed Time
70  ioLegDate.setElapsedTime (_elapsed);
71  }
72 
73 }