TraDemGen Logo  1.00.8
C++ Simulated Travel Demand Generation Library
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
14namespace TRADEMGEN {
15
16 // //////////////////////////////////////////////////////////////////////
18 generateDemand (const DemandFilePath& iDemandFilename,
19 SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
20 stdair::RandomGeneration& ioSharedGenerator,
21 const POSProbabilityMass_T& iDefaultPOSProbablityMass) {
22
23 const stdair::Filename_T lFilename = iDemandFilename.name();
24
25 // Check that the file path given as input corresponds to an actual file
26 const bool doesExistAndIsReadable =
27 stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
28 if (doesExistAndIsReadable == false) {
29 STDAIR_LOG_ERROR ("The demand input file '" << lFilename
30 << "' does not exist or can not be read");
31
32 throw DemandInputFileNotFoundException ("The demand file '" + lFilename
33 + "' does not exist or can not "
34 "be read");
35 }
36
37 // Initialise the demand file parser.
38 DemandFileParser lDemandParser (ioSEVMGR_ServicePtr, ioSharedGenerator,
39 iDefaultPOSProbablityMass, lFilename);
40
41 // Parse the CSV-formatted demand input file, and generate the
42 // corresponding DemandCharacteristic objects.
43 lDemandParser.generateDemand();
44 }
45
46}
static void generateDemand(const DemandFilePath &, SEVMGR::SEVMGR_ServicePtr_T, stdair::RandomGeneration &, const POSProbabilityMass_T &)