12 #include <stdair/stdair_rm_types.hpp>
13 #include <stdair/bom/LegCabin.hpp>
14 #include <stdair/bom/VirtualClassStruct.hpp>
22 stdair::VirtualClassList_T& lVirtualClassList =
23 ioLegCabin.getVirtualClassList ();
24 const stdair::CabinCapacity_T& lCabinCapacity =
25 ioLegCabin.getOfferedCapacity();
32 stdair::VirtualClassList_T::iterator itVC =lVirtualClassList.begin();
33 assert (itVC != lVirtualClassList.end());
35 stdair::VirtualClassStruct& lFirstVC = *itVC;
36 lFirstVC.setCumulatedBookingLimit (lCabinCapacity);
38 for (; itVC != lVirtualClassList.end(); ++itVC) {
39 stdair::VirtualClassStruct& lNextVC = *itVC;
42 stdair::ProtectionLevel_T lProtectionLevel = 0.0;
44 for(stdair::VirtualClassList_T::iterator itHigherVC =
45 lVirtualClassList.begin(); itHigherVC != itVC; ++itHigherVC) {
46 stdair::VirtualClassStruct& lHigherVC = *itHigherVC;
47 const double lPartialProtectionLevel =
49 lProtectionLevel += lPartialProtectionLevel;
51 stdair::VirtualClassList_T::iterator itCurrentVC = itVC; --itCurrentVC;
52 stdair::VirtualClassStruct& lCurrentVC = *itCurrentVC;
53 lCurrentVC.setCumulatedProtection (lProtectionLevel);
56 const double lBookingLimit = lCabinCapacity - lProtectionLevel;
59 lNextVC.setCumulatedBookingLimit (lBookingLimit);
65 stdair::VirtualClassList_T& lVirtualClassList =
66 ioLegCabin.getVirtualClassList ();
67 const stdair::CabinCapacity_T& lCabinCapacity =
68 ioLegCabin.getOfferedCapacity();
75 stdair::VirtualClassList_T::iterator itVC =lVirtualClassList.begin();
76 assert (itVC != lVirtualClassList.end());
78 stdair::VirtualClassStruct& lFirstVC = *itVC;
79 lFirstVC.setCumulatedBookingLimit (lCabinCapacity);
81 stdair::VirtualClassStruct lAggregatedVC = lFirstVC;
82 for (; itVC != lVirtualClassList.end(); ++itVC) {
83 stdair::VirtualClassStruct& lNextVC = *itVC;
87 const stdair::ProtectionLevel_T lProtectionLevel =
91 stdair::VirtualClassList_T::iterator itCurrentVC = itVC; --itCurrentVC;
92 stdair::VirtualClassStruct& lCurrentVC = *itCurrentVC;
93 lCurrentVC.setCumulatedProtection (lProtectionLevel);
96 const double lBookingLimit = lCabinCapacity - lProtectionLevel;
99 lNextVC.setCumulatedBookingLimit (lBookingLimit);
109 stdair::VirtualClassList_T& lVirtualClassList =
110 ioLegCabin.getVirtualClassList ();
111 const stdair::CabinCapacity_T& lCapacity = ioLegCabin.getOfferedCapacity();
112 ioLegCabin.emptyBidPriceVector();
113 stdair::BidPriceVector_T& lBidPriceVector =
114 ioLegCabin.getBidPriceVector();
117 const int lCabinCapacity =
static_cast<const int> (lCapacity);
120 stdair::EmsrValueList_T lEmsrValueList;
127 for (stdair::VirtualClassList_T::iterator itVC = lVirtualClassList.begin();
128 itVC != lVirtualClassList.end(); ++itVC) {
129 stdair::VirtualClassStruct& lCurrentVC = *itVC;
130 for (
int k = 1; k <= lCabinCapacity; ++k) {
132 lEmsrValueList.push_back(emsrValue);
137 std::sort(lEmsrValueList.rbegin(), lEmsrValueList.rend());
140 const int lEmsrValueListSize = lEmsrValueList.size();
141 assert (lEmsrValueListSize >= lCabinCapacity);
144 stdair::EmsrValueList_T::const_iterator itCurrentValue =
145 lEmsrValueList.begin();
146 for (
int j = 0; j < lCabinCapacity; ++j, ++itCurrentValue) {
147 const double lBidPrice = *itCurrentValue;
148 lBidPriceVector.push_back (lBidPrice);
150 lEmsrValueList.clear();
153 if (lVirtualClassList.size() > 1) {
154 int lCapacityIndex = 0;
155 for (stdair::VirtualClassList_T::iterator itVC =lVirtualClassList.begin();
156 itVC != lVirtualClassList.end();) {
157 stdair::VirtualClassStruct& lCurrentVC = *itVC;
158 if (itVC != lVirtualClassList.end()) {
161 stdair::VirtualClassStruct& lNextVC = *itVC;
162 const stdair::Yield_T lNextYield = lNextVC.getYield();
163 while ((lCapacityIndex < lCabinCapacity)
164 && (lBidPriceVector.at(lCapacityIndex) > lNextYield)) {
167 lCurrentVC.setCumulatedProtection (lCapacityIndex);
168 lNextVC.setCumulatedBookingLimit (lCapacity - lCapacityIndex);