StdAir Logo  1.00.21
C++ Standard Airline IT Object Library
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
13
14namespace stdair {
15
16 // ////////////////////////////////////////////////////////////////////
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 // ////////////////////////////////////////////////////////////////////
35
36 // ////////////////////////////////////////////////////////////////////
37 std::string OnDDate::toString() const {
38 std::ostringstream oStr;
39 oStr << describeKey();
40 return oStr.str();
41 }
42
43 // ////////////////////////////////////////////////////////////////////
45 const Inventory* lInventory_ptr =
46 static_cast<const Inventory*> (getParent());
47 assert (lInventory_ptr != NULL);
48 return lInventory_ptr->getAirlineCode();
49 }
50
51 // ////////////////////////////////////////////////////////////////////
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}
Handle on the StdAir library context.
std::pair< std::string, CabinClassPairList_T > StringCabinClassPair_T
std::pair< WTP_T, MeanStdDevPair_T > WTPDemandPair_T
std::pair< CabinCode_T, WTPDemandPair_T > CabinForecastPair_T
const OnDStringList_T DEFAULT_OND_STRING_LIST
Definition BasConst.cpp:727
std::pair< std::string, YieldDemandPair_T > StringDemandStructPair_T
std::list< CabinClassPair_T > CabinClassPairList_T
std::string AirlineCode_T
std::string CabinCode_T
std::pair< Yield_T, MeanStdDevPair_T > YieldDemandPair_T
Class representing the actual attributes for an airline inventory.
Definition Inventory.hpp:41
const AirlineCode_T & getAirlineCode() const
Definition Inventory.hpp:64
BomAbstract *const getParent() const
Definition OnDDate.hpp:55
const std::string describeKey() const
Definition OnDDate.hpp:167
StringCabinClassPairListMap_T _stringCabinClassPairListMap
Definition OnDDate.hpp:237
OnDDate(const Key_T &)
Definition OnDDate.cpp:28
StringDemandStructMap_T _classPathDemandMap
Definition OnDDate.hpp:232
OnDDateKey Key_T
Definition OnDDate.hpp:44
virtual ~OnDDate()
Definition OnDDate.cpp:33
void setDemandInformation(const CabinClassPairList_T &, const YieldDemandPair_T &)
Definition OnDDate.cpp:53
const AirlineCode_T & getAirlineCode() const
Definition OnDDate.cpp:44
void setTotalForecast(const CabinCode_T &, const WTPDemandPair_T &)
Definition OnDDate.cpp:76
BomAbstract * _parent
Definition OnDDate.hpp:222
std::string toString() const
Definition OnDDate.cpp:37
CabinForecastMap_T _cabinForecastMap
Definition OnDDate.hpp:242