1.00.26
C++ Standard Airline IT Object Library
Toggle main menu visibility
Loading...
Searching...
No Matches
SegmentCabin.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// StdAir
8
#include <
stdair/basic/BasConst_BookingClass.hpp
>
9
#include <
stdair/basic/BasConst_Inventory.hpp
>
10
#include <
stdair/basic/BasConst_Yield.hpp
>
11
#include <
stdair/basic/BasConst_BomDisplay.hpp
>
12
#include <
stdair/bom/BomManager.hpp
>
13
#include <
stdair/bom/SegmentDate.hpp
>
14
#include <
stdair/bom/SegmentCabin.hpp
>
15
#include <
stdair/bom/BookingClass.hpp
>
16
#include <
stdair/bom/BookingClassTypes.hpp
>
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
// ////////////////////////////////////////////////////////////////////
52
SegmentCabin::~SegmentCabin
() {
53
}
54
55
// ////////////////////////////////////////////////////////////////////
56
const
MapKey_T
SegmentCabin::getFullerKey
()
const
{
57
const
SegmentDate
& lSegmentDate =
BomManager::getParent<SegmentDate>
(*
this
);
58
59
const
MapKey_T
oFullKey =
60
lSegmentDate.
describeKey
() +
DEFAULT_KEY_FLD_DELIMITER
+
getCabinCode
();
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
BasConst_BomDisplay.hpp
BasConst_BookingClass.hpp
BasConst_Inventory.hpp
BasConst_Yield.hpp
BomManager.hpp
BookingClass.hpp
BookingClassTypes.hpp
Policy.hpp
SegmentCabin.hpp
SegmentDate.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::DEFAULT_CLASS_NB_OF_BOOKINGS
const NbOfBookings_T DEFAULT_CLASS_NB_OF_BOOKINGS
Definition
BasConst_General.hpp:27
stdair::DEFAULT_COMMITTED_SPACE
const CommittedSpace_T DEFAULT_COMMITTED_SPACE
stdair::MapKey_T
std::string MapKey_T
Definition
key_types.hpp:15
stdair::NbOfBookings_T
NbOfRequests_T NbOfBookings_T
Definition
stdair_basic_types.hpp:104
stdair::DEFAULT_AVAILABILITY
const Availability_T DEFAULT_AVAILABILITY
stdair::DEFAULT_CABIN_CODE
const CabinCode_T DEFAULT_CABIN_CODE
stdair::DEFAULT_BID_PRICE_VECTOR
const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR
Definition
BasConst.cpp:475
stdair::DEFAULT_CABIN_CAPACITY
const CabinCapacity_T DEFAULT_CABIN_CAPACITY
Definition
BasConst_General.hpp:21
stdair::DEFAULT_BID_PRICE
const BidPrice_T DEFAULT_BID_PRICE
stdair::DEFAULT_BLOCK_SPACE
const BlockSpace_T DEFAULT_BLOCK_SPACE
stdair::DEFAULT_KEY_FLD_DELIMITER
const std::string DEFAULT_KEY_FLD_DELIMITER
stdair::BomManager::getParent
static PARENT & getParent(const CHILD &)
Definition
BomManager.hpp:230
stdair::Policy
Definition
Policy.hpp:30
stdair::Policy::toString
std::string toString() const
Definition
Policy.cpp:39
stdair::SegmentCabin::describeKey
const std::string describeKey() const
Definition
SegmentCabin.hpp:248
stdair::SegmentCabin::_convexHull
PolicyList_T _convexHull
Definition
SegmentCabin.hpp:355
stdair::SegmentCabin::_bookingCounter
NbOfBookings_T _bookingCounter
Definition
SegmentCabin.hpp:337
stdair::SegmentCabin::_bidPriceVector
BidPriceVector_T _bidPriceVector
Definition
SegmentCabin.hpp:346
stdair::SegmentCabin::_fareFamilyActivation
bool _fareFamilyActivation
Definition
SegmentCabin.hpp:352
stdair::SegmentCabin::_availabilityPool
Availability_T _availabilityPool
Definition
SegmentCabin.hpp:343
stdair::SegmentCabin::toString
std::string toString() const
Definition
SegmentCabin.cpp:65
stdair::SegmentCabin::Key_T
SegmentCabinKey Key_T
Definition
SegmentCabin.hpp:51
stdair::SegmentCabin::_key
Key_T _key
Definition
SegmentCabin.hpp:307
stdair::SegmentCabin::_currentBidPrice
BidPrice_T _currentBidPrice
Definition
SegmentCabin.hpp:349
stdair::SegmentCabin::SegmentCabin
SegmentCabin(const Key_T &)
Definition
SegmentCabin.cpp:39
stdair::SegmentCabin::getFullerKey
const MapKey_T getFullerKey() const
Definition
SegmentCabin.cpp:56
stdair::SegmentCabin::describeConvexHull
const std::string describeConvexHull() const
Definition
SegmentCabin.cpp:72
stdair::SegmentCabin::~SegmentCabin
virtual ~SegmentCabin()
Definition
SegmentCabin.cpp:52
stdair::SegmentCabin::_committedSpace
CommittedSpace_T _committedSpace
Definition
SegmentCabin.hpp:340
stdair::SegmentCabin::updateFromReservation
void updateFromReservation(const NbOfBookings_T &)
Definition
SegmentCabin.cpp:85
stdair::SegmentCabin::addPolicy
void addPolicy(Policy &)
Definition
SegmentCabin.cpp:90
stdair::SegmentCabin::_parent
BomAbstract * _parent
Definition
SegmentCabin.hpp:312
stdair::SegmentCabin::_capacity
CabinCapacity_T _capacity
Definition
SegmentCabin.hpp:325
stdair::SegmentCabin::_blockSpace
BlockSpace_T _blockSpace
Definition
SegmentCabin.hpp:328
stdair::SegmentCabin::getCabinCode
const CabinCode_T & getCabinCode() const
Definition
SegmentCabin.hpp:80
stdair::SegmentDate
Class representing the actual attributes for an airline segment-date.
Definition
SegmentDate.hpp:42
stdair::SegmentDate::describeKey
const std::string describeKey() const
Definition
SegmentDate.hpp:260
Generated for StdAir by
1.17.0