AirTSP Logo  1.01.0
C++ Simulated Airline Travel Solution Provider 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_Period_BOM.hpp>
9 #include <stdair/bom/LegDate.hpp>
10 // AirTSP
11 #include <airtsp/bom/LegStruct.hpp>
12 
13 namespace AIRTSP {
14 
15  // //////////////////////////////////////////////////////////////////////
17  : _boardingDateOffset (stdair::DEFAULT_DATE_OFFSET),
18  _offDateOffset (stdair::DEFAULT_DATE_OFFSET) {
19  }
20 
21  // //////////////////////////////////////////////////////////////////////
22  const std::string LegStruct::describe() const {
23  std::ostringstream ostr;
24  ostr << " " << _boardingPoint << " / "
25  << boost::posix_time::to_simple_string(_boardingTime);
26  if (_boardingDateOffset.days() != 0) {
27  ostr << " [" << _boardingDateOffset.days() << "]";
28  }
29  ostr << " -- " << _offPoint << " / "
30  << boost::posix_time::to_simple_string(_offTime);
31  if (_offDateOffset.days() != 0) {
32  ostr << " [" << _offDateOffset.days() << "]";
33  }
34  ostr << " --> "
35  << boost::posix_time::to_simple_string(_elapsed)
36  << std::endl;
37  for (LegCabinStructList_T::const_iterator itCabin = _cabinList.begin();
38  itCabin != _cabinList.end(); itCabin++) {
39  const LegCabinStruct& lCabin = *itCabin;
40  ostr << lCabin.describe();
41  }
42  ostr << std::endl;
43 
44  return ostr.str();
45  }
46 
47  // //////////////////////////////////////////////////////////////////////
48  void LegStruct::fill (const stdair::Date_T& iRefDate,
49  stdair::LegDate& ioLegDate) const {
50  // Set the Off Point
51  ioLegDate.setOffPoint (_offPoint);
52 
53  // Set the Boarding Date
54  ioLegDate.setBoardingDate (iRefDate + _boardingDateOffset);
55 
56  // Set the Boarding Time
57  ioLegDate.setBoardingTime (_boardingTime);
58 
59  // Set the Off Date
60  ioLegDate.setOffDate (iRefDate + _offDateOffset);
61 
62  // Set the Off Time
63  ioLegDate.setOffTime (_offTime);
64 
65  // Set the Elapsed Time
66  ioLegDate.setElapsedTime (_elapsed);
67 
68  // Set the operating airline code
69  ioLegDate.setOperatingAirlineCode (_airlineCode);
70 
71  // Set the operating flight number
72  ioLegDate.setOperatingFlightNumber (_flightNumber);
73 
74  }
75 
76 }