$treeview $search $mathjax
AirTSP Logo  1.01.2
$projectbrief
$projectbrief
$searchbox

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/service/Logger.hpp>
00009 #include <stdair/bom/BomRoot.hpp>
00010 // AirTSP
00011 #include <airtsp/command/OnDParserHelper.hpp>
00012 #include <airtsp/command/OnDParser.hpp>
00013 
00014 namespace AIRTSP {
00015 
00016   // //////////////////////////////////////////////////////////////////////
00017   void OnDParser::generateOnDPeriods (const stdair::ODFilePath& iODFilename,
00018                                       stdair::BomRoot& ioBomRoot) {
00019 
00020     const stdair::Filename_T lFilename = iODFilename.name();
00021 
00022     // Check that the file path given as input corresponds to an actual file
00023     const bool doesExistAndIsReadable =
00024       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00025 
00026     if (doesExistAndIsReadable == false) {
00027       STDAIR_LOG_ERROR ("The O&D input file, '" << lFilename
00028                         << "', can not be retrieved on the file-system");
00029       throw OnDInputFileNotFoundException ("The O&D file " + lFilename
00030                                            + " does not exist or can not be "
00031                                            "read");
00032     }
00033 
00034     // Initialise the O&D-Period file parser.
00035     OnDPeriodFileParser lOnDPeriodParser (lFilename, ioBomRoot);
00036 
00037     // Parse the CSV-formatted O&D input file, and generate the
00038     // corresponding O&D-Period for the airlines.
00039     lOnDPeriodParser.generateOnDPeriods();
00040   }
00041 
00042 }