$treeview $search $mathjax
AirSched Logo  1.00.0
$projectbrief
$projectbrief
$searchbox

ScheduleParser.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 #include <string>
00007 // StdAir
00008 #include <stdair/basic/BasFileMgr.hpp>
00009 #include <stdair/bom/BomRoot.hpp>
00010 #include <stdair/service/Logger.hpp>
00011 // AirSched
00012 #include <airsched/command/SegmentPathGenerator.hpp>
00013 #include <airsched/command/ScheduleParserHelper.hpp>
00014 #include <airsched/command/ScheduleParser.hpp>
00015 
00016 namespace AIRSCHED {
00017 
00018   // //////////////////////////////////////////////////////////////////////
00019   void ScheduleParser::generateInventories
00020   (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     const bool doesExistAndIsReadable =
00027       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00028 
00029     if (doesExistAndIsReadable == false) {
00030       STDAIR_LOG_ERROR ("The schedule input file, '" << lFilename
00031                         << "', can not be retrieved on the file-system");
00032       throw ScheduleInputFileNotFoundException ("The schedule file " + lFilename
00033                                                 + " does not exist or can not "
00034                                                 "be read");
00035     }
00036 
00037     // Initialise the Flight-Period file parser.
00038     FlightPeriodFileParser lFlightPeriodParser (ioBomRoot, lFilename);
00039 
00040     // Parse the CSV-formatted schedule input file, and generate the
00041     // corresponding Inventories for the airlines.
00042     lFlightPeriodParser.generateInventories();
00043   }
00044 
00045 }