SimFQT Logo  1.00.0
C++ Simulated Fare Quote System Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
FareParser.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <string>
7 // StdAir
8 #include <stdair/basic/BasFileMgr.hpp>
9 #include <stdair/service/Logger.hpp>
10 // AirSched
13 
14 namespace SIMFQT {
15 
16  // //////////////////////////////////////////////////////////////////////
17  void FareParser::fareRuleGeneration (const FareFilePath& iFareFilename,
18  stdair::BomRoot& ioBomRoot) {
19 
20  const stdair::Filename_T lFilename = iFareFilename.name();
21 
22  // Check that the file path given as input corresponds to an actual file
23  const bool doesExistAndIsReadable =
24  stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
25  if (doesExistAndIsReadable == false) {
26  STDAIR_LOG_ERROR ("The fare input file, '" << lFilename
27  << "', can not be retrieved on the file-system");
28  throw FareInputFileNotFoundException ("The fare input file '" + lFilename
29  + "' does not exist or can not "
30  "be read");
31  }
32 
33  // Initialise the fare file parser.
34  FareRuleFileParser lFareRuleFileParser (ioBomRoot, lFilename);
35 
36  // Parse the CSV-formatted fare input file and generate the
37  // corresponding fare rules.
38  lFareRuleFileParser.generateFareRules ();
39 
40  }
41 
42 }