StdAir Logo  1.00.3
C++ Standard Airline IT Object Library
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 }
void setYield(const Yield_T &iYield)
Definition: NestingNode.hpp:68
const std::string describeKey() const
const HolderMap_T & getHolderMap() const
Definition: NestingNode.hpp:56
Handle on the StdAir library context.
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
std::list< NestingNode * > NestingNodeList_T
BomList_T _bomList
Definition: BomHolder.hpp:111
std::list< BookingClass * > BookingClassList_T
Class representing the actual attributes for an airline segment-cabin.
Class representing the holder of BOM object containers (list and map).
Definition: BomHolder.hpp:24
const NestingStructureCode_T YIELD_BASED_NESTING_STRUCTURE_CODE
static void resetYieldBasedNestingStructure(const SegmentCabin &)