AirSched Logo  0.1.4
C++ Simulated Airline Schedule Manager Library
OnDParser.cpp
Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 // StdAir
00007 #include <stdair/basic/BasFileMgr.hpp>
00008 #include <stdair/bom/BomRoot.hpp>
00009 // AirSched
00010 #include <airsched/command/OnDParserHelper.hpp>
00011 #include <airsched/command/OnDParser.hpp>
00012 
00013 namespace AIRSCHED {
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   void OnDParser::generateOnDPeriods (const stdair::Filename_T& iFilename,
00017                                       stdair::BomRoot& ioBomRoot) {
00018 
00019     // Check that the file path given as input corresponds to an actual file
00020     const bool doesExistAndIsReadable =
00021       stdair::BasFileMgr::doesExistAndIsReadable (iFilename);
00022 
00023     if (doesExistAndIsReadable == false) {
00024       throw OnDInputFileNotFoundException ("The O&D file " + iFilename
00025                                            + " does not exist or can not be "
00026                                            "read");
00027     }
00028 
00029     // Initialise the O&D-Period file parser.
00030     OnDPeriodFileParser lOnDPeriodParser (iFilename, ioBomRoot);
00031 
00032     // Parse the CSV-formatted O&D input file, and generate the
00033     // corresponding O&D-Period for the airlines.
00034     lOnDPeriodParser.generateOnDPeriods();
00035   }
00036 
00037 }