TraDemGen Logo  0.2.2
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
DemandParser.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/basic/RandomGeneration.hpp>
9 #include <stdair/bom/Inventory.hpp>
10 // TraDemGen
13 
14 namespace TRADEMGEN {
15 
16  // //////////////////////////////////////////////////////////////////////
17  void DemandParser::
18  generateDemand (const stdair::Filename_T& iFilename,
19  stdair::EventQueue& ioEventQueue,
20  stdair::RandomGeneration& ioSharedGenerator,
21  const POSProbabilityMass_T& iDefaultPOSProbablityMass) {
22 
23  // Check that the file path given as input corresponds to an actual file
24  const bool doesExistAndIsReadable =
25  stdair::BasFileMgr::doesExistAndIsReadable (iFilename);
26  if (doesExistAndIsReadable == false) {
27  STDAIR_LOG_ERROR ("The demand input file '" << iFilename
28  << "' does not exist or can not be read");
29 
30  throw DemandInputFileNotFoundException ("The demand file '" + iFilename
31  + "' does not exist or can not "
32  "be read");
33  }
34 
35  // Initialise the demand file parser.
36  DemandFileParser lDemandParser (ioEventQueue, ioSharedGenerator,
37  iDefaultPOSProbablityMass, iFilename);
38 
39  // Parse the CSV-formatted demand input file, and generate the
40  // corresponding DemandCharacteristic objects.
41  lDemandParser.generateDemand();
42  }
43 
44 }