AirTSP Logo  1.01.10
C++ Simulated Airline Travel Solution Provider (TSP) Library
Loading...
Searching...
No Matches
OnDPeriodStruct.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <iostream>
7// StdAir
8#include <stdair/basic/BasConst_Period_BOM.hpp>
9#include <stdair/basic/BasConst_General.hpp>
10#include <stdair/basic/BasConst_Inventory.hpp>
11#include <stdair/service/Logger.hpp>
12// AirTSP
14
15namespace AIRTSP {
16 // //////////////////////////////////////////////////////////////////////
18 : _datePeriod (stdair::BOOST_DEFAULT_DATE_PERIOD),
19 _timeRangeStart (stdair::NULL_BOOST_TIME_DURATION),
20 _timeRangeEnd (stdair::NULL_BOOST_TIME_DURATION),
21 _nbOfAirlines(stdair::DEFAULT_NBOFAIRLINES),
22 _airlineCode (stdair::DEFAULT_NULL_AIRLINE_CODE),
23 _classCode (stdair::DEFAULT_NULL_CLASS_CODE),
24 _itSeconds (0) {
25 }
26
27 // //////////////////////////////////////////////////////////////////////
28 stdair::Date_T OnDPeriodStruct::getDate() const {
29 return stdair::Date_T (_itYear, _itMonth, _itDay);
30 }
31
32 // //////////////////////////////////////////////////////////////////////
33 stdair::Duration_T OnDPeriodStruct::getTime() const {
34 return boost::posix_time::hours (_itHours)
35 + boost::posix_time::minutes (_itMinutes)
36 + boost::posix_time::seconds (_itSeconds);
37 }
38
39 // //////////////////////////////////////////////////////////////////////
40 const std::string OnDPeriodStruct::describe() const {
41 std::ostringstream ostr;
42 ostr << _origin << "-" << _destination << ", "
43 << _datePeriod << ", between "
44 << boost::posix_time::to_simple_string(_timeRangeStart)
45 << " to "
46 << boost::posix_time::to_simple_string(_timeRangeEnd) << ", "
47 << _classCode << ", "
48 << _airlineCode << ", "
49 << std::endl;
50
51 return ostr.str();
52 }
53
54 // //////////////////////////////////////////////////////////////////////
55 const std::string OnDPeriodStruct::describeTSKey() const {
56 std::ostringstream ostr;
57 ostr << _origin << "-" << _destination << ", "
58 << _airlineCode << ", " << _classCode << std::endl;
59
60 return ostr.str();
61 }
62
63 // //////////////////////////////////////////////////////////////////////
64 const stdair::AirlineCode_T& OnDPeriodStruct::getFirstAirlineCode () const {
65 assert (_airlineCodeList.size() > 0);
66 stdair::AirlineCodeList_T::const_iterator itFirstAirlineCode =
67 _airlineCodeList.begin();
68 return *itFirstAirlineCode;
69 }
70
71}
Forward declarations.
const stdair::AirlineCode_T & getFirstAirlineCode() const
stdair::ClassCode_T _classCode
stdair::AirportCode_T _destination
stdair::AirportCode_T _origin
stdair::Date_T getDate() const
const std::string describe() const
stdair::DatePeriod_T _datePeriod
stdair::Duration_T getTime() const
stdair::Duration_T _timeRangeEnd
stdair::Duration_T _timeRangeStart
const std::string describeTSKey() const
stdair::AirlineCode_T _airlineCode
stdair::AirlineCodeList_T _airlineCodeList