1.00.26
C++ Standard Airline IT Object Library
Toggle main menu visibility
Loading...
Searching...
No Matches
OnDDate.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_Inventory.hpp
>
9
#include <
stdair/basic/BasConst_General.hpp
>
10
#include <
stdair/bom/BomManager.hpp
>
11
#include <
stdair/bom/Inventory.hpp
>
12
#include <
stdair/bom/OnDDate.hpp
>
13
14
namespace
stdair
{
15
16
// ////////////////////////////////////////////////////////////////////
17
OnDDate::OnDDate
()
18
: _key (
DEFAULT_OND_STRING_LIST
), _parent (NULL) {
19
assert (
false
);
20
}
21
22
// ////////////////////////////////////////////////////////////////////
23
OnDDate::OnDDate (
const
OnDDate& iOnDDate)
24
: _key (iOnDDate.getKey()), _parent (NULL) {
25
}
26
27
// ////////////////////////////////////////////////////////////////////
28
OnDDate::OnDDate
(
const
Key_T
& iKey)
29
:
_key
(iKey),
_parent
(NULL) {
30
}
31
32
// ////////////////////////////////////////////////////////////////////
33
OnDDate::~OnDDate
() {
34
}
35
36
// ////////////////////////////////////////////////////////////////////
37
std::string
OnDDate::toString
()
const
{
38
std::ostringstream oStr;
39
oStr <<
describeKey
();
40
return
oStr.str();
41
}
42
43
// ////////////////////////////////////////////////////////////////////
44
const
AirlineCode_T
&
OnDDate::getAirlineCode
()
const
{
45
const
Inventory
* lInventory_ptr =
46
static_cast<
const
Inventory
*
>
(
getParent
());
47
assert (lInventory_ptr != NULL);
48
return
lInventory_ptr->
getAirlineCode
();
49
}
50
51
// ////////////////////////////////////////////////////////////////////
52
void
OnDDate::
53
setDemandInformation
(
const
CabinClassPairList_T
& iCabinClassPairList,
54
const
YieldDemandPair_T
& iYieldDemandPair) {
55
std::ostringstream oStr;
56
for
(CabinClassPairList_T::const_iterator itCCP = iCabinClassPairList.begin();
57
itCCP != iCabinClassPairList.end(); ++itCCP) {
58
oStr << itCCP->first <<
":"
<< itCCP->second <<
";"
;
59
}
60
std::string lCabinClassPath = oStr.str();
61
StringDemandStructMap_T::iterator it =
62
_classPathDemandMap
.find(lCabinClassPath);
63
if
(it ==
_classPathDemandMap
.end()) {
64
const
StringDemandStructPair_T
lPairStringDemandChar (lCabinClassPath,
65
iYieldDemandPair);
66
_classPathDemandMap
.insert (lPairStringDemandChar);
67
const
StringCabinClassPair_T
lStringCabinClassPair (lCabinClassPath,
68
iCabinClassPairList);
69
_stringCabinClassPairListMap
.insert (lStringCabinClassPair);
70
}
else
{
71
it->second = iYieldDemandPair;
72
}
73
}
74
75
// ////////////////////////////////////////////////////////////////////
76
void
OnDDate::setTotalForecast
(
const
CabinCode_T
& iCabinCode,
77
const
WTPDemandPair_T
& iWTPDemandPair) {
78
79
CabinForecastMap_T::iterator it =
80
_cabinForecastMap
.find (iCabinCode);
81
if
(it ==
_cabinForecastMap
.end()) {
82
const
CabinForecastPair_T
lPairCabinForecastChar (iCabinCode,
83
iWTPDemandPair);
84
_cabinForecastMap
.insert (lPairCabinForecastChar);
85
}
else
{
86
assert (
false
);
87
}
88
}
89
90
}
BasConst_General.hpp
BasConst_Inventory.hpp
BomManager.hpp
Inventory.hpp
OnDDate.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::StringCabinClassPair_T
std::pair< std::string, CabinClassPairList_T > StringCabinClassPair_T
Definition
OnDDateTypes.hpp:42
stdair::WTPDemandPair_T
std::pair< WTP_T, MeanStdDevPair_T > WTPDemandPair_T
Definition
stdair_demand_types.hpp:77
stdair::CabinForecastPair_T
std::pair< CabinCode_T, WTPDemandPair_T > CabinForecastPair_T
Definition
OnDDateTypes.hpp:49
stdair::DEFAULT_OND_STRING_LIST
const OnDStringList_T DEFAULT_OND_STRING_LIST
Definition
BasConst.cpp:727
stdair::StringDemandStructPair_T
std::pair< std::string, YieldDemandPair_T > StringDemandStructPair_T
Definition
OnDDateTypes.hpp:32
stdair::CabinClassPairList_T
std::list< CabinClassPair_T > CabinClassPairList_T
Definition
stdair_demand_types.hpp:108
stdair::AirlineCode_T
std::string AirlineCode_T
Definition
stdair_basic_types.hpp:31
stdair::CabinCode_T
std::string CabinCode_T
Definition
stdair_basic_types.hpp:41
stdair::YieldDemandPair_T
std::pair< Yield_T, MeanStdDevPair_T > YieldDemandPair_T
Definition
stdair_inventory_types.hpp:122
stdair::Inventory
Class representing the actual attributes for an airline inventory.
Definition
Inventory.hpp:41
stdair::Inventory::getAirlineCode
const AirlineCode_T & getAirlineCode() const
Definition
Inventory.hpp:64
stdair::OnDDate::getParent
BomAbstract *const getParent() const
Definition
OnDDate.hpp:55
stdair::OnDDate::describeKey
const std::string describeKey() const
Definition
OnDDate.hpp:167
stdair::OnDDate::_stringCabinClassPairListMap
StringCabinClassPairListMap_T _stringCabinClassPairListMap
Definition
OnDDate.hpp:237
stdair::OnDDate::OnDDate
OnDDate(const Key_T &)
Definition
OnDDate.cpp:28
stdair::OnDDate::_classPathDemandMap
StringDemandStructMap_T _classPathDemandMap
Definition
OnDDate.hpp:232
stdair::OnDDate::Key_T
OnDDateKey Key_T
Definition
OnDDate.hpp:44
stdair::OnDDate::~OnDDate
virtual ~OnDDate()
Definition
OnDDate.cpp:33
stdair::OnDDate::setDemandInformation
void setDemandInformation(const CabinClassPairList_T &, const YieldDemandPair_T &)
Definition
OnDDate.cpp:53
stdair::OnDDate::_key
Key_T _key
Definition
OnDDate.hpp:217
stdair::OnDDate::getAirlineCode
const AirlineCode_T & getAirlineCode() const
Definition
OnDDate.cpp:44
stdair::OnDDate::setTotalForecast
void setTotalForecast(const CabinCode_T &, const WTPDemandPair_T &)
Definition
OnDDate.cpp:76
stdair::OnDDate::_parent
BomAbstract * _parent
Definition
OnDDate.hpp:222
stdair::OnDDate::toString
std::string toString() const
Definition
OnDDate.cpp:37
stdair::OnDDate::_cabinForecastMap
CabinForecastMap_T _cabinForecastMap
Definition
OnDDate.hpp:242
Generated for StdAir by
1.17.0