Go to the documentation of this file.00001
00002
00003
00004
00005 #include <cassert>
00006 #include <sstream>
00007
00008 #include <stdair/basic/BasConst_BookingClass.hpp>
00009 #include <stdair/basic/BasConst_Inventory.hpp>
00010 #include <stdair/basic/BasConst_BomDisplay.hpp>
00011 #include <stdair/bom/BomManager.hpp>
00012 #include <stdair/bom/SegmentDate.hpp>
00013 #include <stdair/bom/SegmentCabin.hpp>
00014
00015 namespace stdair {
00016
00017
00018 SegmentCabin::SegmentCabin() : _key (DEFAULT_CABIN_CODE), _parent (NULL) {
00019 assert (false);
00020 }
00021
00022
00023 SegmentCabin::SegmentCabin (const SegmentCabin&)
00024 : _key (DEFAULT_CABIN_CODE), _parent (NULL) {
00025 assert (false);
00026 }
00027
00028
00029 SegmentCabin::SegmentCabin (const Key_T& iKey)
00030 : _key (iKey), _parent (NULL),
00031 _capacity (DEFAULT_CABIN_CAPACITY),
00032 _blockSpace (DEFAULT_BLOCK_SPACE),
00033 _bookingCounter (DEFAULT_CLASS_NB_OF_BOOKINGS),
00034 _committedSpace (DEFAULT_COMMITTED_SPACE),
00035 _availabilityPool (DEFAULT_AVAILABILITY),
00036 _bidPriceVector (DEFAULT_BID_PRICE_VECTOR),
00037 _currentBidPrice (DEFAULT_BID_PRICE),
00038 _fareFamilyActivation (false) {
00039 }
00040
00041
00042 SegmentCabin::~SegmentCabin() {
00043 }
00044
00045
00046 const MapKey_T SegmentCabin::getFullerKey() const {
00047 const SegmentDate& lSegmentDate = BomManager::getParent<SegmentDate>(*this);
00048
00049 const MapKey_T oFullKey =
00050 lSegmentDate.describeKey() + DEFAULT_KEY_FLD_DELIMITER + getCabinCode();
00051 return oFullKey;
00052 }
00053
00054
00055 std::string SegmentCabin::toString() const {
00056 std::ostringstream oStr;
00057 oStr << describeKey();
00058 return oStr.str();
00059 }
00060
00061
00062 void SegmentCabin::
00063 updateFromReservation (const NbOfBookings_T& iNbOfBookings) {
00064 _committedSpace += iNbOfBookings;
00065 }
00066
00067 }
00068