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

ScheduleParser.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/ScheduleParserHelper.hpp>
00013 #include <airinv/command/ScheduleParser.hpp>
00014 #include <airinv/command/InventoryManager.hpp>
00015 
00016 namespace AIRINV {
00017 
00018   // //////////////////////////////////////////////////////////////////////
00019   void ScheduleParser::
00020   generateInventories (const stdair::ScheduleFilePath& iScheduleFilename,
00021                        stdair::BomRoot& ioBomRoot) {
00022 
00023     const stdair::Filename_T lFilename = iScheduleFilename.name();
00024 
00025     // Check that the file path given as input corresponds to an actual file
00026     bool doesExistAndIsReadable =
00027       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00028     if (doesExistAndIsReadable == false) {
00029       std::ostringstream oMessage;
00030       oMessage << "The schedule input file, '" << lFilename
00031                << "', can not be retrieved on the file-system";
00032       STDAIR_LOG_ERROR (oMessage.str());
00033       throw ScheduleInputFileNotFoundException (oMessage.str());
00034     }
00035 
00036     // Initialise the Flight-Period file parser.
00037     FlightPeriodFileParser lFlightPeriodParser (ioBomRoot, lFilename);
00038 
00039     // Parse the CSV-formatted schedule input file, and generate the
00040     // corresponding Inventories for the airlines.
00041     lFlightPeriodParser.generateInventories ();
00042 
00043   }
00044 
00045 }