StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
SegmentCabin.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // StdAir
17 #include <stdair/bom/Policy.hpp>
18 
19 namespace stdair {
20 
21  // ////////////////////////////////////////////////////////////////////
22  SegmentCabin::SegmentCabin() : _key (DEFAULT_CABIN_CODE), _parent (NULL) {
23  assert (false);
24  }
25 
26  // ////////////////////////////////////////////////////////////////////
27  SegmentCabin::SegmentCabin (const SegmentCabin& iSegmentCabin)
28  : _key (iSegmentCabin._key), _parent (NULL),
29  _capacity (iSegmentCabin._capacity),
30  _blockSpace (iSegmentCabin._blockSpace),
31  _bookingCounter (iSegmentCabin._bookingCounter),
32  _committedSpace (iSegmentCabin._committedSpace),
33  _availabilityPool (iSegmentCabin._availabilityPool),
34  _currentBidPrice (iSegmentCabin._currentBidPrice),
35  _fareFamilyActivation (iSegmentCabin._fareFamilyActivation) {
36  }
37 
38  // ////////////////////////////////////////////////////////////////////
39  SegmentCabin::SegmentCabin (const Key_T& iKey)
40  : _key (iKey), _parent (NULL),
41  _capacity (DEFAULT_CABIN_CAPACITY),
42  _blockSpace (DEFAULT_BLOCK_SPACE),
43  _bookingCounter (DEFAULT_CLASS_NB_OF_BOOKINGS),
44  _committedSpace (DEFAULT_COMMITTED_SPACE),
45  _availabilityPool (DEFAULT_AVAILABILITY),
46  _bidPriceVector (DEFAULT_BID_PRICE_VECTOR),
47  _currentBidPrice (DEFAULT_BID_PRICE),
48  _fareFamilyActivation (false) {
49  }
50 
51  // ////////////////////////////////////////////////////////////////////
53  }
54 
55  // ////////////////////////////////////////////////////////////////////
57  const SegmentDate& lSegmentDate = BomManager::getParent<SegmentDate>(*this);
58 
59  const MapKey_T oFullKey =
61  return oFullKey;
62  }
63 
64  // ////////////////////////////////////////////////////////////////////
65  std::string SegmentCabin::toString() const {
66  std::ostringstream oStr;
67  oStr << describeKey();
68  return oStr.str();
69  }
70 
71  // ////////////////////////////////////////////////////////////////////
72  const std::string SegmentCabin::describeConvexHull() const{
73  std::ostringstream oStr;
74  for (PolicyList_T::const_iterator itP = _convexHull.begin();
75  itP != _convexHull.end(); ++itP) {
76  const Policy* lPolicy = *itP;
77  assert (lPolicy != NULL);
78  oStr << lPolicy->toString();
79  }
80  return oStr.str();
81  }
82 
83  // ////////////////////////////////////////////////////////////////////
84  void SegmentCabin::
85  updateFromReservation (const NbOfBookings_T& iNbOfBookings) {
86  _committedSpace += iNbOfBookings;
87  }
88 
89  // ////////////////////////////////////////////////////////////////////
90  void SegmentCabin::addPolicy (Policy& ioPolicy) {
91  _convexHull.push_back (&ioPolicy);
92  }
93 }
94 
const std::string describeConvexHull() const
PolicyList_T _convexHull
CommittedSpace_T _committedSpace
const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR
Definition: BasConst.cpp:484
Class representing the actual attributes for an airline segment-date.
Definition: SegmentDate.hpp:36
Handle on the StdAir library context.
const CabinCapacity_T DEFAULT_CABIN_CAPACITY
const std::string DEFAULT_KEY_FLD_DELIMITER
NbOfRequests_T NbOfBookings_T
std::string MapKey_T
Definition: key_types.hpp:15
const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS
const BidPrice_T DEFAULT_BID_PRICE
const MapKey_T getFullerKey() const
const Availability_T DEFAULT_AVAILABILITY
std::string toString() const
Key of a given segment-cabin, made of a cabin code (only).
const CabinCode_T DEFAULT_CABIN_CODE
void updateFromReservation(const NbOfBookings_T &)
const CommittedSpace_T DEFAULT_COMMITTED_SPACE
const std::string describeKey() const
const CabinCode_T & getCabinCode() const
const BlockSpace_T DEFAULT_BLOCK_SPACE
void addPolicy(Policy &)
const std::string describeKey() const
std::string toString() const
Definition: Policy.cpp:39