1.00.13
C++ Simulated Fare Quote System Library
Toggle main menu visibility
Loading...
Searching...
No Matches
FareRuleStruct.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
// SIMFQT
12
#include <
simfqt/bom/FareRuleStruct.hpp
>
13
14
namespace
SIMFQT
{
15
16
// ////////////////////////////////////////////////////////////////////
17
FareRuleStruct::FareRuleStruct
()
18
:_fareId(0),
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
_fare(0),
33
_airlineCode(
""
),
34
_classCode(
""
) {
35
36
}
37
38
// ////////////////////////////////////////////////////////////////////
39
stdair::Date_T
FareRuleStruct::calculateDate
()
const
{
40
_itYear
.check();
_itMonth
.check();
_itDay
.check();
41
return
stdair::Date_T (
_itYear
._value,
_itMonth
._value,
_itDay
._value);
42
}
43
44
// ////////////////////////////////////////////////////////////////////
45
stdair::Duration_T
FareRuleStruct::calculateTime
()
const
{
46
_itHours
.check();
_itMinutes
.check();
_itSeconds
.check();
47
return
boost::posix_time::hours (
_itHours
._value)
48
+ boost::posix_time::minutes (
_itMinutes
._value)
49
+ boost::posix_time::seconds (
_itSeconds
._value);
50
}
51
52
53
// ////////////////////////////////////////////////////////////////////
54
const
std::string
FareRuleStruct::describe
()
const
{
55
56
std::ostringstream oStr;
57
oStr <<
"FareRule: "
<< _fareId <<
", "
;
58
59
oStr << _origin <<
"-"
<< _destination <<
" ("
60
<< _pos <<
"), "
<< _channel <<
", ["
;
61
oStr << _dateRangeStart <<
"/"
<< _dateRangeEnd <<
"] - ["
62
<< boost::posix_time::to_simple_string (_timeRangeStart) <<
"/"
63
<< boost::posix_time::to_simple_string (_timeRangeEnd) <<
"], "
;
64
65
oStr << _cabinCode <<
", "
<< _fare <<
" EUR, "
;
66
oStr << _tripType <<
", "
<< _saturdayStay <<
", "
67
<< _changeFees <<
", "
<< _nonRefundable <<
", "
68
<< _advancePurchase <<
", "
<< _minimumStay <<
", "
;
69
70
// Sanity check
71
assert (_airlineCodeList.size() == _classCodeList.size());
72
73
// Browse the airline and class pathes
74
unsigned
short
idx = 0;
75
stdair::ClassList_StringList_T::const_iterator itClass =
76
_classCodeList.begin();
77
for
(stdair::AirlineCodeList_T::const_iterator itAirline =
78
_airlineCodeList.begin();
79
itAirline != _airlineCodeList.end(); ++itAirline, ++itClass, ++idx) {
80
if
(idx != 0) {
81
oStr <<
" - "
;
82
}
83
const
stdair::AirlineCode_T lAirlineCode = *itAirline;
84
const
stdair::ClassCode_T lClassCode = *itClass;
85
oStr << lAirlineCode <<
" / "
<< lClassCode;
86
}
87
88
return
oStr.str();
89
}
90
91
}
92
FareRuleStruct.hpp
SIMFQT
Definition
BasConst.cpp:7
stdair
Forward declarations.
Definition
FareParser.hpp:16
SIMFQT::FareRuleStruct::describe
const std::string describe() const
Definition
FareRuleStruct.cpp:54
SIMFQT::FareRuleStruct::calculateDate
stdair::Date_T calculateDate() const
Definition
FareRuleStruct.cpp:39
SIMFQT::FareRuleStruct::_itMonth
stdair::month_t _itMonth
Definition
FareRuleStruct.hpp:276
SIMFQT::FareRuleStruct::_itYear
stdair::year_t _itYear
Definition
FareRuleStruct.hpp:275
SIMFQT::FareRuleStruct::calculateTime
stdair::Duration_T calculateTime() const
Definition
FareRuleStruct.cpp:45
SIMFQT::FareRuleStruct::_itDay
stdair::day_t _itDay
Definition
FareRuleStruct.hpp:277
SIMFQT::FareRuleStruct::_itSeconds
stdair::second_t _itSeconds
Definition
FareRuleStruct.hpp:282
SIMFQT::FareRuleStruct::_itHours
stdair::hour_t _itHours
Definition
FareRuleStruct.hpp:280
SIMFQT::FareRuleStruct::_itMinutes
stdair::minute_t _itMinutes
Definition
FareRuleStruct.hpp:281
SIMFQT::FareRuleStruct::FareRuleStruct
FareRuleStruct()
Definition
FareRuleStruct.cpp:17
Generated on
for SimFQT by
1.17.0