StdAir Logo  1.00.10
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  // ////////////////////////////////////////////////////////////////////
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 
stdair::DEFAULT_CABIN_CODE
const CabinCode_T DEFAULT_CABIN_CODE
stdair::DEFAULT_COMMITTED_SPACE
const CommittedSpace_T DEFAULT_COMMITTED_SPACE
stdair::SegmentCabinKey
Key of a given segment-cabin, made of a cabin code (only).
Definition: SegmentCabinKey.hpp:26
Policy.hpp
stdair::DEFAULT_BID_PRICE
const BidPrice_T DEFAULT_BID_PRICE
stdair::SegmentCabin::_committedSpace
CommittedSpace_T _committedSpace
Definition: SegmentCabin.hpp:340
stdair::Policy::toString
std::string toString() const
Definition: Policy.cpp:39
BookingClass.hpp
stdair::DEFAULT_BID_PRICE_VECTOR
const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR
Definition: BasConst.cpp:475
stdair::SegmentCabin::toString
std::string toString() const
Definition: SegmentCabin.cpp:65
stdair::SegmentCabin::getCabinCode
const CabinCode_T & getCabinCode() const
Definition: SegmentCabin.hpp:80
BasConst_BomDisplay.hpp
stdair::SegmentCabin::addPolicy
void addPolicy(Policy &)
Definition: SegmentCabin.cpp:90
stdair
Handle on the StdAir library context.
Definition: BasChronometer.cpp:9
stdair::DEFAULT_KEY_FLD_DELIMITER
const std::string DEFAULT_KEY_FLD_DELIMITER
stdair::MapKey_T
std::string MapKey_T
Definition: key_types.hpp:15
stdair::SegmentDate::describeKey
const std::string describeKey() const
Definition: SegmentDate.hpp:260
stdair::DEFAULT_CLASS_NB_OF_BOOKINGS
const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS
Definition: BasConst_General.hpp:27
BasConst_Inventory.hpp
BookingClassTypes.hpp
BasConst_BookingClass.hpp
stdair::SegmentCabin::describeKey
const std::string describeKey() const
Definition: SegmentCabin.hpp:248
stdair::SegmentCabin::describeConvexHull
const std::string describeConvexHull() const
Definition: SegmentCabin.cpp:72
stdair::SegmentCabin::_convexHull
PolicyList_T _convexHull
Definition: SegmentCabin.hpp:355
SegmentCabin.hpp
stdair::DEFAULT_CABIN_CAPACITY
const CabinCapacity_T DEFAULT_CABIN_CAPACITY
Definition: BasConst_General.hpp:21
SegmentDate.hpp
BomManager.hpp
BasConst_Yield.hpp
stdair::SegmentCabin::getFullerKey
const MapKey_T getFullerKey() const
Definition: SegmentCabin.cpp:56
stdair::DEFAULT_AVAILABILITY
const Availability_T DEFAULT_AVAILABILITY
stdair::SegmentCabin::updateFromReservation
void updateFromReservation(const NbOfBookings_T &)
Definition: SegmentCabin.cpp:85
stdair::SegmentCabin::~SegmentCabin
virtual ~SegmentCabin()
Definition: SegmentCabin.cpp:52
stdair::NbOfBookings_T
NbOfRequests_T NbOfBookings_T
Definition: stdair_basic_types.hpp:104
stdair::SegmentDate
Class representing the actual attributes for an airline segment-date.
Definition: SegmentDate.hpp:42
stdair::DEFAULT_BLOCK_SPACE
const BlockSpace_T DEFAULT_BLOCK_SPACE
stdair::Policy
Definition: Policy.hpp:30