StdAir Logo  1.00.21
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
YieldFeatures.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <sstream>
7// StdAir
11
12namespace stdair {
13
14 // ////////////////////////////////////////////////////////////////////
16 : _key (TRIP_TYPE_ONE_WAY,
18 _parent (NULL) {
19 // That constructor is used by the serialisation process
20 }
21
22 // ////////////////////////////////////////////////////////////////////
23 YieldFeatures::YieldFeatures (const YieldFeatures& iFeatures)
24 : _key (iFeatures.getKey()), _parent (NULL) {
25 }
26
27 // ////////////////////////////////////////////////////////////////////
29 : _key (iKey), _parent (NULL) {
30 }
31
32 // ////////////////////////////////////////////////////////////////////
35
36 // ////////////////////////////////////////////////////////////////////
37 std::string YieldFeatures::toString() const {
38 std::ostringstream oStr;
39 oStr << describeKey();
40 return oStr.str();
41 }
42
43 // ////////////////////////////////////////////////////////////////////
45 isTripTypeValid (const TripType_T& iBookingRequestTripType) const {
46 bool oIsTripTypeValidFlag = true;
47
48 // Check whether the yield trip type is the same as the booking request
49 // trip type
50 const TripType_T& lYieldTripType = getTripType();
51 if (iBookingRequestTripType == lYieldTripType) {
52 // One way case
53 return oIsTripTypeValidFlag;
54 }
55
56 if (iBookingRequestTripType == TRIP_TYPE_INBOUND ||
57 iBookingRequestTripType == TRIP_TYPE_OUTBOUND) {
58 // Round trip case.
59 if (lYieldTripType == TRIP_TYPE_ROUND_TRIP) {
60 return oIsTripTypeValidFlag;
61 }
62 }
63
64 oIsTripTypeValidFlag = false;
65 return false;
66 }
67
68}
69
Handle on the StdAir library context.
std::string TripType_T
const TripType_T TRIP_TYPE_INBOUND
const TripType_T TRIP_TYPE_ROUND_TRIP
const CabinCode_T DEFAULT_PREFERRED_CABIN
const TripType_T TRIP_TYPE_OUTBOUND
const TripType_T TRIP_TYPE_ONE_WAY
std::string toString() const
const TripType_T & getTripType() const
YieldFeaturesKey Key_T
bool isTripTypeValid(const TripType_T &) const
const std::string describeKey() const
YieldFeatures(const Key_T &)