AirTSP Logo  1.01.10
C++ Simulated Airline Travel Solution Provider (TSP) Library
Loading...
Searching...
No Matches
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
12
13namespace 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}
Forward declarations.
const std::string describe() const
stdair::Duration_T _boardingTime
Definition LegStruct.hpp:30
stdair::DateOffset_T _boardingDateOffset
Definition LegStruct.hpp:29
stdair::AirportCode_T _boardingPoint
Definition LegStruct.hpp:28
const std::string describe() const
Definition LegStruct.cpp:22
stdair::AirportCode_T _offPoint
Definition LegStruct.hpp:31
void fill(const stdair::Date_T &iRefDate, stdair::LegDate &) const
Definition LegStruct.cpp:48
stdair::DateOffset_T _offDateOffset
Definition LegStruct.hpp:32
stdair::Duration_T _elapsed
Definition LegStruct.hpp:34
LegCabinStructList_T _cabinList
Definition LegStruct.hpp:35
stdair::Duration_T _offTime
Definition LegStruct.hpp:33
stdair::FlightNumber_T _flightNumber
Definition LegStruct.hpp:27
stdair::AirlineCode_T _airlineCode
Definition LegStruct.hpp:26