00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 // StdAir 00008 #include <stdair/basic/BasFileMgr.hpp> 00009 #include <stdair/bom/BomRoot.hpp> 00010 #include <stdair/service/Logger.hpp> 00011 // Airinv 00012 #include <airinv/command/InventoryParserHelper.hpp> 00013 #include <airinv/command/InventoryParser.hpp> 00014 #include <airinv/command/InventoryManager.hpp> 00015 00016 namespace AIRINV { 00017 00018 // ////////////////////////////////////////////////////////////////////// 00019 void InventoryParser:: 00020 buildInventory (const stdair::Filename_T& iInventoryFilename, 00021 stdair::BomRoot& ioBomRoot) { 00022 00023 // Check that the file path given as input corresponds to an actual file 00024 const bool doesExistAndIsReadable = 00025 stdair::BasFileMgr::doesExistAndIsReadable (iInventoryFilename); 00026 if (doesExistAndIsReadable == false) { 00027 std::ostringstream oMessage; 00028 oMessage << "The inventory input file, '" << iInventoryFilename 00029 << "', can not be retrieved on the file-system"; 00030 STDAIR_LOG_ERROR (oMessage.str()); 00031 throw InventoryInputFileNotFoundException (oMessage.str()); 00032 } 00033 00034 // Initialise the inventory file parser. 00035 InventoryFileParser lInventoryParser (ioBomRoot, iInventoryFilename); 00036 00037 // Parse the CSV-formatted inventory input file, and generate the 00038 // corresponding Inventory-related objects. 00039 lInventoryParser.buildInventory(); 00040 00041 // Complete the BomRoot BOM building: create the routings for all 00042 // the inventories. 00043 InventoryManager::createDirectAccesses (ioBomRoot); 00044 } 00045 00046 }