$treeview $search $mathjax
TraDemGen Logo  1.00.2
$projectbrief
$projectbrief
$searchbox

DemandParser.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 // STL
00005 #include <cassert>
00006 // StdAir
00007 #include <stdair/basic/BasFileMgr.hpp>
00008 #include <stdair/basic/RandomGeneration.hpp>
00009 #include <stdair/bom/Inventory.hpp>
00010 // TraDemGen
00011 #include <trademgen/command/DemandParserHelper.hpp>
00012 #include <trademgen/command/DemandParser.hpp>
00013 
00014 namespace TRADEMGEN {
00015 
00016   // //////////////////////////////////////////////////////////////////////
00017   void DemandParser::
00018   generateDemand (const DemandFilePath& iDemandFilename,
00019                   SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
00020                   stdair::RandomGeneration& ioSharedGenerator,
00021                   const POSProbabilityMass_T& iDefaultPOSProbablityMass) {
00022 
00023     const stdair::Filename_T lFilename = iDemandFilename.name();
00024 
00025     // Check that the file path given as input corresponds to an actual file
00026     const bool doesExistAndIsReadable =
00027       stdair::BasFileMgr::doesExistAndIsReadable (lFilename);
00028     if (doesExistAndIsReadable == false) {
00029       STDAIR_LOG_ERROR ("The demand input file '" << lFilename
00030                         << "' does not exist or can not be read");
00031       
00032       throw DemandInputFileNotFoundException ("The demand file '" + lFilename
00033                                               + "' does not exist or can not "
00034                                               "be read");
00035     }
00036 
00037     // Initialise the demand file parser.
00038     DemandFileParser lDemandParser (ioSEVMGR_ServicePtr, ioSharedGenerator,
00039                                     iDefaultPOSProbablityMass, lFilename);
00040 
00041     // Parse the CSV-formatted demand input file, and generate the
00042     // corresponding DemandCharacteristic objects.
00043     lDemandParser.generateDemand();
00044   }
00045 
00046 }