AirRAC Logo  0.2.1
C++ Simulated Revenue Accounting (RAC) System Library
YieldParser.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 // AirRAC
00010 #include <airrac/command/YieldParserHelper.hpp>
00011 #include <airrac/command/YieldParser.hpp>
00012 
00013 namespace AIRRAC {
00014 
00015   // //////////////////////////////////////////////////////////////////////
00016   void YieldParser::generateYieldStore (const YieldFilePath& iYieldFilename,
00017                                         stdair::BomRoot& ioBomRoot) {
00018 
00019     const stdair::Filename_T lFilename = iYieldFilename.name();
00020 
00021     // Check that the file path given as input corresponds to an actual file
00022     const bool doesExistAndIsReadable =
00023       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00024     if (doesExistAndIsReadable == false) {
00025       STDAIR_LOG_ERROR ("The yield input file, '" << lFilename
00026                         << "', can not be retrieved on the file-system");
00027       throw YieldInputFileNotFoundException ("The yield file '" + lFilename
00028                                              + "' does not exist or can not "
00029                                              "be read");
00030     }
00031 
00032     // Initialise the yield file parser.
00033     YieldFileParser lYieldParser (ioBomRoot, lFilename);
00034 
00035     // Parse the CSV-formatted yield store input file, and generate the
00036     // corresponding Yield-related objects.
00037     lYieldParser.generateYieldStore();
00038   }
00039 }