9 #include <stdair/stdair_exceptions.hpp>
10 #include <stdair/basic/BasConst_TravelSolution.hpp>
11 #include <stdair/basic/BasFileMgr.hpp>
12 #include <stdair/bom/BomRoot.hpp>
13 #include <stdair/service/Logger.hpp>
22 bool hasReadBeenSuccessful =
false;
25 const bool doesExistAndIsReadable =
26 stdair::BasFileMgr::doesExistAndIsReadable (iInputFileName);
27 if (doesExistAndIsReadable ==
false) {
28 std::ostringstream oMessage;
29 oMessage <<
"The input file, '" << iInputFileName
30 <<
"', can not be retrieved on the file-system";
31 throw stdair::FileNotFoundException (oMessage.str());
35 std::ifstream inputFile (iInputFileName.c_str());
37 STDAIR_LOG_ERROR (
"Can not open input file '" << iInputFileName <<
"'");
38 throw new stdair::FileNotFoundException (
"Can not open input file '"
39 + iInputFileName +
"'");
46 bool hasAllPArams =
true;
48 stdair::AirportCode_T dAirport;
49 stdair::AirportCode_T aAirport;
50 stdair::Date_T depDate;
51 stdair::Duration_T depTime;
52 stdair::Duration_T arTime;
53 stdair::Duration_T dur;
55 stdair::AirlineCode_T airline;
56 stdair::CabinCode_T cabin;
63 while (inputFile.getline (buffer, sizeof (buffer),
';')) {
64 std::istringstream iStringStr (buffer);
67 iStringStr >> dvalStr;
84 depDate = boost::gregorian::from_simple_string (dvalStr);
88 depTime = boost::posix_time::duration_from_string (dvalStr);
91 arTime = boost::posix_time::duration_from_string (dvalStr);
94 dur = boost::posix_time::duration_from_string (dvalStr);
107 }
else if (i == 10) {
110 }
else if (i == 11) {
113 }
else if (i == 12) {
116 }
else if (i == 13) {
121 }
else if (i == 14) {
132 if (hasAllPArams && i == 1) {
133 STDAIR_LOG_DEBUG (
"Successfully read");
137 if (!inputFile.eof()) {
138 STDAIR_LOG_ERROR (
"Problem when reading input file '" << iInputFileName
140 return hasReadBeenSuccessful;
144 hasReadBeenSuccessful =
true;
145 return hasReadBeenSuccessful;