AirSched Logo  0.1.4
C++ Simulated Airline Schedule Manager Library
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 // AirSched
00011 #include <airsched/command/SegmentPathGenerator.hpp>
00012 #include <airsched/command/ScheduleParserHelper.hpp>
00013 #include <airsched/command/ScheduleParser.hpp>
00014 
00015 namespace AIRSCHED {
00016 
00017   // //////////////////////////////////////////////////////////////////////
00018   void ScheduleParser::generateInventories (const stdair::Filename_T& iFilename,
00019                                             stdair::BomRoot& ioBomRoot) {
00020 
00021     // Check that the file path given as input corresponds to an actual file
00022     const bool doesExistAndIsReadable =
00023       stdair::BasFileMgr::doesExistAndIsReadable (iFilename);
00024 
00025     if (doesExistAndIsReadable == false) {
00026       throw ScheduleInputFileNotFoundException ("The schedule file " + iFilename
00027                                                 + " does not exist or can not "
00028                                                 "be read");
00029     }
00030 
00031     // Initialise the Flight-Period file parser.
00032     FlightPeriodFileParser lFlightPeriodParser (ioBomRoot, iFilename);
00033 
00034     // Parse the CSV-formatted schedule input file, and generate the
00035     // corresponding Inventories for the airlines.
00036     lFlightPeriodParser.generateInventories();
00037     
00038     // Build the network from the schedule.
00039     SegmentPathGenerator::createSegmentPathNetwork (ioBomRoot);
00040   }
00041 
00042 }