SimFQT Logo  0.1.2
C++ Simulated Fare Quote System Library
FareParser.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/Inventory.hpp>
00010 #include <stdair/service/Logger.hpp>
00011 // AirSched
00012 #include <simfqt/command/FareParserHelper.hpp>
00013 #include <simfqt/command/FareParser.hpp>
00014 
00015 namespace SIMFQT {
00016 
00017   // //////////////////////////////////////////////////////////////////////
00018   void FareParser::fareRuleGeneration (const FareFilePath& iFareFilename,
00019                                        stdair::BomRoot& ioBomRoot) {
00020 
00021     const stdair::Filename_T lFilename = iFareFilename.name();
00022 
00023     // Check that the file path given as input corresponds to an actual file
00024     const bool doesExistAndIsReadable =
00025       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00026     if (doesExistAndIsReadable == false) {
00027       STDAIR_LOG_ERROR ("The fare input file, '" << lFilename
00028                         << "', can not be retrieved on the file-system");
00029       throw FareInputFileNotFoundException ("The fare input file '" + lFilename
00030                                             + "' does not exist or can not "
00031                                             "be read");
00032     }
00033 
00034     // Initialise the fare file parser.
00035     FareRuleFileParser lFareRuleFileParser (ioBomRoot, lFilename);
00036 
00037     // Parse the CSV-formatted fare input file and generate the
00038     // corresponding fare rules.
00039     lFareRuleFileParser.generateFareRules ();
00040 
00041   }
00042 
00043 }