1.00.15
C++ Simulated Airline Inventory Management System Library
Toggle main menu visibility
Loading...
Searching...
No Matches
DCPEventStruct.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
#include <vector>
8
// StdAir
9
#include <stdair/basic/BasConst_General.hpp>
10
#include <stdair/service/Logger.hpp>
11
// AirInv
12
#include <
airinv/AIRINV_Types.hpp
>
13
#include <
airinv/bom/DCPEventStruct.hpp
>
14
15
namespace
AIRINV
{
16
17
// ////////////////////////////////////////////////////////////////////
18
DCPEventStruct::DCPEventStruct
()
19
:
_origin
(
""
),
20
_destination
(
""
),
21
_dateRangeStart
(
stdair
::DEFAULT_DATE),
22
_dateRangeEnd
(
stdair
::DEFAULT_DATE),
23
_timeRangeStart
(
stdair
::DEFAULT_EPSILON_DURATION),
24
_timeRangeEnd
(
stdair
::DEFAULT_EPSILON_DURATION),
25
_cabinCode
(
""
),
26
_pos
(
""
),
27
_advancePurchase
(0),
28
_saturdayStay
(
"T"
),
29
_changeFees
(
"T"
),
30
_nonRefundable
(
"T"
),
31
_minimumStay
(0),
32
_DCP
(0),
33
_airlineCode
(
""
),
34
_classCode
(
""
) {
35
}
36
37
// ////////////////////////////////////////////////////////////////////
38
stdair::Date_T
DCPEventStruct::getDate
()
const
{
39
_itYear
.check();
_itMonth
.check();
_itDay
.check();
40
return
stdair::Date_T (
_itYear
._value,
_itMonth
._value,
_itDay
._value);
41
}
42
43
// ////////////////////////////////////////////////////////////////////
44
stdair::Duration_T
DCPEventStruct::getTime
()
const
{
45
_itHours
.check();
_itMinutes
.check();
_itSeconds
.check();
46
return
boost::posix_time::hours (
_itHours
._value)
47
+ boost::posix_time::minutes (
_itMinutes
._value)
48
+ boost::posix_time::seconds (
_itSeconds
._value);
49
}
50
51
52
// ////////////////////////////////////////////////////////////////////
53
const
std::string
DCPEventStruct::describe
()
const
{
54
std::ostringstream ostr;
55
ostr <<
"DCPEvent: "
56
<<
_origin
<<
"-"
<<
_destination
57
<<
", POS("
<<
_pos
<<
"), ["
58
<<
_dateRangeStart
<<
"/"
<<
_dateRangeEnd
<<
"] - ["
59
<< boost::posix_time::to_simple_string(
_timeRangeStart
) <<
"/"
60
<< boost::posix_time::to_simple_string(
_timeRangeEnd
) <<
"]\n "
61
<<
"-Cabin code- "
<<
_cabinCode
<<
"\n "
62
<<
"-Channel- "
<<
_channel
<<
"\n "
63
<<
"-Conditions- "
<<
_saturdayStay
<<
", "
<<
_changeFees
<<
", "
64
<<
_nonRefundable
<<
", "
<<
_advancePurchase
<<
", "
65
<<
_minimumStay
<<
"\n "
66
<<
"-DCP- "
<<
_DCP
<<
"\n "
;
67
assert (
_airlineCodeList
.size() ==
_classCodeList
.size());
68
stdair::ClassList_StringList_T::const_iterator lItCurrentClassCode =
69
_classCodeList
.begin();
70
stdair::AirlineCode_T lAirlineCode;
71
std::string lClassCode;
72
for
(stdair::AirlineCodeList_T::const_iterator lItCurrentAirlineCode =
73
_airlineCodeList
.begin();
74
lItCurrentAirlineCode !=
_airlineCodeList
.end();
75
lItCurrentAirlineCode++) {
76
lAirlineCode = *lItCurrentAirlineCode;
77
lClassCode = *lItCurrentClassCode;
78
ostr << lAirlineCode <<
", "
<< lClassCode;
79
ostr <<
" "
;
80
lItCurrentClassCode++;
81
}
82
ostr << std::endl;
83
return
ostr.str();
84
}
85
86
// //////////////////////////////////////////////////////////////////////
87
const
stdair::AirlineCode_T&
DCPEventStruct::getFirstAirlineCode
()
const
{
88
assert (
_airlineCodeList
.size() > 0);
89
stdair::AirlineCodeList_T::const_iterator itFirstAirlineCode =
90
_airlineCodeList
.begin();
91
return
*itFirstAirlineCode;
92
}
93
94
// //////////////////////////////////////////////////////////////////////
95
void
DCPEventStruct::beginAirline
() {
96
_itCurrentAirlineCode
=
_airlineCodeList
.begin();
97
}
98
99
// //////////////////////////////////////////////////////////////////////
100
bool
DCPEventStruct::hasNotReachedEndAirline
()
const
{
101
bool
result = (
_itCurrentAirlineCode
!=
_airlineCodeList
.end());
102
return
result;
103
}
104
105
// //////////////////////////////////////////////////////////////////////
106
stdair::AirlineCode_T
DCPEventStruct::getCurrentAirlineCode
()
const
{
107
assert (
_itCurrentAirlineCode
!=
_airlineCodeList
.end());
108
return
(*
_itCurrentAirlineCode
);
109
}
110
111
// //////////////////////////////////////////////////////////////////////
112
void
DCPEventStruct::iterateAirline
() {
113
if
(
_itCurrentAirlineCode
!=
_classCodeList
.end()) {
114
_itCurrentAirlineCode
++;
115
}
116
}
117
118
// //////////////////////////////////////////////////////////////////////
119
const
std::string&
DCPEventStruct::getFirstClassCode
()
const
{
120
assert (
_classCodeList
.size() > 0);
121
stdair::ClassList_StringList_T::const_iterator itFirstClassCode =
122
_classCodeList
.begin();
123
return
*itFirstClassCode;
124
}
125
126
// //////////////////////////////////////////////////////////////////////
127
void
DCPEventStruct::beginClassCode
() {
128
_itCurrentClassCode
=
_classCodeList
.begin();
129
}
130
131
// //////////////////////////////////////////////////////////////////////
132
bool
DCPEventStruct::hasNotReachedEndClassCode
()
const
{
133
bool
result = (
_itCurrentClassCode
!=
_classCodeList
.end());
134
return
result;
135
}
136
137
// //////////////////////////////////////////////////////////////////////
138
std::string
DCPEventStruct::getCurrentClassCode
()
const
{
139
assert (
_itCurrentClassCode
!=
_classCodeList
.end());
140
return
(*
_itCurrentClassCode
);
141
}
142
143
144
// //////////////////////////////////////////////////////////////////////
145
void
DCPEventStruct::iterateClassCode
() {
146
if
(
_itCurrentClassCode
!=
_classCodeList
.end()) {
147
_itCurrentClassCode
++;
148
}
149
}
150
151
}
152
AIRINV_Types.hpp
DCPEventStruct.hpp
AIRINV
Definition
AIRINV_Master_Service.hpp:38
stdair
Forward declarations.
Definition
AIRINV_Master_Service.hpp:25
AIRINV::DCPEventStruct::beginClassCode
void beginClassCode()
Definition
DCPEventStruct.cpp:127
AIRINV::DCPEventStruct::_advancePurchase
stdair::DayDuration_T _advancePurchase
Definition
DCPEventStruct.hpp:131
AIRINV::DCPEventStruct::_timeRangeStart
stdair::Duration_T _timeRangeStart
Definition
DCPEventStruct.hpp:116
AIRINV::DCPEventStruct::getTime
stdair::Duration_T getTime() const
Definition
DCPEventStruct.cpp:44
AIRINV::DCPEventStruct::_airlineCode
stdair::AirlineCode_T _airlineCode
Definition
DCPEventStruct.hpp:149
AIRINV::DCPEventStruct::_itCurrentClassCode
stdair::ClassList_StringList_T::iterator _itCurrentClassCode
Definition
DCPEventStruct.hpp:101
AIRINV::DCPEventStruct::_itMinutes
stdair::minute_t _itMinutes
Definition
DCPEventStruct.hpp:94
AIRINV::DCPEventStruct::hasNotReachedEndAirline
bool hasNotReachedEndAirline() const
Definition
DCPEventStruct.cpp:100
AIRINV::DCPEventStruct::iterateClassCode
void iterateClassCode()
Definition
DCPEventStruct.cpp:145
AIRINV::DCPEventStruct::_saturdayStay
stdair::SaturdayStay_T _saturdayStay
Definition
DCPEventStruct.hpp:134
AIRINV::DCPEventStruct::_changeFees
stdair::ChangeFees_T _changeFees
Definition
DCPEventStruct.hpp:137
AIRINV::DCPEventStruct::_nonRefundable
stdair::NonRefundable_T _nonRefundable
Definition
DCPEventStruct.hpp:140
AIRINV::DCPEventStruct::beginAirline
void beginAirline()
Definition
DCPEventStruct.cpp:95
AIRINV::DCPEventStruct::DCPEventStruct
DCPEventStruct()
Definition
DCPEventStruct.cpp:18
AIRINV::DCPEventStruct::getDate
stdair::Date_T getDate() const
Definition
DCPEventStruct.cpp:38
AIRINV::DCPEventStruct::_pos
stdair::CityCode_T _pos
Definition
DCPEventStruct.hpp:125
AIRINV::DCPEventStruct::_itYear
stdair::year_t _itYear
Definition
DCPEventStruct.hpp:87
AIRINV::DCPEventStruct::_itDay
stdair::day_t _itDay
Definition
DCPEventStruct.hpp:89
AIRINV::DCPEventStruct::hasNotReachedEndClassCode
bool hasNotReachedEndClassCode() const
Definition
DCPEventStruct.cpp:132
AIRINV::DCPEventStruct::_DCP
stdair::PriceValue_T _DCP
Definition
DCPEventStruct.hpp:146
AIRINV::DCPEventStruct::_channel
stdair::ChannelLabel_T _channel
Definition
DCPEventStruct.hpp:128
AIRINV::DCPEventStruct::getCurrentAirlineCode
stdair::AirlineCode_T getCurrentAirlineCode() const
Definition
DCPEventStruct.cpp:106
AIRINV::DCPEventStruct::_destination
stdair::AirportCode_T _destination
Definition
DCPEventStruct.hpp:107
AIRINV::DCPEventStruct::_classCodeList
stdair::ClassList_StringList_T _classCodeList
Definition
DCPEventStruct.hpp:161
AIRINV::DCPEventStruct::_airlineCodeList
stdair::AirlineCodeList_T _airlineCodeList
Definition
DCPEventStruct.hpp:155
AIRINV::DCPEventStruct::getCurrentClassCode
std::string getCurrentClassCode() const
Definition
DCPEventStruct.cpp:138
AIRINV::DCPEventStruct::_dateRangeEnd
stdair::Date_T _dateRangeEnd
Definition
DCPEventStruct.hpp:113
AIRINV::DCPEventStruct::iterateAirline
void iterateAirline()
Definition
DCPEventStruct.cpp:112
AIRINV::DCPEventStruct::_timeRangeEnd
stdair::Duration_T _timeRangeEnd
Definition
DCPEventStruct.hpp:119
AIRINV::DCPEventStruct::_itMonth
stdair::month_t _itMonth
Definition
DCPEventStruct.hpp:88
AIRINV::DCPEventStruct::_dateRangeStart
stdair::Date_T _dateRangeStart
Definition
DCPEventStruct.hpp:110
AIRINV::DCPEventStruct::getFirstAirlineCode
const stdair::AirlineCode_T & getFirstAirlineCode() const
Definition
DCPEventStruct.cpp:87
AIRINV::DCPEventStruct::describe
const std::string describe() const
Definition
DCPEventStruct.cpp:53
AIRINV::DCPEventStruct::_classCode
stdair::ClassCode_T _classCode
Definition
DCPEventStruct.hpp:152
AIRINV::DCPEventStruct::_minimumStay
stdair::DayDuration_T _minimumStay
Definition
DCPEventStruct.hpp:143
AIRINV::DCPEventStruct::_cabinCode
stdair::CabinCode_T _cabinCode
Definition
DCPEventStruct.hpp:122
AIRINV::DCPEventStruct::_itCurrentAirlineCode
stdair::AirlineCodeList_T::iterator _itCurrentAirlineCode
Definition
DCPEventStruct.hpp:98
AIRINV::DCPEventStruct::_itSeconds
stdair::second_t _itSeconds
Definition
DCPEventStruct.hpp:95
AIRINV::DCPEventStruct::getFirstClassCode
const std::string & getFirstClassCode() const
Definition
DCPEventStruct.cpp:119
AIRINV::DCPEventStruct::_itHours
stdair::hour_t _itHours
Definition
DCPEventStruct.hpp:93
AIRINV::DCPEventStruct::_origin
stdair::AirportCode_T _origin
Definition
DCPEventStruct.hpp:104
Generated on
for AirInv by
1.17.0