1.00.0
C++ Standard Airline IT Object Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
SimpleNestingStructure.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <sstream>
6
#include <cassert>
7
#include <iomanip>
8
#include <iostream>
9
//STDAIR
10
#include <
stdair/stdair_exceptions.hpp
>
11
#include <
stdair/basic/BasConst_Inventory.hpp
>
12
#include <
stdair/bom/BomManager.hpp
>
13
#include <
stdair/bom/BookingClass.hpp
>
14
#include <
stdair/bom/BookingClass.hpp
>
15
#include <
stdair/bom/SimpleNestingStructure.hpp
>
16
#include <
stdair/bom/NestingNode.hpp
>
17
#include <
stdair/bom/NestingNodeTypes.hpp
>
18
#include <
stdair/service/Logger.hpp
>
19
20
namespace
stdair {
21
22
// ////////////////////////////////////////////////////////////////////
23
SimpleNestingStructure::SimpleNestingStructure () :
24
_key (
DEFAULT_NESTING_STRUCTURE_CODE
), _parent (NULL) {
25
assert (
false
);
26
}
27
28
// ////////////////////////////////////////////////////////////////////
29
SimpleNestingStructure::
30
SimpleNestingStructure (
const
SimpleNestingStructure& iSimpleNestingStructure)
31
: _key (
DEFAULT_NESTING_STRUCTURE_CODE
), _parent (NULL) {
32
assert (
false
);
33
}
34
35
// ////////////////////////////////////////////////////////////////////
36
SimpleNestingStructure::SimpleNestingStructure (
const
Key_T
& iKey)
37
: _key (iKey), _parent (NULL) {
38
}
39
40
// ////////////////////////////////////////////////////////////////////
41
SimpleNestingStructure::~SimpleNestingStructure
() {
42
}
43
44
// ////////////////////////////////////////////////////////////////////
45
// const bool SimpleNestingStructure::insertBookingClassList(const Yield_T& iYield,
46
// const BookingClassList_T& iBookingClassList) {
47
// const bool isBookinClassListEmpty = iBookingClassList.empty();
48
// if (isBookinClassListEmpty == true) {
49
// std::ostringstream ostr;
50
// ostr << "The booking class list is empty and it should not be. "
51
// "No insertion done in the nesting structure (";
52
// toStream(ostr);
53
// ostr << ").";
54
// STDAIR_LOG_DEBUG(ostr.str());
55
// throw BookingClassListEmptyInNestingStructException(ostr.str());
56
// }
57
// assert(isBookinClassListEmpty == false);
58
// NestingNodeMap_T::iterator itNestingNode = _nestingNodeMap.find (iYield);
59
// bool insertionSucceeded = false;
60
// // Search a node with the same yield and add the
61
// // booking classes to the booking class list of the node.
62
// // If there is not a node with the same yield, create it.
63
// if (itNestingNode == _nestingNodeMap.end()) {
64
// NestingNode_T lNode (iYield, iBookingClassList);
65
// insertionSucceeded = _nestingNodeMap.insert(lNode).second;
66
// } else {
67
// NestingNode_T& lNode = *itNestingNode;
68
// const Yield_T& lYield = lNode.first;
69
// assert(lYield == iYield);
70
// BookingClassList_T& lBCList = lNode.second;
71
// for (BookingClassList_T::const_iterator itBC = iBookingClassList.begin();
72
// itBC != iBookingClassList.end(); ++itBC) {
73
// BookingClass* lBC_ptr = *itBC;
74
// assert(lBC_ptr != NULL);
75
// lBCList.push_back(lBC_ptr);
76
// }
77
// insertionSucceeded = true;
78
// }
79
80
// return insertionSucceeded;
81
// }
82
83
// ////////////////////////////////////////////////////////////////////
84
// const bool SimpleNestingStructure::
85
// alreadyInNestingStructure(const ClassCode_T& iClassCode) const {
86
// bool isAlreadyInTheMap = false;
87
// NestingNodeMap_T::const_iterator itMap = _nestingNodeMap.begin();
88
// for(; itMap != _nestingNodeMap.end(); ++itMap) {
89
// const NestingNode_T& lNestingNode = *itMap;
90
// const BookingClassList_T& lBCList = lNestingNode.second;
91
// BookingClassList_T::const_iterator itBC = lBCList.begin();
92
// for (;itBC != lBCList.end(); ++itBC) {
93
// BookingClass* lBC_ptr = *itBC;
94
// assert(lBC_ptr != NULL);
95
// const BookingClassKey& lBookingClassKey = lBC_ptr->getKey();
96
// const ClassCode_T& lClassCode = lBookingClassKey.getClassCode();
97
// if (lClassCode == iClassCode) {
98
// isAlreadyInTheMap = true;
99
// return isAlreadyInTheMap;
100
// }
101
// }
102
// }
103
// return isAlreadyInTheMap;
104
// }
105
106
// ////////////////////////////////////////////////////////////////////
107
std::string
SimpleNestingStructure::toString
()
const
{
108
std::ostringstream oStr;
109
oStr <<
describeKey
();
110
111
return
oStr.str();
112
}
113
114
// ////////////////////////////////////////////////////////////////////
115
const
NestingNodeList_T
&
SimpleNestingStructure::getNestingNodeList
()
const
{
116
return
BomManager::getList<NestingNode> (*this);
117
}
118
119
}
Generated on Sat Dec 22 2012 16:51:54 for StdAir by
1.8.1.1