StdAir Logo  1.00.0
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FacBomManager.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 // StdAir
16 
17 namespace stdair {
18  // ////////////////////////////////////////////////////////////////////
19  void FacBomManager::
21  const SimpleNestingStructure& lYieldBasedNS =
22  BomManager::getObject<SimpleNestingStructure> (iSegmentCabin, YIELD_BASED_NESTING_STRUCTURE_CODE);
23 
24  // Browse the list of node and reset each one.
25  const NestingNodeList_T& lNestingNodeList =
26  BomManager::getList<NestingNode> (lYieldBasedNS);
27  for (NestingNodeList_T::const_iterator itNode = lNestingNodeList.begin();
28  itNode != lNestingNodeList.end(); ++itNode) {
29  stdair::NestingNode* lNode_ptr = *itNode;
30  assert (lNode_ptr != NULL);
31 
32  lNode_ptr->setYield (-1.0);
33 
34  // Clear the list of booking classes of the node
35  const HolderMap_T& lHolderMap = lNode_ptr->getHolderMap();
36  HolderMap_T::const_iterator itHolder = lHolderMap.find (&typeid (BookingClass));
37 
38  if (itHolder == lHolderMap.end()) {
39  const std::string lName (typeid (BookingClass).name());
40  throw NonInitialisedContainerException("Cannot find the holder of type "
41  + lName + " within: "
42  + lNode_ptr->describeKey());
43  }
44 
45  BomHolder<BookingClass>* lBomHolder_ptr =
46  static_cast<BomHolder<BookingClass>*> (itHolder->second);
47  assert (lBomHolder_ptr != NULL);
48 
49  BookingClassList_T& lBCList = lBomHolder_ptr->_bomList;
50  lBCList.clear();
51  }
52  }
53 
54 }