AirTSP Logo  1.01.0
C++ Simulated Airline Travel Solution Provider Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OnDParser.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 // StdAir
7 #include <stdair/basic/BasFileMgr.hpp>
8 #include <stdair/service/Logger.hpp>
9 #include <stdair/bom/BomRoot.hpp>
10 // AirTSP
13 
14 namespace AIRTSP {
15 
16  // //////////////////////////////////////////////////////////////////////
17  void OnDParser::generateOnDPeriods (const stdair::ODFilePath& iODFilename,
18  stdair::BomRoot& ioBomRoot) {
19 
20  const stdair::Filename_T lFilename = iODFilename.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 
26  if (doesExistAndIsReadable == false) {
27  STDAIR_LOG_ERROR ("The O&D input file, '" << lFilename
28  << "', can not be retrieved on the file-system");
29  throw OnDInputFileNotFoundException ("The O&D file " + lFilename
30  + " does not exist or can not be "
31  "read");
32  }
33 
34  // Initialise the O&D-Period file parser.
35  OnDPeriodFileParser lOnDPeriodParser (lFilename, ioBomRoot);
36 
37  // Parse the CSV-formatted O&D input file, and generate the
38  // corresponding O&D-Period for the airlines.
39  lOnDPeriodParser.generateOnDPeriods();
40  }
41 
42 }