$treeview $search $mathjax
AirInv Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

InventoryParser.cpp

Go to the documentation of this file.
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 InventoryFilePath& iInventoryFilename,
00021                   stdair::BomRoot& ioBomRoot) {
00022 
00023     const stdair::Filename_T lFilename = iInventoryFilename.name();
00024 
00025     // Check that the file path given as input corresponds to an actual file
00026     const bool doesExistAndIsReadable =
00027       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00028     if (doesExistAndIsReadable == false) {
00029       std::ostringstream oMessage;
00030       oMessage << "The inventory input file, '" << lFilename
00031                << "', can not be retrieved on the file-system";
00032       STDAIR_LOG_ERROR (oMessage.str());
00033       throw InventoryInputFileNotFoundException (oMessage.str());
00034     }
00035 
00036     // Initialise the inventory file parser.
00037     InventoryFileParser lInventoryParser (ioBomRoot, lFilename);
00038 
00039     // Parse the CSV-formatted inventory input file, and generate the
00040     // corresponding Inventory-related objects.
00041     lInventoryParser.buildInventory();
00042   }
00043 
00044 }