SimFQT Logo  0.1.3
C++ Simulated Fare Quote System Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
FareParserHelper.cpp
Go to the documentation of this file.
1  // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <vector>
7 #include <fstream>
8 // StdAir
9 #include <stdair/basic/BasFileMgr.hpp>
10 #include <stdair/bom/BomRoot.hpp>
11 #include <stdair/service/Logger.hpp>
12 //#define BOOST_SPIRIT_DEBUG
13 #include <stdair/basic/BasParserTypes.hpp>
14 // SIMFQT
17 
18 
19 
20 namespace SIMFQT {
21 
22  namespace FareParserHelper {
23 
24  // //////////////////////////////////////////////////////////////////
25  // Semantic actions
26  // //////////////////////////////////////////////////////////////////
27 
30  : _fareRule (ioFareRule) {
31  }
32 
33  // //////////////////////////////////////////////////////////////////
36  : ParserSemanticAction (ioFareRule) {
37  }
38 
39  // //////////////////////////////////////////////////////////////////
40  void storeFareId::operator() (unsigned int iFareId,
41  boost::spirit::qi::unused_type,
42  boost::spirit::qi::unused_type) const {
43  _fareRule.setFareID (iFareId);
44 
45  // DEBUG
46  //STDAIR_LOG_DEBUG ( "Fare Id: " << _fareRule.getFareID ());
47  const stdair::AirlineCode_T lEmptyAirlineCode ("");
48  _fareRule.setAirlineCode(lEmptyAirlineCode);
50  const stdair::ClassCode_T lEmptyClassCode ("");
51  _fareRule.setClassCode(lEmptyClassCode);
53  _fareRule._itSeconds = 0;
54  }
55 
56  // //////////////////////////////////////////////////////////////////
59  : ParserSemanticAction (ioFareRule) {
60  }
61 
62  // //////////////////////////////////////////////////////////////////
63  void storeOrigin::operator() (std::vector<char> iChar,
64  boost::spirit::qi::unused_type,
65  boost::spirit::qi::unused_type) const {
66  const stdair::AirportCode_T lOrigin (iChar.begin(), iChar.end());
67  _fareRule.setOrigin (lOrigin);
68  // DEBUG
69  //STDAIR_LOG_DEBUG ( "Origin: " << _fareRule.getOrigin ());
70  }
71 
72  // //////////////////////////////////////////////////////////////////
75  : ParserSemanticAction (ioFareRule) {
76  }
77 
78  // //////////////////////////////////////////////////////////////////
79  void storeDestination::operator() (std::vector<char> iChar,
80  boost::spirit::qi::unused_type,
81  boost::spirit::qi::unused_type) const {
82  const stdair::AirportCode_T lDestination (iChar.begin(), iChar.end());
83  _fareRule.setDestination (lDestination);
84  // DEBUG
85  //STDAIR_LOG_DEBUG ( "Destination: " << _fareRule.getDestination ());
86  }
87 
88  // //////////////////////////////////////////////////////////////////
91  : ParserSemanticAction (ioFareRule) {
92  }
93 
94  // //////////////////////////////////////////////////////////////////
95  void storeTripType::operator() (std::vector<char> iChar,
96  boost::spirit::qi::unused_type,
97  boost::spirit::qi::unused_type) const {
98  const stdair::TripType_T lTripType (iChar.begin(), iChar.end());
99  if (lTripType == "OW" || lTripType == "RT") {
100  _fareRule.setTripType (lTripType);
101  } else {
102  // ERROR
103  STDAIR_LOG_ERROR ("Invalid trip type " << lTripType);
104  }
105  // DEBUG
106  //STDAIR_LOG_DEBUG ("TripType: " << _fareRule.getTripType ());
107  }
108 
109 
110  // //////////////////////////////////////////////////////////////////
113  : ParserSemanticAction (ioFareRule) {
114  }
115 
116  // //////////////////////////////////////////////////////////////////
117  void storeDateRangeStart::operator() (boost::spirit::qi::unused_type,
118  boost::spirit::qi::unused_type,
119  boost::spirit::qi::unused_type) const {
120  const stdair::Date_T& lDateStart = _fareRule.calculateDate ();
121  _fareRule.setDateRangeStart (lDateStart);
122  // DEBUG
123  //STDAIR_LOG_DEBUG ("Date Range Start: " << _fareRule.getDateRangeStart ());
124  }
125 
126  // //////////////////////////////////////////////////////////////////
129  : ParserSemanticAction (ioFareRule) {
130  }
131 
132  // //////////////////////////////////////////////////////////////////
133  void storeDateRangeEnd::operator() (boost::spirit::qi::unused_type,
134  boost::spirit::qi::unused_type,
135  boost::spirit::qi::unused_type) const {
136  const stdair::Date_T& lDateEnd = _fareRule.calculateDate ();
137  // As a Boost date period (DatePeriod_T) defines the last day of
138  // the period to be end-date - one day, we have to add one day to that
139  // end date before.
140  const stdair::DateOffset_T oneDay (1);
141  const stdair::Date_T lBoostDateEnd = lDateEnd + oneDay;
142  _fareRule.setDateRangeEnd (lBoostDateEnd);
143  // DEBUG
144  //STDAIR_LOG_DEBUG ("Date Range End: " << _fareRule.getDateRangeEnd ());
145  }
146 
147  // //////////////////////////////////////////////////////////////////
150  : ParserSemanticAction (ioFareRule) {
151  }
152 
153  // //////////////////////////////////////////////////////////////////
154  void storeStartRangeTime::operator() (boost::spirit::qi::unused_type,
155  boost::spirit::qi::unused_type,
156  boost::spirit::qi::unused_type) const {
157  const stdair::Duration_T& lTimeStart = _fareRule.calculateTime ();
158  _fareRule.setTimeRangeStart (lTimeStart);
159  // DEBUG
160  //STDAIR_LOG_DEBUG ("Time Range Start: " << _fareRule.getTimeRangeStart ());
161  // Reset the number of seconds
162  _fareRule._itSeconds = 0;
163  }
164 
165  // //////////////////////////////////////////////////////////////////
168  : ParserSemanticAction (ioFareRule) {
169  }
170 
171  // //////////////////////////////////////////////////////////////////
172  void storeEndRangeTime::operator() (boost::spirit::qi::unused_type,
173  boost::spirit::qi::unused_type,
174  boost::spirit::qi::unused_type) const {
175  const stdair::Duration_T& lTimeEnd = _fareRule.calculateTime ();
176  _fareRule.setTimeRangeEnd (lTimeEnd);
177  // DEBUG
178  //STDAIR_LOG_DEBUG ("Time Range End: " << _fareRule.getTimeRangeEnd ());
179  // Reset the number of seconds
180  _fareRule._itSeconds = 0;
181  }
182 
183  // //////////////////////////////////////////////////////////////////
186  : ParserSemanticAction (ioFareRule) {
187  }
188 
189  // //////////////////////////////////////////////////////////////////
190  void storePOS::operator() (std::vector<char> iChar,
191  boost::spirit::qi::unused_type,
192  boost::spirit::qi::unused_type) const {
193  const stdair::CityCode_T lPOS (iChar.begin(), iChar.end());
194  if (lPOS == _fareRule.getOrigin() || lPOS == _fareRule.getDestination()) {
195  _fareRule.setPOS (lPOS);
196  } else if (lPOS == "ROW") {
197  const stdair::CityCode_T lPOSROW ("ROW");
198  _fareRule.setPOS (lPOSROW);
199  } else {
200  // ERROR
201  STDAIR_LOG_ERROR ("Invalid point of sale " << lPOS);
202  }
203  // DEBUG
204  //STDAIR_LOG_DEBUG ("POS: " << _fareRule.getPOS ());
205  }
206 
207  // //////////////////////////////////////////////////////////////////
210  : ParserSemanticAction (ioFareRule) {
211  }
212 
213  // //////////////////////////////////////////////////////////////////
215  boost::spirit::qi::unused_type,
216  boost::spirit::qi::unused_type) const {
217  std::ostringstream ostr;
218  ostr << iChar;
219  const std::string cabinCodeStr = ostr.str();
220  const stdair::CabinCode_T& lCabinCode (cabinCodeStr);
221  _fareRule.setCabinCode (lCabinCode);
222 
223  // DEBUG
224  //STDAIR_LOG_DEBUG ("Cabin Code: " << _fareRule.getCabinCode ());
225 
226  }
227 
228  // //////////////////////////////////////////////////////////////////
231  : ParserSemanticAction (ioFareRule) {
232  }
233 
234  // //////////////////////////////////////////////////////////////////
235  void storeChannel::operator() (std::vector<char> iChar,
236  boost::spirit::qi::unused_type,
237  boost::spirit::qi::unused_type) const {
238  const stdair::ChannelLabel_T lChannel (iChar.begin(), iChar.end());
239  if (lChannel != "IN" && lChannel != "IF"
240  && lChannel != "DN" && lChannel != "DF") {
241  // ERROR
242  STDAIR_LOG_ERROR ("Invalid channel " << lChannel);
243  }
244  _fareRule.setChannel (lChannel);
245  // DEBUG
246  //STDAIR_LOG_DEBUG ("Channel: " << _fareRule.getChannel ());
247  }
248 
249  // //////////////////////////////////////////////////////////////////
252  : ParserSemanticAction (ioFareRule) {
253  }
254 
255  // //////////////////////////////////////////////////////////////////
256  void storeAdvancePurchase::operator() (unsigned int iAdancePurchase,
257  boost::spirit::qi::unused_type,
258  boost::spirit::qi::unused_type) const {
259  const stdair::DayDuration_T& lAdancePurchase = iAdancePurchase;
260  _fareRule.setAdvancePurchase (lAdancePurchase);
261  // DEBUG
262  //STDAIR_LOG_DEBUG ( "Advance Purchase: " << _fareRule.getAdvancePurchase ());
263  }
264 
265  // //////////////////////////////////////////////////////////////////
268  : ParserSemanticAction (ioFareRule) {
269  }
270 
271  // //////////////////////////////////////////////////////////////////
272  void storeSaturdayStay::operator() (char iSaturdayStay,
273  boost::spirit::qi::unused_type,
274  boost::spirit::qi::unused_type) const {
275  bool lBool = false;
276  if (iSaturdayStay == 'T') {
277  lBool = true;
278  } else {
279  if (iSaturdayStay != 'F') {
280  // DEBUG
281  STDAIR_LOG_DEBUG ("Invalid saturdayStay char " << iSaturdayStay);
282  }
283  }
284  const stdair::SaturdayStay_T lSaturdayStay (lBool);
285  _fareRule.setSaturdayStay (lSaturdayStay);
286  // DEBUG
287  //STDAIR_LOG_DEBUG ("Saturday Stay: " << _fareRule.getSaturdayStay ());
288  }
289 
290  // //////////////////////////////////////////////////////////////////
293  : ParserSemanticAction (ioFareRule) {
294  }
295 
296  // //////////////////////////////////////////////////////////////////
297  void storeChangeFees::operator() (char iChangefees,
298  boost::spirit::qi::unused_type,
299  boost::spirit::qi::unused_type) const {
300 
301  bool lBool = false;
302  if (iChangefees == 'T') {
303  lBool = true;
304  } else {
305  if (iChangefees != 'F') {
306  // DEBUG
307  STDAIR_LOG_DEBUG ("Invalid change fees char " << iChangefees);
308  }
309  }
310  const stdair::ChangeFees_T lChangefees (lBool);
311  _fareRule.setChangeFees (lChangefees);
312  // DEBUG
313  //STDAIR_LOG_DEBUG ("Change fees: " << _fareRule.getChangeFees ());
314  }
315 
316  // //////////////////////////////////////////////////////////////////
319  : ParserSemanticAction (ioFareRule) {
320  }
321 
322  // //////////////////////////////////////////////////////////////////
323  void storeNonRefundable::operator() (char iNonRefundable,
324  boost::spirit::qi::unused_type,
325  boost::spirit::qi::unused_type) const {
326  bool lBool = false;
327  if (iNonRefundable == 'T') {
328  lBool = true;
329  } else {
330  if (iNonRefundable != 'F') {
331  // DEBUG
332  STDAIR_LOG_DEBUG ("Invalid non refundable char " << iNonRefundable);
333  }
334  }
335  const stdair::NonRefundable_T lNonRefundable (lBool);
336  _fareRule.setNonRefundable (lNonRefundable);
337  // DEBUG
338  //STDAIR_LOG_DEBUG ("Non refundable: " << _fareRule.getNonRefundable ());
339  }
340 
341  // //////////////////////////////////////////////////////////////////
344  : ParserSemanticAction (ioFareRule) {
345  }
346 
347  // //////////////////////////////////////////////////////////////////
348  void storeMinimumStay::operator() (unsigned int iMinStay,
349  boost::spirit::qi::unused_type,
350  boost::spirit::qi::unused_type) const {
351  const stdair::DayDuration_T lMinStay = iMinStay;
352  _fareRule.setMinimumStay (lMinStay);
353  // DEBUG
354  //STDAIR_LOG_DEBUG ("Minimum Stay: " << _fareRule.getMinimumStay ());
355  }
356 
357  // //////////////////////////////////////////////////////////////////
360  : ParserSemanticAction (ioFareRule) {
361  }
362 
363  // //////////////////////////////////////////////////////////////////
364  void storeFare::operator() (double iFare,
365  boost::spirit::qi::unused_type,
366  boost::spirit::qi::unused_type) const {
367  const stdair::PriceValue_T lFare = iFare;
368  _fareRule.setFare (lFare);
369  // DEBUG
370  //STDAIR_LOG_DEBUG ("Fare: " << _fareRule.getFare ());
371  }
372 
373  // //////////////////////////////////////////////////////////////////
376  : ParserSemanticAction (ioFareRule) {
377  }
378 
379  // //////////////////////////////////////////////////////////////////
380  void storeAirlineCode::operator() (std::vector<char> iChar,
381  boost::spirit::qi::unused_type,
382  boost::spirit::qi::unused_type) const {
383 
384  const stdair::AirlineCode_T lAirlineCode (iChar.begin(), iChar.end());
385  // Insertion of this airline Code list in the whole AirlineCode name
386  _fareRule.addAirlineCode (lAirlineCode);
387  // DEBUG
388  //STDAIR_LOG_DEBUG ( "Airline code: " << lAirlineCode);
389  }
390 
391  // //////////////////////////////////////////////////////////////////
394  : ParserSemanticAction (ioFareRule) {
395  }
396 
397  // //////////////////////////////////////////////////////////////////
398  void storeClass::operator() (std::vector<char> iChar,
399  boost::spirit::qi::unused_type,
400  boost::spirit::qi::unused_type) const {
401  std::ostringstream ostr;
402  for (std::vector<char>::const_iterator lItVector = iChar.begin();
403  lItVector != iChar.end();
404  lItVector++) {
405  ostr << *lItVector;
406  }
407  const std::string classCodeStr = ostr.str();
408  const stdair::ClassCode_T lClassCode (classCodeStr);
409  // Insertion of this class Code list in the whole classCode name
410  _fareRule.addClassCode (lClassCode);
411  // DEBUG
412  //STDAIR_LOG_DEBUG ("Class Code: " << lClassCode);
413  }
414 
415  // //////////////////////////////////////////////////////////////////
417  doEndFare (stdair::BomRoot& ioBomRoot,
418  FareRuleStruct& ioFareRule)
419  : ParserSemanticAction (ioFareRule),
420  _bomRoot (ioBomRoot) {
421  }
422 
423  // //////////////////////////////////////////////////////////////////
424  void doEndFare::operator() (boost::spirit::qi::unused_type,
425  boost::spirit::qi::unused_type,
426  boost::spirit::qi::unused_type) const {
427  // DEBUG
428  //STDAIR_LOG_DEBUG ("Do End");
429  // Generation of the fare rule object.
430  FareRuleGenerator::createAirportPair (_bomRoot, _fareRule);
431  STDAIR_LOG_DEBUG(_fareRule.describe());
432  }
433 
434  // ///////////////////////////////////////////////////////////////////
435  //
436  // Utility Parsers
437  //
438  // ///////////////////////////////////////////////////////////////////
440  namespace bsq = boost::spirit::qi;
441  namespace bsa = boost::spirit::ascii;
442 
444  stdair::int1_p_t int1_p;
445 
447  stdair::uint2_p_t uint2_p;
448 
450  stdair::uint4_p_t uint4_p;
451 
453  stdair::uint1_4_p_t uint1_4_p;
454 
456  stdair::hour_p_t hour_p;
457  stdair::minute_p_t minute_p;
458  stdair::second_p_t second_p;
459 
461  stdair::year_p_t year_p;
462  stdair::month_p_t month_p;
463  stdair::day_p_t day_p;
464 
466  //
467  // (Boost Spirit) Grammar Definition
468  //
470 
499  template <typename Iterator>
500  struct FareRuleParser :
501  public boost::spirit::qi::grammar<Iterator,
502  boost::spirit::ascii::space_type> {
503 
504  FareRuleParser (stdair::BomRoot& ioBomRoot,
505  FareRuleStruct& iofareRule) :
506 
507  FareRuleParser::base_type(start),
508  _bomRoot(ioBomRoot), _fareRule(iofareRule) {
509 
510 
511  start = *(comments | fare_rule);
512 
513  comments = (bsq::lexeme[bsq::repeat(2)[bsa::char_('/')]
514  >> +(bsa::char_ - bsq::eol)
515  >> bsq::eol]
516  | bsq::lexeme[bsa::char_('/') >>bsa::char_('*')
517  >> +(bsa::char_ - bsa::char_('*'))
518  >> bsa::char_('*') >> bsa::char_('/')]);
519 
521  >> +( ';' >> segment )
523 
524  fare_rule_end = bsa::char_(';');
525 
526  fare_key = fare_id
527  >> ';' >> origin >> ';' >> destination
528  >> ';' >> tripType
529  >> ';' >> dateRangeStart >> ';' >> dateRangeEnd
530  >> ';' >> timeRangeStart >> ';' >> timeRangeEnd
531  >> ';' >> point_of_sale >> ';' >> cabinCode >> ';' >> channel
532  >> ';' >> advancePurchase >> ';' >> saturdayStay
533  >> ';' >> changeFees >> ';' >> nonRefundable
534  >> ';' >> minimumStay >> ';' >> fare;
535 
537 
538  origin = bsq::repeat(3)[bsa::char_("A-Z")][storeOrigin(_fareRule)];
539 
540  destination =
541  bsq::repeat(3)[bsa::char_("A-Z")][storeDestination(_fareRule)];
542 
543  tripType =
544  bsq::repeat(2)[bsa::char_("A-Z")][storeTripType(_fareRule)];
545 
547 
549 
550  date = bsq::lexeme
551  [year_p[boost::phoenix::ref(_fareRule._itYear) = bsq::labels::_1]
552  >> '-'
553  >> month_p[boost::phoenix::ref(_fareRule._itMonth) = bsq::labels::_1]
554  >> '-'
555  >> day_p[boost::phoenix::ref(_fareRule._itDay) = bsq::labels::_1] ];
556 
558 
560 
561  time = bsq::lexeme
562  [hour_p[boost::phoenix::ref(_fareRule._itHours) = bsq::labels::_1]
563  >> ':'
564  >> minute_p[boost::phoenix::ref(_fareRule._itMinutes) = bsq::labels::_1]
565  >> - (':' >> second_p[boost::phoenix::ref(_fareRule._itSeconds) = bsq::labels::_1]) ];
566 
567  point_of_sale = bsq::repeat(3)[bsa::char_("A-Z")][storePOS(_fareRule)];
568 
569  cabinCode = bsa::char_("A-Z")[storeCabinCode(_fareRule)];
570 
571  channel = bsq::repeat(2)[bsa::char_("A-Z")][storeChannel(_fareRule)];
572 
574 
575  saturdayStay = bsa::char_("A-Z")[storeSaturdayStay(_fareRule)];
576 
577  changeFees = bsa::char_("A-Z")[storeChangeFees(_fareRule)];
578 
579  nonRefundable = bsa::char_("A-Z")[storeNonRefundable(_fareRule)];
580 
582 
583  fare = bsq::double_[storeFare(_fareRule)];
584 
585  segment = bsq::repeat(2)[bsa::char_("A-Z")][storeAirlineCode(_fareRule)]
586  >> ';'
587  >> bsq::repeat(1,bsq::inf)[bsa::char_("A-Z")][storeClass(_fareRule)];
588 
589  //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser);
590  BOOST_SPIRIT_DEBUG_NODE (start);
591  BOOST_SPIRIT_DEBUG_NODE (comments);
592  BOOST_SPIRIT_DEBUG_NODE (fare_rule);
593  BOOST_SPIRIT_DEBUG_NODE (fare_rule_end);
594  BOOST_SPIRIT_DEBUG_NODE (fare_key);
595  BOOST_SPIRIT_DEBUG_NODE (fare_id);
596  BOOST_SPIRIT_DEBUG_NODE (origin);
597  BOOST_SPIRIT_DEBUG_NODE (destination);
598  BOOST_SPIRIT_DEBUG_NODE (tripType);
599  BOOST_SPIRIT_DEBUG_NODE (dateRangeStart);
600  BOOST_SPIRIT_DEBUG_NODE (dateRangeEnd);
601  BOOST_SPIRIT_DEBUG_NODE (date);
602  BOOST_SPIRIT_DEBUG_NODE (timeRangeStart);
603  BOOST_SPIRIT_DEBUG_NODE (time);
604  BOOST_SPIRIT_DEBUG_NODE (point_of_sale);
605  BOOST_SPIRIT_DEBUG_NODE (cabinCode);
606  BOOST_SPIRIT_DEBUG_NODE (channel);
607  BOOST_SPIRIT_DEBUG_NODE (advancePurchase);
608  BOOST_SPIRIT_DEBUG_NODE (saturdayStay);
609  BOOST_SPIRIT_DEBUG_NODE (changeFees);
610  BOOST_SPIRIT_DEBUG_NODE (nonRefundable);
611  BOOST_SPIRIT_DEBUG_NODE (minimumStay);
612  BOOST_SPIRIT_DEBUG_NODE (fare);
613  BOOST_SPIRIT_DEBUG_NODE (segment);
614 
615  }
616 
617  // Instantiation of rules
618  boost::spirit::qi::rule<Iterator,
619  boost::spirit::ascii::space_type>
624  fare, segment;
625 
626  // Parser Context
627  stdair::BomRoot& _bomRoot;
629  };
630 
631  }
632 
633 
635  //
636  // Entry class for the file parser
637  //
639 
640  // //////////////////////////////////////////////////////////////////////
642  FareRuleFileParser (stdair::BomRoot& ioBomRoot,
643  const stdair::Filename_T& iFilename)
644  : _filename (iFilename), _bomRoot (ioBomRoot) {
645  init();
646  }
647 
648  // //////////////////////////////////////////////////////////////////////
649  void FareRuleFileParser::init() {
650  // Check that the file exists and is readable
651  const bool doesExistAndIsReadable =
652  stdair::BasFileMgr::doesExistAndIsReadable (_filename);
653 
654  if (doesExistAndIsReadable == false) {
655  STDAIR_LOG_ERROR ("The fare schedule file " << _filename
656  << " does not exist or can not be read.");
657 
658  throw FareInputFileNotFoundException ("The fare file " + _filename
659  + " does not exist or can not be read");
660  }
661  }
662 
663  // //////////////////////////////////////////////////////////////////////
665 
666  STDAIR_LOG_DEBUG ("Parsing fare input file: " << _filename);
667 
668  // File to be parsed
669  const std::string* lFileName = &_filename;
670  const char *lChar = (*lFileName).c_str();
671  std::ifstream fileToBeParsed(lChar, std::ios_base::in);
672 
673  // Check if the filename exist and can be open
674  if (fileToBeParsed == false) {
675  STDAIR_LOG_ERROR ("The fare file " << _filename << " can not be open."
676  << std::endl);
677 
678  throw FareInputFileNotFoundException ("The file " + _filename
679  + " does not exist or can not be read");
680  }
681 
682  // Create an input iterator
683  stdair::base_iterator_t inputBegin (fileToBeParsed);
684 
685  // Convert input iterator to an iterator usable by spirit parser
686  stdair::iterator_t
687  start (boost::spirit::make_default_multi_pass (inputBegin));
688  stdair::iterator_t end;
689 
690  // Initialise the parser (grammar) with the helper/staging structure.
691  FareParserHelper::FareRuleParser<stdair::iterator_t> lFPParser(_bomRoot, _fareRule);
692 
693  // Launch the parsing of the file and, thanks to the doEndFare
694  // call-back structure, the building of the whole BomRoot BOM
695  const bool hasParsingBeenSuccesful =
696  boost::spirit::qi::phrase_parse (start, end, lFPParser,
697  boost::spirit::ascii::space);
698 
699  if (hasParsingBeenSuccesful == false) {
700  STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename
701  << " failed");
702  throw FareFileParsingFailedException ("Parsing of fare input file: "
703  + _filename + " failed");
704  }
705 
706  if (start != end) {
707  STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename
708  << " failed");
709  throw FareFileParsingFailedException ("Parsing of fare input file: "
710  + _filename + " failed");
711  }
712 
713  if (hasParsingBeenSuccesful == true && start == end) {
714  STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename
715  << " succeeded");
716  }
717 
718  }
719 
720 }