8 #include <boost/date_time/gregorian/formatters.hpp>
9 #include <boost/date_time/posix_time/posix_time.hpp>
18 BookingRequestStruct::BookingRequestStruct()
32 _changeFees (false), _changeFeeDisutility (0.0),
33 _nonRefundable (false), _nonRefundableDisutility (0.0) {
38 BookingRequestStruct::
40 : _generatorKey (iBookingRequest._generatorKey),
41 _origin (iBookingRequest._origin),
42 _destination (iBookingRequest._destination),
43 _pos (iBookingRequest._pos),
44 _preferredDepartureDate (iBookingRequest._preferredDepartureDate),
45 _preferredDepartureTime (iBookingRequest._preferredDepartureTime),
46 _requestDateTime (iBookingRequest._requestDateTime),
47 _preferredCabin (iBookingRequest._preferredCabin),
48 _partySize (iBookingRequest._partySize),
49 _channel (iBookingRequest._channel),
50 _tripType (iBookingRequest._tripType),
51 _stayDuration (iBookingRequest._stayDuration),
52 _frequentFlyerType (iBookingRequest._frequentFlyerType),
53 _wtp (iBookingRequest._wtp),
54 _valueOfTime (iBookingRequest._valueOfTime),
55 _changeFees (iBookingRequest._changeFees),
56 _changeFeeDisutility (iBookingRequest._changeFeeDisutility),
57 _nonRefundable (iBookingRequest._nonRefundable),
58 _nonRefundableDisutility (iBookingRequest._nonRefundableDisutility) {
62 BookingRequestStruct::
67 const Date_T& iDepartureDate,
82 : _generatorKey (iGeneratorKey), _origin (iOrigin),
83 _destination (iDestination), _pos (iPOS),
84 _preferredDepartureDate (iDepartureDate),
85 _preferredDepartureTime (iPreferredDepartureTime),
86 _requestDateTime (iRequestDateTime),
87 _preferredCabin (iPreferredCabin), _partySize (iPartySize),
88 _channel (iChannel), _tripType (iTripType),
89 _stayDuration (iStayDuration), _frequentFlyerType (iFrequentFlyerType),
90 _wtp (iWTP), _valueOfTime (iValueOfTime),
91 _changeFees (iChangeFees), _changeFeeDisutility (iChangeFeeDisutility),
92 _nonRefundable (iNonRefundable),
93 _nonRefundableDisutility (iNonRefundableDisutility) {
97 BookingRequestStruct::
101 const Date_T& iDepartureDate,
116 : _generatorKey (
""), _origin (iOrigin),
117 _destination (iDestination), _pos (iPOS),
118 _preferredDepartureDate (iDepartureDate),
119 _preferredDepartureTime (iPreferredDepartureTime),
120 _requestDateTime (iRequestDateTime),
121 _preferredCabin (iPreferredCabin), _partySize (iPartySize),
122 _channel (iChannel), _tripType (iTripType),
123 _stayDuration (iStayDuration), _frequentFlyerType (iFrequentFlyerType),
124 _wtp (iWTP), _valueOfTime (iValueOfTime),
125 _changeFees (iChangeFees), _changeFeeDisutility (iChangeFeeDisutility),
126 _nonRefundable (iNonRefundable),
127 _nonRefundableDisutility (iNonRefundableDisutility) {
145 std::ostringstream oStr;
146 oStr <<
"At " << _requestDateTime
147 <<
", for (" << _pos <<
", " << _channel <<
")"
148 <<
" " << _origin <<
"-" << _destination <<
" (" << _tripType <<
")"
149 <<
" " << _preferredDepartureDate <<
" (" << _stayDuration <<
" days)"
150 <<
" " << _preferredDepartureTime
151 <<
" " << _preferredCabin <<
" " << _partySize
152 <<
" " << _frequentFlyerType <<
" " << _wtp <<
" " << _valueOfTime
153 <<
" " << _changeFees <<
" " << _changeFeeDisutility <<
" "
154 << _nonRefundable <<
" " << _nonRefundableDisutility;
160 const int dInt = iInt -
static_cast<int> (iInt / 100) * 100;
162 oStream <<
"0" << dInt;
170 std::ostringstream oStr;
173 const Date_T& lRequestDate = _requestDateTime.date();
174 oStr << boost::gregorian::to_iso_extended_string (lRequestDate);
176 const Duration_T& lRequestTime = _requestDateTime.time_of_day();
177 oStr <<
", " << boost::posix_time::to_simple_string (lRequestTime);
180 oStr <<
", " << _pos;
183 oStr <<
", " << _channel;
186 oStr <<
", " << _origin;
189 oStr <<
", " << _destination;
193 << boost::gregorian::to_iso_extended_string (_preferredDepartureDate);
197 << boost::posix_time::to_simple_string (_preferredDepartureTime);
200 oStr <<
", " <<
"00:00-23:59";
204 << boost::gregorian::to_iso_extended_string (_preferredDepartureDate);
207 oStr <<
", " <<
"23:55";
210 oStr <<
", " << _preferredCabin;
213 oStr <<
", " << _tripType;
220 oStr << _stayDuration;
224 oStr <<
", " << _frequentFlyerType;
227 oStr <<
", " << _wtp;
231 oStr <<
", " <<
"100";
234 oStr <<
", " << _valueOfTime;
237 oStr <<
", " << _changeFees;
240 oStr <<
", " << _changeFeeDisutility;
243 oStr <<
", " << _nonRefundable;
246 oStr <<
", " << _nonRefundableDisutility;
const PartySize_T DEFAULT_PARTY_SIZE
const CabinCode_T DEFAULT_PREFERRED_CABIN
LocationCode_T AirportCode_T
const Date_T DEFAULT_PREFERRED_DEPARTURE_DATE
boost::posix_time::ptime DateTime_T
const AirportCode_T DEFAULT_ORIGIN
void toStream(std::ostream &ioOut) const
const CityCode_T DEFAULT_POS
Handle on the StdAir library context.
boost::posix_time::time_duration Duration_T
void fromStream(std::istream &ioIn)
LocationCode_T CityCode_T
const AirportCode_T DEFAULT_DESTINATION
const FrequentFlyer_T DEFAULT_FF_TIER
const ChannelLabel_T DEFAULT_CHANNEL
const std::string describe() const
void intDisplay(std::ostream &oStream, const int &iInt)
const DateTime_T DEFAULT_REQUEST_DATE_TIME
const PriceValue_T DEFAULT_VALUE_OF_TIME
std::string DemandGeneratorKey_T
std::string FrequentFlyer_T
const TripType_T TRIP_TYPE_ONE_WAY
const Duration_T DEFAULT_PREFERRED_DEPARTURE_TIME
boost::gregorian::date Date_T
const std::string display() const
Structure holding the elements of a booking request.
std::string ChannelLabel_T
const DayDuration_T DEFAULT_STAY_DURATION