StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
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 
12 namespace stdair {
13 
14  // ////////////////////////////////////////////////////////////////////
15  YieldFeatures::YieldFeatures()
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  // ////////////////////////////////////////////////////////////////////
28  YieldFeatures::YieldFeatures (const Key_T& iKey)
29  : _key (iKey), _parent (NULL) {
30  }
31 
32  // ////////////////////////////////////////////////////////////////////
34  }
35 
36  // ////////////////////////////////////////////////////////////////////
37  std::string YieldFeatures::toString() const {
38  std::ostringstream oStr;
39  oStr << describeKey();
40  return oStr.str();
41  }
42 
43  // ////////////////////////////////////////////////////////////////////
44  bool YieldFeatures::
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 
const CabinCode_T DEFAULT_PREFERRED_CABIN
std::string TripType_T
Handle on the StdAir library context.
const TripType_T TRIP_TYPE_OUTBOUND
std::string toString() const
Key of date-period.
const TripType_T TRIP_TYPE_INBOUND
const TripType_T TRIP_TYPE_ONE_WAY
const std::string describeKey() const
const TripType_T & getTripType() const
const TripType_T TRIP_TYPE_ROUND_TRIP
bool isTripTypeValid(const TripType_T &) const