AirRAC Logo  0.1.2
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 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     if (doesExistAndIsReadable == false) {
00023       STDAIR_LOG_ERROR ("The yield input file, '" << iFilename
00024                         << "', can not be retrieved on the file-system");
00025       throw YieldInputFileNotFoundException ("The yield file '" + iFilename
00026                                              + "' does not exist or can not "
00027                                              "be read");
00028     }
00029 
00030     // Initialise the yield file parser.
00031     YieldFileParser lYieldParser (ioBomRoot, iFilename);
00032 
00033     // Parse the CSV-formatted yield store input file, and generate the
00034     // corresponding Yield-related objects.
00035     lYieldParser.generateYieldStore();
00036   }
00037 }