StdAir Logo  1.00.8
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 }
stdair::BookingClassList_T
std::list< BookingClass * > BookingClassList_T
Definition: BookingClassTypes.hpp:17
FacBomManager.hpp
stdair::BomHolder
Class representing the holder of BOM object containers (list and map).
Definition: BomHolder.hpp:24
stdair::YIELD_BASED_NESTING_STRUCTURE_CODE
const NestingStructureCode_T YIELD_BASED_NESTING_STRUCTURE_CODE
stdair::NestingNode::getHolderMap
const HolderMap_T & getHolderMap() const
Definition: NestingNode.hpp:56
stdair::SimpleNestingStructure
Definition: SimpleNestingStructure.hpp:26
stdair::NestingNode::describeKey
const std::string describeKey() const
Definition: NestingNode.hpp:100
BookingClass.hpp
stdair::NestingNode
Definition: NestingNode.hpp:29
Logger.hpp
stdair::BookingClass
Definition: BookingClass.hpp:24
stdair::FacBomManager::resetYieldBasedNestingStructure
static void resetYieldBasedNestingStructure(const SegmentCabin &)
Definition: FacBomManager.cpp:20
stdair::SegmentCabin
Class representing the actual attributes for an airline segment-cabin.
Definition: SegmentCabin.hpp:39
stdair
Handle on the StdAir library context.
Definition: BasChronometer.cpp:9
stdair::HolderMap_T
std::map< const std::type_info *, BomAbstract * > HolderMap_T
Definition: BomAbstract.hpp:63
stdair::BomHolder::_bomList
BomList_T _bomList
Definition: BomHolder.hpp:111
BasConst_Inventory.hpp
SegmentCabin.hpp
stdair::NestingNodeList_T
std::list< NestingNode * > NestingNodeList_T
Definition: NestingNodeTypes.hpp:17
BomManager.hpp
stdair::NestingNode::setYield
void setYield(const Yield_T &iYield)
Definition: NestingNode.hpp:68
stdair::NonInitialisedContainerException
Definition: stdair_exceptions.hpp:73
SimpleNestingStructure.hpp
BasConst_General.hpp
NestingNode.hpp