TvlSim Logo  1.01.6
C++ Simulated Travel-Oriented Distribution System Library
Loading...
Searching...
No Matches
ConfigImport.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4#include <stdlib.h>
5// StdAir
6#include <stdair/STDAIR_Service.hpp>
7// AIRRAC
8#include <airrac/AIRRAC_Types.hpp>
9// SimFQT
10#include <simfqt/SIMFQT_Types.hpp>
11// TRADEMGEN
12#include <trademgen/TRADEMGEN_Types.hpp>
13// TVLSIM
16#include <tvlsim/config/tvlsim-paths.hpp>
17
18
19namespace TVLSIM {
20
21 // ////////////////////////////////////////////////////////////////////
22 void ConfigImport::importINI (stdair::STDAIR_Service& ioSTDAIR_Service,
23 const stdair::Date_T& iStartDate,
24 const stdair::Date_T& iEndDate,
25 const stdair::RandomSeed_T& iRandomSeed,
26 const stdair::DemandGenerationMethod& iDemandGenerationMethod,
27 const NbOfRuns_T& iNbOfRuns) {
28
29 // Import the start date, the end date, the random seed,
30 // the demand generation method and the number of runs in the
31 // configuration.
32 const std::string& lStartDateStr =
33 boost::gregorian::to_simple_string(iStartDate);
34 ioSTDAIR_Service.importConfigValue (lStartDateStr, "date.start");
35 const std::string& lEndDateStr =
36 boost::gregorian::to_simple_string(iEndDate);
37 ioSTDAIR_Service.importConfigValue (lEndDateStr, "date.end");
38 const std::string& lRandomSeedStr =
39 boost::lexical_cast<std::string> (iRandomSeed);
40 ioSTDAIR_Service.importConfigValue (lRandomSeedStr, "random.seed");
41 const std::string& lDemandGenerationMethodStr =
42 iDemandGenerationMethod.getMethodAsString();
43 ioSTDAIR_Service.importConfigValue (lDemandGenerationMethodStr,
44 "demand generation.method");
45 const std::string& lNbOfRunsStr =
46 boost::lexical_cast<std::string> (iNbOfRuns);
47 ioSTDAIR_Service.importConfigValue (lNbOfRunsStr,
48 "runs.number");
49
50 // Look for a config INI file (which may be present in the etc
51 // directory) and try to import the configuration
52 std::string lETCDirPath ("/etc/");
53 lETCDirPath += DEFAULT_CONFIG_INI_FILE.name();
54 const stdair::ConfigINIFile lETCDirConfigFile (lETCDirPath);
55 ioSTDAIR_Service.importINIConfig (lETCDirConfigFile);
56
57 // Look for a config INI file (which may be present in the home
58 // directory) and try to import the configuration
59 const char *lHomeDIR = getenv("HOME");
60 std::string lHomeDIRPath (lHomeDIR);
61 lHomeDIRPath += "/";
62 lHomeDIRPath += DEFAULT_CONFIG_INI_FILE.name();
63 const stdair::ConfigINIFile lConfigFile (lHomeDIRPath);
64 ioSTDAIR_Service.importINIConfig (lConfigFile);
65
66 // Look for a config INI file (which may be present in the current
67 // directory) and try to import the configuration
68 ioSTDAIR_Service.importINIConfig (DEFAULT_CONFIG_INI_FILE);
69
70 }
71
72 // ////////////////////////////////////////////////////////////////////
73 void ConfigImport::importFiles (stdair::STDAIR_Service& ioSTDAIR_Service,
74 const stdair::ScheduleFilePath& iScheduleInputFilename,
75 const stdair::ODFilePath& iODInputFilename,
76 const stdair::FRAT5FilePath& iFRAT5InputFilename,
77 const stdair::FFDisutilityFilePath& iFFDisutilityInputFilename,
78 const AIRRAC::YieldFilePath& iYieldInputFilepath,
79 const SIMFQT::FareFilePath& iFareInputFilepath,
80 const TRADEMGEN::DemandFilePath& iDemandFilepath) {
81
82 // Import the input files names into the configuration
83 ioSTDAIR_Service.importConfigValue (iScheduleInputFilename.name(),
84 "input.schedule");
85 ioSTDAIR_Service.importConfigValue (iODInputFilename.name(),
86 "input.ond");
87 ioSTDAIR_Service.importConfigValue (iFRAT5InputFilename.name(),
88 "input.frat5");
89 ioSTDAIR_Service.importConfigValue (iFFDisutilityInputFilename.name(),
90 "input.ffdisutility");
91 ioSTDAIR_Service.importConfigValue (iYieldInputFilepath.name(),
92 "input.yield");
93 ioSTDAIR_Service.importConfigValue (iFareInputFilepath.name(),
94 "input.fare");
95 ioSTDAIR_Service.importConfigValue (iDemandFilepath.name(),
96 "input.demand");
97 }
98
99}
static void importINI(stdair::STDAIR_Service &, const stdair::Date_T &iStartDate, const stdair::Date_T &iEndDate, const stdair::RandomSeed_T &, const stdair::DemandGenerationMethod &, const NbOfRuns_T &)
static void importFiles(stdair::STDAIR_Service &, const stdair::ScheduleFilePath &, const stdair::ODFilePath &, const stdair::FRAT5FilePath &, const stdair::FFDisutilityFilePath &, const AIRRAC::YieldFilePath &, const SIMFQT::FareFilePath &, const TRADEMGEN::DemandFilePath &)
unsigned int NbOfRuns_T
const stdair::ConfigINIFile DEFAULT_CONFIG_INI_FILE