7#include <stdair/basic/BasFileMgr.hpp>
8#include <stdair/bom/BomRoot.hpp>
9#include <stdair/service/Logger.hpp>
15namespace bsc = boost::spirit::classic;
39 const stdair::AirlineCode_T lAirlineCode (iStr, iStrEnd);
87 const stdair::DateOffset_T oneDay (1);
110 stdair::DOW_String_T lDow (iStr, iStrEnd);
124 stdair::AirportCode_T lBoardingPoint (iStr, iStrEnd);
153 stdair::AirportCode_T lOffPoint (iStr, iStrEnd);
169 const stdair::AirlineCode_T lAirlineCode (iStr, iStrEnd);
170 if (lAirlineCode.size() == 2) {
224 const stdair::DateOffset_T lDateOffset (
_flightPeriod._dateOffset);
245 const stdair::DateOffset_T lDateOffset (
_flightPeriod._dateOffset);
315 stdair::AirportCode_T lBoardingPoint (iStr, iStrEnd);
328 stdair::AirportCode_T lOffPoint (iStr, iStrEnd);
352 std::string lClasses (iStr, iStrEnd);
376 std::ostringstream ostr;
390 const std::string lKey (iStr, iStrEnd);
404 const std::string lKey (iStr, iStrEnd);
405 _flightPeriod._itSegmentCabin._itFFDisutilityCurveKey = lKey;
417 std::string lClasses (iStr, iStrEnd);
459 STDAIR_LOG_DEBUG (
"FlightPeriod: " <<
_flightPeriod.describe());
540 template<
typename ScannerT>
549 lexeme_d[bsc::comment_p(
"//") |bsc::comment_p(
"/*",
"*/")
681 BOOST_SPIRIT_DEBUG_NODE (
date);
682 BOOST_SPIRIT_DEBUG_NODE (
dow);
683 BOOST_SPIRIT_DEBUG_NODE (
leg);
684 BOOST_SPIRIT_DEBUG_NODE (
leg_key);
686 BOOST_SPIRIT_DEBUG_NODE (
time);
699 template<
typename ScannerT>
700 bsc::rule<ScannerT>
const&
717 const stdair::Filename_T& iFilename)
718 : _filename (iFilename), _bomRoot (ioBomRoot) {
723 void FlightPeriodFileParser::init() {
725 const bool doesExistAndIsReadable =
726 stdair::BasFileMgr::doesExistAndIsReadable (_filename);
728 if (doesExistAndIsReadable ==
false) {
729 STDAIR_LOG_ERROR (
"The schedule file " << _filename
730 <<
" does not exist or can not be read.");
733 +
" does not exist or can not be read");
740 if (!_startIterator) {
741 STDAIR_LOG_ERROR (
"The schedule file " << _filename <<
" can not be open."
744 throw ScheduleInputFileNotFoundException (
"The file " + _filename
745 +
" does not exist or can not be read");
749 _endIterator = _startIterator.make_end();
754 bool oResult =
false;
756 STDAIR_LOG_DEBUG (
"Parsing schedule input file: " << _filename);
765 bsc::parse_info<iterator_t> info =
766 bsc::parse (_startIterator, _endIterator, lFPParser,
767 bsc::space_p - bsc::eol_p);
772 const std::string hasBeenFullyReadStr = (info.full ==
true)?
"":
"not ";
773 if (oResult ==
true) {
774 STDAIR_LOG_DEBUG (
"Parsing of schedule input file: " << _filename
775 <<
" succeeded: read " << info.length
776 <<
" characters. The input file has "
777 << hasBeenFullyReadStr
778 <<
"been fully read. Stop point: " << info.stop);
782 STDAIR_LOG_ERROR (
"Parsing of schedule input file: " << _filename
783 <<
" failed: read " << info.length
784 <<
" characters. The input file has "
785 << hasBeenFullyReadStr
786 <<
"been fully read. Stop point: " << info.stop);
FlightPeriodFileParser(stdair::BomRoot &ioBomRoot, const stdair::Filename_T &iFilename)
bool generateInventories()
bounded2_p_t day_p(uint2_p.derived(), 1u, 31u)
bounded1_4_p_t flight_number_p(uint1_4_p.derived(), 0u, 9999u)
bounded2_p_t month_p(uint2_p.derived(), 1u, 12u)
chset_t cabin_code_p("A-Z")
bounded2_p_t minutes_p(uint2_p.derived(), 0u, 59u)
bounded2_p_t seconds_p(uint2_p.derived(), 0u, 59u)
bounded2_p_t hours_p(uint2_p.derived(), 0u, 23u)
repeat_p_t airport_p(chset_t("0-9A-Z").derived(), 3, 3)
repeat_p_t class_code_list_p(chset_t("A-Z").derived(), 1, 26)
repeat_p_t dow_p(chset_t("0-1").derived().derived(), 7, 7)
repeat_p_t key_p(chset_t("0-9A-Z").derived(), 1, 10)
repeat_p_t airline_code_p(chset_t("0-9A-Z").derived(), 2, 3)
bounded4_p_t year_p(uint4_p.derived(), 2000u, 2099u)
boost::spirit::classic::bounded< uint1_4_p_t, unsigned int > bounded1_4_p_t
boost::spirit::classic::uint_parser< unsigned int, 10, 1, 4 > uint1_4_p_t
boost::spirit::classic::impl::loop_traits< chset_t, unsignedint, unsignedint >::type repeat_p_t
boost::spirit::classic::bounded< uint4_p_t, unsigned int > bounded4_p_t
boost::spirit::classic::uint_parser< unsigned int, 10, 4, 4 > uint4_p_t
boost::spirit::classic::int_parser< unsigned int, 10, 1, 1 > int1_p_t
boost::spirit::classic::file_iterator< char_t > iterator_t
boost::spirit::classic::uint_parser< unsigned int, 10, 2, 2 > uint2_p_t
boost::spirit::classic::chset< char_t > chset_t
boost::spirit::classic::bounded< uint2_p_t, unsigned int > bounded2_p_t
boost::spirit::classic::rule< ScannerT > segment_section
boost::spirit::classic::rule< ScannerT > segment_key
boost::spirit::classic::rule< ScannerT > flight_number
boost::spirit::classic::rule< ScannerT > flight_key
boost::spirit::classic::rule< ScannerT > segment_cabin_details
definition(FlightPeriodParser const &self)
boost::spirit::classic::rule< ScannerT > full_segment_cabin_details
boost::spirit::classic::rule< ScannerT > leg
boost::spirit::classic::rule< ScannerT > flight_period_list
boost::spirit::classic::rule< ScannerT > date
boost::spirit::classic::rule< ScannerT > leg_cabin_details
boost::spirit::classic::rule< ScannerT > flight_period_end
boost::spirit::classic::rule< ScannerT > operating_leg_details
boost::spirit::classic::rule< ScannerT > date_offset
boost::spirit::classic::rule< ScannerT > generic_segment
boost::spirit::classic::rule< ScannerT > leg_details
boost::spirit::classic::rule< ScannerT > airline_code
boost::spirit::classic::rule< ScannerT > family_cabin_details
boost::spirit::classic::rule< ScannerT > flight_period
boost::spirit::classic::rule< ScannerT > not_to_be_parsed
boost::spirit::classic::rule< ScannerT > specific_segment_list
boost::spirit::classic::rule< ScannerT > time
boost::spirit::classic::rule< ScannerT > const & start() const
boost::spirit::classic::rule< ScannerT > leg_key
boost::spirit::classic::rule< ScannerT > dow
FlightPeriodParser(stdair::BomRoot &, FlightPeriodStruct &)
FlightPeriodStruct & _flightPeriod
stdair::BomRoot & _bomRoot
ParserSemanticAction(FlightPeriodStruct &)
FlightPeriodStruct & _flightPeriod
doEndFlight(stdair::BomRoot &, FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
stdair::BomRoot & _bomRoot
storeAirlineCode(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeBoardingTime(FlightPeriodStruct &)
void operator()(double iReal) const
storeCapacity(FlightPeriodStruct &)
storeClasses(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeDateRangeEnd(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeDateRangeStart(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeDow(FlightPeriodStruct &)
storeElapsedTime(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeFClasses(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeFFDisutilityCurveKey(FlightPeriodStruct &)
storeFRAT5CurveKey(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeFamilyCode(FlightPeriodStruct &)
void operator()(int iCode) const
storeFlightNumber(FlightPeriodStruct &)
void operator()(unsigned int iNumber) const
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeLegBoardingPoint(FlightPeriodStruct &)
storeLegCabinCode(FlightPeriodStruct &)
void operator()(char iChar) const
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeLegOffPoint(FlightPeriodStruct &)
storeOffTime(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeOperatingAirlineCode(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
void operator()(unsigned int iNumber) const
storeOperatingFlightNumber(FlightPeriodStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeSegmentBoardingPoint(FlightPeriodStruct &)
storeSegmentCabinCode(FlightPeriodStruct &)
void operator()(char iChar) const
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeSegmentOffPoint(FlightPeriodStruct &)
storeSegmentSpecificity(FlightPeriodStruct &)
void operator()(char iChar) const