$treeview $search $mathjax
00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 // StdAir 00007 #include <stdair/basic/BasConst_General.hpp> 00008 #include <stdair/basic/BasConst_Inventory.hpp> 00009 #include <stdair/bom/BomManager.hpp> 00010 #include <stdair/bom/SegmentCabin.hpp> 00011 #include <stdair/bom/SimpleNestingStructure.hpp> 00012 #include <stdair/bom/NestingNode.hpp> 00013 #include <stdair/bom/BookingClass.hpp> 00014 #include <stdair/factory/FacBomManager.hpp> 00015 #include <stdair/service/Logger.hpp> 00016 00017 namespace stdair { 00018 // //////////////////////////////////////////////////////////////////// 00019 void FacBomManager:: 00020 resetYieldBasedNestingStructure (const SegmentCabin& iSegmentCabin) { 00021 const SimpleNestingStructure& lYieldBasedNS = 00022 BomManager::getObject<SimpleNestingStructure> (iSegmentCabin, YIELD_BASED_NESTING_STRUCTURE_CODE); 00023 00024 // Browse the list of node and reset each one. 00025 const NestingNodeList_T& lNestingNodeList = 00026 BomManager::getList<NestingNode> (lYieldBasedNS); 00027 for (NestingNodeList_T::const_iterator itNode = lNestingNodeList.begin(); 00028 itNode != lNestingNodeList.end(); ++itNode) { 00029 stdair::NestingNode* lNode_ptr = *itNode; 00030 assert (lNode_ptr != NULL); 00031 00032 lNode_ptr->setYield (-1.0); 00033 00034 // Clear the list of booking classes of the node 00035 const HolderMap_T& lHolderMap = lNode_ptr->getHolderMap(); 00036 HolderMap_T::const_iterator itHolder = lHolderMap.find (&typeid (BookingClass)); 00037 00038 if (itHolder == lHolderMap.end()) { 00039 const std::string lName (typeid (BookingClass).name()); 00040 throw NonInitialisedContainerException("Cannot find the holder of type " 00041 + lName + " within: " 00042 + lNode_ptr->describeKey()); 00043 } 00044 00045 BomHolder<BookingClass>* lBomHolder_ptr = 00046 static_cast<BomHolder<BookingClass>*> (itHolder->second); 00047 assert (lBomHolder_ptr != NULL); 00048 00049 BookingClassList_T& lBCList = lBomHolder_ptr->_bomList; 00050 lBCList.clear(); 00051 } 00052 } 00053 00054 }