7 #if BOOST_VERSION >= 104100
8 #include <boost/property_tree/ptree.hpp>
9 #include <boost/property_tree/json_parser.hpp>
10 #include <boost/foreach.hpp>
11 #endif // BOOST_VERSION >= 104100
33 : _pt (iConfigHolderStruct._pt) {
51 std::ostringstream oStr;
52 oStr <<
"Configuration Display:" << std::endl;
56 const bool hasStartDateBeenRetrieved =
57 exportValue<Date_T> (lStartDate,
"date.start");
58 if (hasStartDateBeenRetrieved ==
true) {
59 oStr <<
" Start date: " << lStartDate << std::endl;
62 const bool hasEndDateBeenRetrieved =
63 exportValue<Date_T> (lEndDate,
"date.end");
64 if (hasEndDateBeenRetrieved ==
true) {
65 oStr <<
" End date: " << lEndDate << std::endl;
70 const bool hasSeedBeenRetrieved =
71 exportValue<RandomSeed_T> (lRandomSeed,
"random.seed");
72 if (hasSeedBeenRetrieved ==
true) {
73 oStr <<
" Random Seed: " << lRandomSeed << std::endl;
78 const bool hasDemandGenMethodBeenRetrieved =
79 exportValue<char> (lChar,
"demand generation.method");
80 if (hasDemandGenMethodBeenRetrieved ==
true) {
81 oStr <<
" Demand Generation method: " << lChar << std::endl;
86 const bool hasNumberOfRunsBeenRetrieved =
87 exportValue<Count_T> (lTotalNumberOfRuns,
"runs.number");
88 if (hasNumberOfRunsBeenRetrieved ==
true) {
89 oStr <<
" Number Of Runs: " << lTotalNumberOfRuns << std::endl;
94 const bool hasScheduleFileBeenRetrieved =
95 exportValue<stdair::Filename_T> (lFilename,
"input.schedule");
96 if (hasScheduleFileBeenRetrieved ==
true) {
97 oStr <<
" Schedule input file: " << lFilename << std::endl;
99 const bool hasODFileBeenRetrieved =
100 exportValue<stdair::Filename_T> (lFilename,
"input.ond");
101 if (hasODFileBeenRetrieved ==
true) {
102 oStr <<
" OnD input file: " << lFilename << std::endl;
104 const bool hasFrat5FileBeenRetrieved =
105 exportValue<stdair::Filename_T> (lFilename,
"input.frat5");
106 if (hasFrat5FileBeenRetrieved ==
true) {
107 oStr <<
" Frat5 input file: " << lFilename << std::endl;
109 const bool hasFFdisutilityFileBeenRetrieved =
110 exportValue<stdair::Filename_T> (lFilename,
"input.ffdisutility");
111 if (hasFFdisutilityFileBeenRetrieved ==
true) {
112 oStr <<
" FFdisutility input file: " << lFilename << std::endl;
114 const bool hasYieldFileBeenRetrieved =
115 exportValue<stdair::Filename_T> (lFilename,
"input.yield");
116 if (hasYieldFileBeenRetrieved ==
true) {
117 oStr <<
" Yield input file: " << lFilename << std::endl;
119 const bool hasFareFileBeenRetrieved =
120 exportValue<stdair::Filename_T> (lFilename,
"input.fare");
121 if (hasFareFileBeenRetrieved ==
true) {
122 oStr <<
" Fare input file: " << lFilename << std::endl;
124 const bool hasDemandFileBeenRetrieved =
125 exportValue<stdair::Filename_T> (lFilename,
"input.demand");
126 if (hasDemandFileBeenRetrieved ==
true) {
127 oStr <<
" Demand input file: " << lFilename << std::endl;
135 std::ostringstream oStr;
136 #if BOOST_VERSION >= 104100
138 write_json (oStr, _pt);
139 #endif // BOOST_VERSION >= 104100
147 std::string lEmptyPath (
"");
148 add (iConfigPropertyTree, lEmptyPath);
153 const std::string& iPath) {
156 bool isThereAnyChild =
false;
158 #if BOOST_VERSION >= 104100
161 BOOST_FOREACH(bpt::ptree::value_type itChild, iConfigPropertyTree) {
163 isThereAnyChild =
true;
166 std::ostringstream lCurrentPathStr;
167 const bool isPathEmptyForNow = iPath.empty();
168 if (isPathEmptyForNow ==
false) {
169 lCurrentPathStr << iPath <<
".";
172 lCurrentPathStr << itChild.first.data();
173 const std::string lCurrentPath (lCurrentPathStr.str());
176 const bpt::ptree& lChildTree = itChild.second;
177 add(lChildTree, lCurrentPath);
182 if (isThereAnyChild ==
false) {
183 std::string lValue (iConfigPropertyTree.data());
184 const bool hasInsertionBeenSuccessful =
addValue (lValue, iPath);
185 assert (hasInsertionBeenSuccessful ==
true);
187 #endif // BOOST_VERSION >= 104100
192 const std::string& iPath) {
193 bool hasInsertionBeenSuccessful =
true;
196 #if BOOST_VERSION >= 104100
200 const std::string lPrefix (
"config");
201 std::string lFinalPath;
202 found = iPath.find(lPrefix);
203 if (found == std::string::npos) {
204 lFinalPath += lPrefix;
208 if (lFinalPath != lPrefix) {
209 _pt.put (lFinalPath, iValue);
211 }
catch (bpt::ptree_bad_data& bptException) {
212 hasInsertionBeenSuccessful =
false;
214 #endif // BOOST_VERSION >= 104100
216 return hasInsertionBeenSuccessful;
225 BOOST_FOREACH(bpt::ptree::value_type itChild, _pt) {
226 std::ostringstream lPathStr;
227 lPathStr << itChild.first.data() <<
".airline_code";
228 const bool hasAirlineCodeBeenRetrieved =
229 exportValue<AirlineCode_T> (lAirlineCode , lPathStr.str());
230 if (hasAirlineCodeBeenRetrieved ==
true) {
233 if (lAirlineFeature_ptr != NULL) {
237 std::ostringstream lPathStr;
241 lPathStr << itChild.first.data() <<
".forecasting_method";
242 const bool hasForecastingMethodBeenRetrieved =
243 exportValue<char> (lChar, lPathStr.str());
244 if (hasForecastingMethodBeenRetrieved ==
true) {
251 lPathStr << itChild.first.data() <<
".unconstraining_method";
252 const bool hasUnconstrainingMethodBeenRetrieved =
253 exportValue<char> (lChar, lPathStr.str());
254 if (hasUnconstrainingMethodBeenRetrieved ==
true) {
261 lPathStr << itChild.first.data() <<
".partnership_technique";
262 const bool hasPartnershipTechniqueBeenRetrieved =
263 exportValue<char> (lChar, lPathStr.str());
264 if (hasPartnershipTechniqueBeenRetrieved ==
true) {
271 lPathStr << itChild.first.data() <<
".pre_optimisation_method";
272 const bool hasPreOptMethodBeenRetrieved =
273 exportValue<char> (lChar, lPathStr.str());
274 if (hasPreOptMethodBeenRetrieved ==
true) {
281 lPathStr << itChild.first.data() <<
".optimisation_method";
282 const bool hasOptMethodBeenRetrieved =
283 exportValue<char> (lChar, lPathStr.str());
284 if (hasOptMethodBeenRetrieved ==
true) {
290 std::ostringstream oMessage;
291 oMessage <<
"Wrong input features for the airline '"
292 << lAirlineCode <<
"' in the input configuration file: "
293 << lCodeConversionException.
what();