StdAir Logo  1.00.19
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
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
19
20namespace stdair {
21
22 // ////////////////////////////////////////////////////////////////////
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 // ////////////////////////////////////////////////////////////////////
37 : _key (iKey), _parent (NULL) {
38 }
39
40 // ////////////////////////////////////////////////////////////////////
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 // ////////////////////////////////////////////////////////////////////
118
119}
Handle on the StdAir library context.
const NestingStructureCode_T DEFAULT_NESTING_STRUCTURE_CODE
std::list< NestingNode * > NestingNodeList_T
static const BomHolder< OBJECT2 >::BomList_T & getList(const OBJECT1 &)
const NestingNodeList_T & getNestingNodeList() const
const std::string describeKey() const