You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(4) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
(10) |
Dec
(6) |
From: <den...@us...> - 2010-12-03 17:01:34
|
Revision: 31 http://simfqt.svn.sourceforge.net/simfqt/?rev=31&view=rev Author: denis_arnaud Date: 2010-12-03 17:01:28 +0000 (Fri, 03 Dec 2010) Log Message: ----------- [StdAir API] Fixed a few compilation errors with the new StdAir API. Modified Paths: -------------- trunk/simfqt/simfqt/command/FareQuoter.hpp Modified: trunk/simfqt/simfqt/command/FareQuoter.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareQuoter.hpp 2010-12-03 16:50:21 UTC (rev 30) +++ trunk/simfqt/simfqt/command/FareQuoter.hpp 2010-12-03 17:01:28 UTC (rev 31) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// StdAir +#include <stdair/stdair_basic_types.hpp> // Simfqt #include <simfqt/SIMFQT_Types.hpp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-12-03 16:50:27
|
Revision: 30 http://simfqt.svn.sourceforge.net/simfqt/?rev=30&view=rev Author: denis_arnaud Date: 2010-12-03 16:50:21 +0000 (Fri, 03 Dec 2010) Log Message: ----------- [StdAir API] Fixed a few compilation errors with the new StdAir API. Modified Paths: -------------- trunk/simfqt/simfqt/SIMFQT_Service.hpp trunk/simfqt/simfqt/batches/simfqt.cpp trunk/simfqt/simfqt/bom/FareRuleStruct.hpp trunk/simfqt/simfqt/command/FareParser.hpp trunk/simfqt/simfqt/command/FareRuleGenerator.cpp trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp trunk/simfqt/test/simfqt/FQTTestSuite.cpp Modified: trunk/simfqt/simfqt/SIMFQT_Service.hpp =================================================================== --- trunk/simfqt/simfqt/SIMFQT_Service.hpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/simfqt/SIMFQT_Service.hpp 2010-12-03 16:50:21 UTC (rev 30) @@ -5,7 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // StdAir -#include <stdair/STDAIR_Types.hpp> +#include <stdair/stdair_basic_types.hpp> // SimFQT #include <simfqt/SIMFQT_Types.hpp> @@ -16,7 +16,6 @@ struct BasDBParams; } - namespace SIMFQT { // Forward declaration @@ -39,7 +38,7 @@ @param const stdair::BasDBParams& Parameters for the database access. @param const stdair::Filename_T& Filename of the input fare file. */ SIMFQT_Service (const stdair::BasLogParams&, const stdair::BasDBParams&, - const stdair::Filename_T& iFareInputFilename); + const stdair::Filename_T& iFareInputFilename); /** Constructor. <br>The init() method is called; see the corresponding documentation @@ -50,7 +49,7 @@ @param const stdair::Date_T& Date for the beginning of analysis. @param const stdair::Filename_T& Filename of the input fare file. */ SIMFQT_Service (const stdair::BasLogParams&, - const stdair::Filename_T& iFareInputFilename); + const stdair::Filename_T& iFareInputFilename); /** Constructor. <br>The init() method is called; see the corresponding documentation Modified: trunk/simfqt/simfqt/batches/simfqt.cpp =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.cpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/simfqt/batches/simfqt.cpp 2010-12-03 16:50:21 UTC (rev 30) @@ -12,7 +12,6 @@ #include <boost/tokenizer.hpp> #include <boost/program_options.hpp> // StdAir -#include <stdair/STDAIR_Types.hpp> #include <stdair/STDAIR_Service.hpp> #include <stdair/service/Logger.hpp> // Simfqt @@ -175,7 +174,7 @@ // /////////////// M A I N ///////////////// int main (int argc, char* argv[]) { - try { + // Query std::string lQuery; @@ -207,6 +206,4 @@ logOutputFile.close(); return 0; - - } CATCH_ALL_EXCEPTIONS } Modified: trunk/simfqt/simfqt/bom/FareRuleStruct.hpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-12-03 16:50:21 UTC (rev 30) @@ -7,8 +7,9 @@ // STL #include <string> #include <vector> -// STDAIR -#include <stdair/STDAIR_Types.hpp> +// StdAir +#include <stdair/stdair_demand_types.hpp> +#include <stdair/stdair_inventory_types.hpp> #include <stdair/basic/StructAbstract.hpp> #include <stdair/basic/BasParserTypes.hpp> // SIMFQT Modified: trunk/simfqt/simfqt/command/FareParser.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParser.hpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/simfqt/command/FareParser.hpp 2010-12-03 16:50:21 UTC (rev 30) @@ -7,7 +7,7 @@ // STL #include <string> // StdAir -#include <stdair/STDAIR_Types.hpp> +#include <stdair/stdair_basic_types.hpp> #include <stdair/command/CmdAbstract.hpp> // Forward declarations. Modified: trunk/simfqt/simfqt/command/FareRuleGenerator.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareRuleGenerator.cpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/simfqt/command/FareRuleGenerator.cpp 2010-12-03 16:50:21 UTC (rev 30) @@ -3,8 +3,7 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> -// STDAIR -#include <stdair/STDAIR_Types.hpp> +// StdAir #include <stdair/basic/BasConst_BookingClass.hpp> #include <stdair/basic/BasConst_Yield.hpp> #include <stdair/basic/BasConst_General.hpp> Modified: trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp =================================================================== --- trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp 2010-12-03 16:50:21 UTC (rev 30) @@ -6,9 +6,9 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <string> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -// Simfqt +// StdAir +#include <stdair/stdair_service_types.hpp> +// SimFQT #include <simfqt/SIMFQT_Types.hpp> #include <simfqt/service/ServiceAbstract.hpp> Modified: trunk/simfqt/test/simfqt/FQTTestSuite.cpp =================================================================== --- trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-12-02 15:46:37 UTC (rev 29) +++ trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-12-03 16:50:21 UTC (rev 30) @@ -5,8 +5,7 @@ // CPPUNIT #include <extracppunit/CppUnitCore.hpp> // StdAir -#include <stdair/basic/BasLogParams.hpp> -#include <stdair/basic/BasDBParams.hpp> +#include <stdair/STDAIR_Service.hpp> // SimFQT #include <simfqt/SIMFQT_Service.hpp> // SimFQT Test Suite This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-12-02 15:46:43
|
Revision: 29 http://simfqt.svn.sourceforge.net/simfqt/?rev=29&view=rev Author: quannaus Date: 2010-12-02 15:46:37 +0000 (Thu, 02 Dec 2010) Log Message: ----------- [dev] Adapted to the new stdair with the change in the exceptions. Modified Paths: -------------- trunk/simfqt/simfqt/basic/sources.mk trunk/simfqt/simfqt/bom/FareRuleStruct.hpp trunk/simfqt/simfqt/command/FareParserHelper.cpp trunk/simfqt/simfqt/command/FareParserHelper.hpp Removed Paths: ------------- trunk/simfqt/simfqt/basic/BasParserTypes.hpp Deleted: trunk/simfqt/simfqt/basic/BasParserTypes.hpp =================================================================== --- trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-12-02 10:44:31 UTC (rev 28) +++ trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-12-02 15:46:37 UTC (rev 29) @@ -1,90 +0,0 @@ -#ifndef __SIMFQT_BAS_BASCOMPARSERTYPES_HPP -#define __SIMFQT_BAS_BASCOMPARSERTYPES_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <limits> -// Boost Spirit (Parsing) -#include <boost/spirit/include/qi.hpp> -#include <boost/spirit/include/phoenix_core.hpp> -#include <boost/spirit/include/phoenix_operator.hpp> -#include <boost/spirit/include/support_multi_pass.hpp> - -namespace SIMFQT { - - // /////////////////////////////////////////////////////////////////////// - // - // Definition of Basic Types - // - // /////////////////////////////////////////////////////////////////////// - - // The types of iterator, scanner and rule are then derived from - // the parsing unit. - typedef std::istreambuf_iterator<char> base_iterator_t; - typedef boost::spirit::multi_pass<base_iterator_t> iterator_t; - - - // /////////////////////////////////////////////////////////////////////// - // - // Parser related types - // - // /////////////////////////////////////////////////////////////////////// - /** 1-digit-integer parser */ - typedef boost::spirit::qi::int_parser<unsigned int, 10, 1, 1> int1_p_t; - - /** 2-digit-integer parser */ - typedef boost::spirit::qi::uint_parser<int, 10, 2, 2> uint2_p_t; - - /** 4-digit-integer parser */ - typedef boost::spirit::qi::uint_parser<int, 10, 4, 4> uint4_p_t; - - /** Up-to-4-digit-integer parser */ - typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> uint1_4_p_t; - - /** Time parser. */ - template <int MIN = 0, int MAX = 0> - struct date_time_element { - unsigned int _value; - - // Constructors. - date_time_element () { } - date_time_element (const date_time_element& t) - : _value (t._value) { } - date_time_element (int i) : _value (i) { } - void check () const { - if (_value < MIN || _value > MAX) { - STDAIR_LOG_ERROR ("The value: " << _value - << " is out of range (" - << MIN << ", " << MAX << ")"); - throw stdair::ParserException (); - } - } - }; - - typedef date_time_element<0, 23> hour_t; - typedef date_time_element<0, 59> minute_t; - typedef date_time_element<0, 59> second_t; - typedef date_time_element<1900, 2100> year_t; - typedef date_time_element<1, 12> month_t; - typedef date_time_element<1, 31> day_t; - typedef boost::spirit::qi::uint_parser<hour_t, 10, 2, 2> hour_p_t; - typedef boost::spirit::qi::uint_parser<minute_t, 10, 2, 2> minute_p_t; - typedef boost::spirit::qi::uint_parser<second_t, 10, 2, 2> second_p_t; - typedef boost::spirit::qi::uint_parser<year_t, 10, 4, 4> year_p_t; - typedef boost::spirit::qi::uint_parser<month_t, 10, 2, 2> month_p_t; - typedef boost::spirit::qi::uint_parser<day_t, 10, 2, 2> day_p_t; - - - template <int MIN, int MAX> - inline date_time_element<MIN, MAX> operator* (const date_time_element<MIN, MAX>& h1, const date_time_element<MIN, MAX>& h2) { - return date_time_element<MIN, MAX> (h1._value * h2._value); - } - template <int MIN, int MAX> - inline date_time_element<MIN, MAX> operator+ (const date_time_element<MIN, MAX>& h1, const date_time_element<MIN, MAX>& h2) { - return date_time_element<MIN, MAX> (h1._value + h2._value); - } -} -#endif // __SIMFQT_BAS_BASCOMPARSERTYPES_HPP Modified: trunk/simfqt/simfqt/basic/sources.mk =================================================================== --- trunk/simfqt/simfqt/basic/sources.mk 2010-12-02 10:44:31 UTC (rev 28) +++ trunk/simfqt/simfqt/basic/sources.mk 2010-12-02 15:46:37 UTC (rev 29) @@ -1,6 +1,5 @@ simfqt_bas_h_sources = \ $(top_srcdir)/simfqt/basic/BasConst_General.hpp \ - $(top_srcdir)/simfqt/basic/BasConst_SIMFQT_Service.hpp \ - $(top_srcdir)/simfqt/basic/BasParserTypes.hpp + $(top_srcdir)/simfqt/basic/BasConst_SIMFQT_Service.hpp simfqt_bas_cc_sources = \ $(top_srcdir)/simfqt/basic/BasConst.cpp Modified: trunk/simfqt/simfqt/bom/FareRuleStruct.hpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-12-02 10:44:31 UTC (rev 28) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-12-02 15:46:37 UTC (rev 29) @@ -10,9 +10,9 @@ // STDAIR #include <stdair/STDAIR_Types.hpp> #include <stdair/basic/StructAbstract.hpp> +#include <stdair/basic/BasParserTypes.hpp> // SIMFQT #include <simfqt/SIMFQT_Types.hpp> -#include <simfqt/basic/BasParserTypes.hpp> namespace SIMFQT { @@ -34,15 +34,15 @@ // ////////////////// Attributes ///////////////// /** Staging Date. */ - year_t _itYear; - month_t _itMonth; - day_t _itDay; + stdair::year_t _itYear; + stdair::month_t _itMonth; + stdair::day_t _itDay; /** Staging Time. */ //long _itHours; - hour_t _itHours; - minute_t _itMinutes; - second_t _itSeconds; + stdair::hour_t _itHours; + stdair::minute_t _itMinutes; + stdair::second_t _itSeconds; unsigned long int _nbOfAirlines; Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-02 10:44:31 UTC (rev 28) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-02 15:46:37 UTC (rev 29) @@ -377,26 +377,26 @@ namespace bsa = boost::spirit::ascii; /** 1-digit-integer parser */ - int1_p_t int1_p; + stdair::int1_p_t int1_p; /** 2-digit-integer parser */ - uint2_p_t uint2_p; + stdair::uint2_p_t uint2_p; /** 4-digit-integer parser */ - uint4_p_t uint4_p; + stdair::uint4_p_t uint4_p; /** Up-to-4-digit-integer parser */ - uint1_4_p_t uint1_4_p; + stdair::uint1_4_p_t uint1_4_p; /** Time element parsers. */ - hour_p_t hour_p; - minute_p_t minute_p; - second_p_t second_p; + stdair::hour_p_t hour_p; + stdair::minute_p_t minute_p; + stdair::second_p_t second_p; /** Date element parsers. */ - year_p_t year_p; - month_p_t month_p; - day_p_t day_p; + stdair::year_p_t year_p; + stdair::month_p_t month_p; + stdair::day_p_t day_p; // ////////////////////////////////////////////////////////////////// // (Boost Spirit) Grammar Definition @@ -504,12 +504,7 @@ BOOST_SPIRIT_DEBUG_NODE (minimumStay); BOOST_SPIRIT_DEBUG_NODE (fare); BOOST_SPIRIT_DEBUG_NODE (segment); - - hour_t h1 (2); - hour_t h2 (3); - h1 = h1 * h2; } - } ///////////////////////////////////////////////////////////////////////// @@ -559,11 +554,12 @@ } // Create an input iterator - base_iterator_t inputBegin (fileToBeParsed); - + stdair::base_iterator_t inputBegin (fileToBeParsed); + // Convert input iterator to an iterator usable by spirit parser - iterator_t start (boost::spirit::make_default_multi_pass (inputBegin)); - iterator_t end; + stdair::iterator_t + start (boost::spirit::make_default_multi_pass (inputBegin)); + stdair::iterator_t end; // Initialise the parser (grammar) with the helper/staging structure. FareParserHelper::FareRuleParser lFPParser(_bomRoot, _fareRule); @@ -579,7 +575,6 @@ // TODO: decide whether to throw an exceqption STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename << " failed"); - } if (start != end) { // TODO: decide whether to throw an exception Modified: trunk/simfqt/simfqt/command/FareParserHelper.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-12-02 10:44:31 UTC (rev 28) +++ trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-12-02 15:46:37 UTC (rev 29) @@ -8,10 +8,10 @@ #include <string> //#define BOOST_SPIRIT_DEBUG // StdAir +#include <stdair/basic/BasParserTypes.hpp> #include <stdair/command/CmdAbstract.hpp> // Simfqt #include <simfqt/SIMFQT_Types.hpp> -#include <simfqt/basic/BasParserTypes.hpp> #include <simfqt/bom/FareRuleStruct.hpp> // Forward declarations @@ -292,12 +292,14 @@ /** Grammar for the Fare-Rule parser. */ struct FareRuleParser : - public boost::spirit::qi::grammar<iterator_t, boost::spirit::ascii::space_type> { + public boost::spirit::qi::grammar<stdair::iterator_t, + boost::spirit::ascii::space_type> { FareRuleParser (stdair::BomRoot&, FareRuleStruct&); // Instantiation of rules - boost::spirit::qi::rule<iterator_t, boost::spirit::ascii::space_type> + boost::spirit::qi::rule<stdair::iterator_t, + boost::spirit::ascii::space_type> start, comments, fare_rule, fare_rule_end, fare_key, fare_id, origin, destination, dateRangeStart, dateRangeEnd, date, timeRangeStart, timeRangeEnd, time, position, channel, advancePurchase, saturdayStay, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-12-02 10:44:37
|
Revision: 28 http://simfqt.svn.sourceforge.net/simfqt/?rev=28&view=rev Author: quannaus Date: 2010-12-02 10:44:31 +0000 (Thu, 02 Dec 2010) Log Message: ----------- [dev] Created some specialised types for the date_time parser. These types should be moved to stdair. Modified Paths: -------------- trunk/simfqt/simfqt/basic/BasParserTypes.hpp trunk/simfqt/simfqt/batches/simfqt.cpp trunk/simfqt/simfqt/bom/FareRuleStruct.cpp trunk/simfqt/simfqt/bom/FareRuleStruct.hpp trunk/simfqt/simfqt/command/FareParserHelper.cpp Modified: trunk/simfqt/simfqt/basic/BasParserTypes.hpp =================================================================== --- trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-12-01 14:54:29 UTC (rev 27) +++ trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-12-02 10:44:31 UTC (rev 28) @@ -6,6 +6,7 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <string> +#include <limits> // Boost Spirit (Parsing) #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> @@ -42,7 +43,48 @@ /** Up-to-4-digit-integer parser */ typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> uint1_4_p_t; -; - + + /** Time parser. */ + template <int MIN = 0, int MAX = 0> + struct date_time_element { + unsigned int _value; + + // Constructors. + date_time_element () { } + date_time_element (const date_time_element& t) + : _value (t._value) { } + date_time_element (int i) : _value (i) { } + void check () const { + if (_value < MIN || _value > MAX) { + STDAIR_LOG_ERROR ("The value: " << _value + << " is out of range (" + << MIN << ", " << MAX << ")"); + throw stdair::ParserException (); + } + } + }; + + typedef date_time_element<0, 23> hour_t; + typedef date_time_element<0, 59> minute_t; + typedef date_time_element<0, 59> second_t; + typedef date_time_element<1900, 2100> year_t; + typedef date_time_element<1, 12> month_t; + typedef date_time_element<1, 31> day_t; + typedef boost::spirit::qi::uint_parser<hour_t, 10, 2, 2> hour_p_t; + typedef boost::spirit::qi::uint_parser<minute_t, 10, 2, 2> minute_p_t; + typedef boost::spirit::qi::uint_parser<second_t, 10, 2, 2> second_p_t; + typedef boost::spirit::qi::uint_parser<year_t, 10, 4, 4> year_p_t; + typedef boost::spirit::qi::uint_parser<month_t, 10, 2, 2> month_p_t; + typedef boost::spirit::qi::uint_parser<day_t, 10, 2, 2> day_p_t; + + + template <int MIN, int MAX> + inline date_time_element<MIN, MAX> operator* (const date_time_element<MIN, MAX>& h1, const date_time_element<MIN, MAX>& h2) { + return date_time_element<MIN, MAX> (h1._value * h2._value); + } + template <int MIN, int MAX> + inline date_time_element<MIN, MAX> operator+ (const date_time_element<MIN, MAX>& h1, const date_time_element<MIN, MAX>& h2) { + return date_time_element<MIN, MAX> (h1._value + h2._value); + } } #endif // __SIMFQT_BAS_BASCOMPARSERTYPES_HPP Modified: trunk/simfqt/simfqt/batches/simfqt.cpp =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.cpp 2010-12-01 14:54:29 UTC (rev 27) +++ trunk/simfqt/simfqt/batches/simfqt.cpp 2010-12-02 10:44:31 UTC (rev 28) @@ -172,38 +172,41 @@ return 0; } + // /////////////// M A I N ///////////////// int main (int argc, char* argv[]) { - - // Query - std::string lQuery; - - // Fare input file name - stdair::Filename_T lFareInputFilename; - - // Output log File - std::string lLogFilename; - - // Call the command-line option parser - const int lOptionParserStatus = - readConfiguration (argc, argv, lQuery, lFareInputFilename, lLogFilename); - - if (lOptionParserStatus == K_SIMFQT_EARLY_RETURN_STATUS) { + try { + // Query + std::string lQuery; + + // Fare input file name + stdair::Filename_T lFareInputFilename; + + // Output log File + std::string lLogFilename; + + // Call the command-line option parser + const int lOptionParserStatus = + readConfiguration (argc, argv, lQuery, lFareInputFilename, lLogFilename); + + if (lOptionParserStatus == K_SIMFQT_EARLY_RETURN_STATUS) { + return 0; + } + + // Set the log parameters + std::ofstream logOutputFile; + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + // Initialise the Simfqt service object + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + SIMFQT::SIMFQT_Service simfqtService (lLogParams, lFareInputFilename); + + // Close the Log outputFile + logOutputFile.close(); + return 0; - } - - // Set the log parameters - std::ofstream logOutputFile; - // Open and clean the log outputfile - logOutputFile.open (lLogFilename.c_str()); - logOutputFile.clear(); - - // Initialise the Simfqt service object - const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); - SIMFQT::SIMFQT_Service simfqtService (lLogParams, lFareInputFilename); - - // Close the Log outputFile - logOutputFile.close(); - - return 0; + + } CATCH_ALL_EXCEPTIONS } Modified: trunk/simfqt/simfqt/bom/FareRuleStruct.cpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-12-01 14:54:29 UTC (rev 27) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-12-02 10:44:31 UTC (rev 28) @@ -29,14 +29,16 @@ // //////////////////////////////////////////////////////////////////// stdair::Date_T FareRuleStruct::getDate() const { - return stdair::Date_T (_itYear, _itMonth, _itDay); + _itYear.check(); _itMonth.check(); _itDay.check(); + return stdair::Date_T (_itYear._value, _itMonth._value, _itDay._value); } // //////////////////////////////////////////////////////////////////// stdair::Duration_T FareRuleStruct::getTime() const { - return boost::posix_time::hours (_itHours) - + boost::posix_time::minutes (_itMinutes) - + boost::posix_time::seconds (_itSeconds); + _itHours.check(); _itMinutes.check(); _itSeconds.check(); + return boost::posix_time::hours (_itHours._value) + + boost::posix_time::minutes (_itMinutes._value) + + boost::posix_time::seconds (_itSeconds._value); } Modified: trunk/simfqt/simfqt/bom/FareRuleStruct.hpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-12-01 14:54:29 UTC (rev 27) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-12-02 10:44:31 UTC (rev 28) @@ -12,6 +12,7 @@ #include <stdair/basic/StructAbstract.hpp> // SIMFQT #include <simfqt/SIMFQT_Types.hpp> +#include <simfqt/basic/BasParserTypes.hpp> namespace SIMFQT { @@ -33,14 +34,15 @@ // ////////////////// Attributes ///////////////// /** Staging Date. */ - unsigned int _itYear; - unsigned int _itMonth; - unsigned int _itDay; + year_t _itYear; + month_t _itMonth; + day_t _itDay; /** Staging Time. */ - long _itHours; - long _itMinutes; - long _itSeconds; + //long _itHours; + hour_t _itHours; + minute_t _itMinutes; + second_t _itSeconds; unsigned long int _nbOfAirlines; Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-01 14:54:29 UTC (rev 27) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-02 10:44:31 UTC (rev 28) @@ -387,6 +387,16 @@ /** Up-to-4-digit-integer parser */ uint1_4_p_t uint1_4_p; + + /** Time element parsers. */ + hour_p_t hour_p; + minute_p_t minute_p; + second_p_t second_p; + + /** Date element parsers. */ + year_p_t year_p; + month_p_t month_p; + day_p_t day_p; // ////////////////////////////////////////////////////////////////// // (Boost Spirit) Grammar Definition @@ -434,21 +444,21 @@ dateRangeEnd = date[storeDateRangeEnd(_fareRule)]; date = bsq::lexeme - [uint4_p[boost::phoenix::ref(_fareRule._itYear) = bsq::labels::_1] + [year_p[boost::phoenix::ref(_fareRule._itYear) = bsq::labels::_1] >> '-' - >> uint2_p[boost::phoenix::ref(_fareRule._itMonth) = bsq::labels::_1] + >> month_p[boost::phoenix::ref(_fareRule._itMonth) = bsq::labels::_1] >> '-' - >> uint2_p[boost::phoenix::ref(_fareRule._itDay) = bsq::labels::_1] ]; + >> day_p[boost::phoenix::ref(_fareRule._itDay) = bsq::labels::_1] ]; timeRangeStart = time[storeStartRangeTime(_fareRule)]; timeRangeEnd = time[storeEndRangeTime(_fareRule)]; time = bsq::lexeme - [uint2_p[boost::phoenix::ref(_fareRule._itHours) = bsq::labels::_1] + [hour_p[boost::phoenix::ref(_fareRule._itHours) = bsq::labels::_1] >> ':' - >> uint2_p[boost::phoenix::ref(_fareRule._itMinutes) = bsq::labels::_1] - >> !(':' >> (uint2_p)[boost::phoenix::ref(_fareRule._itSeconds) = bsq::labels::_1]) ]; + >> minute_p[boost::phoenix::ref(_fareRule._itMinutes) = bsq::labels::_1] + >> !(':' >> (second_p)[boost::phoenix::ref(_fareRule._itSeconds) = bsq::labels::_1]) ]; position = bsq::repeat(3)[bsa::char_("A-Z")][storePOS(_fareRule)]; @@ -494,6 +504,10 @@ BOOST_SPIRIT_DEBUG_NODE (minimumStay); BOOST_SPIRIT_DEBUG_NODE (fare); BOOST_SPIRIT_DEBUG_NODE (segment); + + hour_t h1 (2); + hour_t h2 (3); + h1 = h1 * h2; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-12-01 14:54:35
|
Revision: 27 http://simfqt.svn.sourceforge.net/simfqt/?rev=27&view=rev Author: quannaus Date: 2010-12-01 14:54:29 +0000 (Wed, 01 Dec 2010) Log Message: ----------- [dev] Renamed some namespaces. Modified Paths: -------------- trunk/simfqt/simfqt/command/FareParserHelper.cpp Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-01 10:34:54 UTC (rev 26) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-01 14:54:29 UTC (rev 27) @@ -372,6 +372,10 @@ // Utility Parsers // // /////////////////////////////////////////////////////////////////// + /** Namespaces. */ + namespace bsq = boost::spirit::qi; + namespace bsa = boost::spirit::ascii; + /** 1-digit-integer parser */ int1_p_t int1_p; @@ -383,7 +387,7 @@ /** Up-to-4-digit-integer parser */ uint1_4_p_t uint1_4_p; - + // ////////////////////////////////////////////////////////////////// // (Boost Spirit) Grammar Definition // ////////////////////////////////////////////////////////////////// @@ -392,114 +396,79 @@ FareRuleParser::FareRuleParser (stdair::BomRoot& ioBomRoot, FareRuleStruct& iofareRule) : FareRuleParser::base_type(start), - _bomRoot(ioBomRoot), - _fareRule(iofareRule) { + _bomRoot(ioBomRoot), _fareRule(iofareRule) { - start = *(comments | fare_rule) - ; + start = *(comments | fare_rule); - comments = (boost::spirit::qi::lexeme[ - boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_('/')] - >> +(boost::spirit::ascii::char_ - boost::spirit::qi::eol) - >> boost::spirit::qi::eol - ] - | boost::spirit::qi::lexeme[ - boost::spirit::ascii::char_('/') >> - boost::spirit::ascii::char_('*') >> - +(boost::spirit::ascii::char_ - boost::spirit::ascii::char_('*')) >> - boost::spirit::ascii::char_('*') >> boost::spirit::ascii::char_('/') - ]) - ; + comments = (bsq::lexeme[bsq::repeat(2)[bsa::char_('/')] + >> +(bsa::char_ - bsq::eol) + >> bsq::eol] + | bsq::lexeme[bsa::char_('/') >>bsa::char_('*') + >> +(bsa::char_ - bsa::char_('*')) + >> bsa::char_('*') >> bsa::char_('/')]); fare_rule = fare_key >> +( ';' >> segment ) - >> fare_rule_end[doEndFare(_bomRoot, _fareRule)] - ; + >> fare_rule_end[doEndFare(_bomRoot, _fareRule)]; - fare_rule_end = boost::spirit::ascii::char_(';') - ; + fare_rule_end = bsa::char_(';'); fare_key = fare_id - >> ';' >> origin >> ';' >> destination + >> ';' >> origin >> ';' >> destination >> ';' >> dateRangeStart >> ';' >> dateRangeEnd >> ';' >> timeRangeStart >> ';' >> timeRangeEnd - >> ';' >> position - >> ';' >> channel - >> ';' >> advancePurchase - >> ';' >> saturdayStay - >> ';' >> changeFees - >> ';' >> nonRefundable - >> ';' >> minimumStay - >> ';' >> fare - ; + >> ';' >> position >> ';' >> channel + >> ';' >> advancePurchase >> ';' >> saturdayStay + >> ';' >> changeFees >> ';' >> nonRefundable + >> ';' >> minimumStay >> ';' >> fare; - fare_id = uint1_4_p[storeFareId(_fareRule)] - ; + fare_id = uint1_4_p[storeFareId(_fareRule)]; - origin = boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")][storeOrigin(_fareRule)] - ; + origin = bsq::repeat(3)[bsa::char_("A-Z")][storeOrigin(_fareRule)]; - destination = boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")][storeDestination(_fareRule)] - ; + destination = + bsq::repeat(3)[bsa::char_("A-Z")][storeDestination(_fareRule)]; - dateRangeStart = date[storeDateRangeStart(_fareRule)] - ; + dateRangeStart = date[storeDateRangeStart(_fareRule)]; - dateRangeEnd = date[storeDateRangeEnd(_fareRule)] - ; + dateRangeEnd = date[storeDateRangeEnd(_fareRule)]; - date = boost::spirit::qi::lexeme[ - uint4_p[boost::phoenix::ref(_fareRule._itYear) = boost::spirit::qi::labels::_1] - >> '-' - >> uint2_p[boost::phoenix::ref(_fareRule._itMonth) = boost::spirit::qi::labels::_1] - >> '-' - >> uint2_p[boost::phoenix::ref(_fareRule._itDay) = boost::spirit::qi::labels::_1] - ] - ; + date = bsq::lexeme + [uint4_p[boost::phoenix::ref(_fareRule._itYear) = bsq::labels::_1] + >> '-' + >> uint2_p[boost::phoenix::ref(_fareRule._itMonth) = bsq::labels::_1] + >> '-' + >> uint2_p[boost::phoenix::ref(_fareRule._itDay) = bsq::labels::_1] ]; - timeRangeStart = time[storeStartRangeTime(_fareRule)] - ; + timeRangeStart = time[storeStartRangeTime(_fareRule)]; - timeRangeEnd = time[storeEndRangeTime(_fareRule)] - ; + timeRangeEnd = time[storeEndRangeTime(_fareRule)]; - time = boost::spirit::qi::lexeme[ - uint2_p[boost::phoenix::ref(_fareRule._itHours) = boost::spirit::qi::labels::_1] - >> ':' - >> uint2_p[boost::phoenix::ref(_fareRule._itMinutes) = boost::spirit::qi::labels::_1] - >> !(':' >> (uint2_p)[boost::phoenix::ref(_fareRule._itSeconds) = boost::spirit::qi::labels::_1]) - ] - ; - - position = boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")][storePOS(_fareRule)] - ; + time = bsq::lexeme + [uint2_p[boost::phoenix::ref(_fareRule._itHours) = bsq::labels::_1] + >> ':' + >> uint2_p[boost::phoenix::ref(_fareRule._itMinutes) = bsq::labels::_1] + >> !(':' >> (uint2_p)[boost::phoenix::ref(_fareRule._itSeconds) = bsq::labels::_1]) ]; + position = bsq::repeat(3)[bsa::char_("A-Z")][storePOS(_fareRule)]; + + channel = bsq::repeat(2)[bsa::char_("A-Z")][storeChannel(_fareRule)]; + + advancePurchase = uint1_4_p[storeAdvancePurchase(_fareRule)]; - channel = boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")][storeChannel(_fareRule)] - ; - - advancePurchase = uint1_4_p[storeAdvancePurchase(_fareRule)] - ; + saturdayStay = bsa::char_("A-Z")[storeSaturdayStay(_fareRule)]; - saturdayStay = boost::spirit::ascii::char_("A-Z")[storeSaturdayStay(_fareRule)] - ; + changeFees = bsa::char_("A-Z")[storeChangeFees(_fareRule)]; - changeFees = boost::spirit::ascii::char_("A-Z")[storeChangeFees(_fareRule)] - ; - - nonRefundable = boost::spirit::ascii::char_("A-Z")[storeNonRefundable(_fareRule)] - ; + nonRefundable = bsa::char_("A-Z")[storeNonRefundable(_fareRule)]; - minimumStay = uint1_4_p[storeMinimumStay(_fareRule)] - ; + minimumStay = uint1_4_p[storeMinimumStay(_fareRule)]; - fare = boost::spirit::qi::double_[storeFare(_fareRule)] - ; + fare = bsq::double_[storeFare(_fareRule)]; - segment = boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")][storeAirlineCode(_fareRule)] + segment = bsq::repeat(2)[bsa::char_("A-Z")][storeAirlineCode(_fareRule)] >> ';' - >> boost::spirit::ascii::char_("A-Z")[storeClass(_fareRule)] - ; + >> bsa::char_("A-Z")[storeClass(_fareRule)]; //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser); BOOST_SPIRIT_DEBUG_NODE (start); @@ -589,7 +558,8 @@ // call-back structure, the building of the whole BomRoot BOM const bool hasParsingBeenSuccesful = - boost::spirit::qi::phrase_parse(start, end, lFPParser, boost::spirit::ascii::space); + boost::spirit::qi::phrase_parse (start, end, lFPParser, + boost::spirit::ascii::space); if (hasParsingBeenSuccesful == false) { // TODO: decide whether to throw an exceqption This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gsa...@us...> - 2010-12-01 10:35:00
|
Revision: 26 http://simfqt.svn.sourceforge.net/simfqt/?rev=26&view=rev Author: gsabatier Date: 2010-12-01 10:34:54 +0000 (Wed, 01 Dec 2010) Log Message: ----------- [Simfqt] A few improvements with spirit v2 parser Modified Paths: -------------- trunk/simfqt/simfqt/basic/BasParserTypes.hpp trunk/simfqt/simfqt/bom/FareRuleStruct.cpp trunk/simfqt/simfqt/command/FareParser.cpp trunk/simfqt/simfqt/command/FareParserHelper.cpp trunk/simfqt/simfqt/command/FareParserHelper.hpp Modified: trunk/simfqt/simfqt/basic/BasParserTypes.hpp =================================================================== --- trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-11-29 15:50:50 UTC (rev 25) +++ trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-12-01 10:34:54 UTC (rev 26) @@ -4,6 +4,8 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <string> // Boost Spirit (Parsing) #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_core.hpp> @@ -40,6 +42,7 @@ /** Up-to-4-digit-integer parser */ typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> uint1_4_p_t; +; } #endif // __SIMFQT_BAS_BASCOMPARSERTYPES_HPP Modified: trunk/simfqt/simfqt/bom/FareRuleStruct.cpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-11-29 15:50:50 UTC (rev 25) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-12-01 10:34:54 UTC (rev 26) @@ -24,7 +24,7 @@ _changeFees("T"), _nonRefundable("T"), _minimumStay(0), _fare(0), _airlineCode(""), _classCode("") { - STDAIR_LOG_DEBUG ("fare rule struct."); + } // //////////////////////////////////////////////////////////////////// Modified: trunk/simfqt/simfqt/command/FareParser.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParser.cpp 2010-11-29 15:50:50 UTC (rev 25) +++ trunk/simfqt/simfqt/command/FareParser.cpp 2010-12-01 10:34:54 UTC (rev 26) @@ -23,7 +23,7 @@ // Parse the CSV-formatted fare input file generate the // corresponding fare rules and fulfill the WorldSchedule. lFareRuleFileParser.generateFareRules (); - STDAIR_LOG_DEBUG ("Finish!"); + } } Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-29 15:50:50 UTC (rev 25) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-12-01 10:34:54 UTC (rev 26) @@ -163,11 +163,11 @@ boost::spirit::qi::unused_type, boost::spirit::qi::unused_type) const { stdair::ChannelLabel_T lChannel (iChar.begin(), iChar.end()); - _fareRule._channel = lChannel; if (lChannel != "IN" && lChannel != "IF" && lChannel != "DN" && lChannel != "DF") { STDAIR_LOG_DEBUG ("Invalid channel " << lChannel); } + _fareRule._channel = lChannel; STDAIR_LOG_DEBUG ("Channel: " << _fareRule._channel); } @@ -345,7 +345,7 @@ std::ostringstream ostrr; ostrr << _fareRule._classCode << classCodeStr; _fareRule._classCode = ostrr.str(); - STDAIR_LOG_DEBUG ("Class Code: " << lClassCode << std::endl); + STDAIR_LOG_DEBUG ("Class Code: " << lClassCode); } @@ -394,79 +394,141 @@ FareRuleParser::base_type(start), _bomRoot(ioBomRoot), _fareRule(iofareRule) { - + start = *(comments | fare_rule) ; + + comments = (boost::spirit::qi::lexeme[ + boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_('/')] + >> +(boost::spirit::ascii::char_ - boost::spirit::qi::eol) + >> boost::spirit::qi::eol + ] + | boost::spirit::qi::lexeme[ + boost::spirit::ascii::char_('/') >> + boost::spirit::ascii::char_('*') >> + +(boost::spirit::ascii::char_ - boost::spirit::ascii::char_('*')) >> + boost::spirit::ascii::char_('*') >> boost::spirit::ascii::char_('/') + ]) + ; + + fare_rule = fare_key + >> +( ';' >> segment ) + >> fare_rule_end[doEndFare(_bomRoot, _fareRule)] + ; + + fare_rule_end = boost::spirit::ascii::char_(';') + ; + + fare_key = fare_id + >> ';' >> origin >> ';' >> destination + >> ';' >> dateRangeStart >> ';' >> dateRangeEnd + >> ';' >> timeRangeStart >> ';' >> timeRangeEnd + >> ';' >> position + >> ';' >> channel + >> ';' >> advancePurchase + >> ';' >> saturdayStay + >> ';' >> changeFees + >> ';' >> nonRefundable + >> ';' >> minimumStay + >> ';' >> fare + ; + + fare_id = uint1_4_p[storeFareId(_fareRule)] + ; + + origin = boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")][storeOrigin(_fareRule)] + ; - comments = (boost::spirit::qi::lexeme[ (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("/")]) >> +(boost::spirit::ascii::char_ - boost::spirit::qi::eol) >> boost::spirit::qi::eol ] - | boost::spirit::qi::lexeme[ (boost::spirit::ascii::char_("/") >> boost::spirit::ascii::char_("*") >> +(boost::spirit::ascii::char_ - boost::spirit::ascii::char_("*")) >> boost::spirit::ascii::char_("*") >> boost::spirit::ascii::char_("/")) ]) - ; + destination = boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")][storeDestination(_fareRule)] + ; + + dateRangeStart = date[storeDateRangeStart(_fareRule)] + ; - fare_rule = fare_key - >> +( ';' >> segment ) - >> fare_rule_end[doEndFare(_bomRoot, _fareRule)] - ; + dateRangeEnd = date[storeDateRangeEnd(_fareRule)] + ; + + date = boost::spirit::qi::lexeme[ + uint4_p[boost::phoenix::ref(_fareRule._itYear) = boost::spirit::qi::labels::_1] + >> '-' + >> uint2_p[boost::phoenix::ref(_fareRule._itMonth) = boost::spirit::qi::labels::_1] + >> '-' + >> uint2_p[boost::phoenix::ref(_fareRule._itDay) = boost::spirit::qi::labels::_1] + ] + ; - fare_rule_end = boost::spirit::ascii::char_(";") - ; + timeRangeStart = time[storeStartRangeTime(_fareRule)] + ; + + timeRangeEnd = time[storeEndRangeTime(_fareRule)] + ; - fare_key = fare_id - >> ';' >> boost::spirit::qi::lexeme[ - (boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")])[storeOrigin(_fareRule)] ] - >> ';' >> boost::spirit::qi::lexeme[ - (boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")])[storeDestination(_fareRule)] ] - >> ';' >> date[storeDateRangeStart(_fareRule)] - >> ';' >> date[storeDateRangeEnd(_fareRule)] - >> ';' >> time[storeStartRangeTime(_fareRule)] - >> ';' >> time[storeEndRangeTime(_fareRule)] - >> ';' >> boost::spirit::qi::lexeme[ - (boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")])[storePOS(_fareRule)] ] - >> ';' >> boost::spirit::qi::lexeme[ - (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")])[storeChannel(_fareRule)] ] - >> ';' >> (uint1_4_p)[storeAdvancePurchase(_fareRule)] - >> ';' >> boost::spirit::ascii::char_("A-Z")[storeSaturdayStay(_fareRule)] - >> ';' >> boost::spirit::ascii::char_("A-Z")[storeChangeFees(_fareRule)] - >> ';' >> boost::spirit::ascii::char_("A-Z")[storeNonRefundable(_fareRule)] - >> ';' >> uint1_4_p[storeMinimumStay(_fareRule)] - >> ';' >> boost::spirit::qi::double_[storeFare(_fareRule)] - ; + time = boost::spirit::qi::lexeme[ + uint2_p[boost::phoenix::ref(_fareRule._itHours) = boost::spirit::qi::labels::_1] + >> ':' + >> uint2_p[boost::phoenix::ref(_fareRule._itMinutes) = boost::spirit::qi::labels::_1] + >> !(':' >> (uint2_p)[boost::phoenix::ref(_fareRule._itSeconds) = boost::spirit::qi::labels::_1]) + ] + ; - fare_id = uint1_4_p[storeFareId(_fareRule)]; - - date = boost::spirit::qi::lexeme[ - uint4_p[boost::phoenix::ref(_fareRule._itYear) = boost::spirit::qi::labels::_1] - >> '-' - >> uint2_p[boost::phoenix::ref(_fareRule._itMonth) =boost::spirit::qi::labels::_1] - >> '-' - >> uint2_p[boost::phoenix::ref(_fareRule._itDay) = boost::spirit::qi::labels::_1] ] - ; - - time = boost::spirit::qi::lexeme[ - uint2_p[boost::phoenix::ref(_fareRule._itHours) = boost::spirit::qi::labels::_1] - >> ':' - >> uint2_p[boost::phoenix::ref(_fareRule._itMinutes) = boost::spirit::qi::labels::_1] - >> !(':' >> (uint2_p)[boost::phoenix::ref(_fareRule._itSeconds) = boost::spirit::qi::labels::_1]) ] - ; + position = boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")][storePOS(_fareRule)] + ; + - segment = boost::spirit::qi::lexeme[ - (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")])[storeAirlineCode(_fareRule)] ] - >> ';' - >> boost::spirit::ascii::char_("A-Z")[storeClass(_fareRule)] - ; + channel = boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")][storeChannel(_fareRule)] + ; + + advancePurchase = uint1_4_p[storeAdvancePurchase(_fareRule)] + ; - //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser); - BOOST_SPIRIT_DEBUG_NODE (start); - BOOST_SPIRIT_DEBUG_NODE (comments); - BOOST_SPIRIT_DEBUG_NODE (fare_rule); - BOOST_SPIRIT_DEBUG_NODE (fare_id); - BOOST_SPIRIT_DEBUG_NODE (fare_key); - BOOST_SPIRIT_DEBUG_NODE (segment); - BOOST_SPIRIT_DEBUG_NODE (fare_rule_end); - BOOST_SPIRIT_DEBUG_NODE (date); - BOOST_SPIRIT_DEBUG_NODE (time); + saturdayStay = boost::spirit::ascii::char_("A-Z")[storeSaturdayStay(_fareRule)] + ; + + changeFees = boost::spirit::ascii::char_("A-Z")[storeChangeFees(_fareRule)] + ; + + nonRefundable = boost::spirit::ascii::char_("A-Z")[storeNonRefundable(_fareRule)] + ; + + minimumStay = uint1_4_p[storeMinimumStay(_fareRule)] + ; + + fare = boost::spirit::qi::double_[storeFare(_fareRule)] + ; + + segment = boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")][storeAirlineCode(_fareRule)] + >> ';' + >> boost::spirit::ascii::char_("A-Z")[storeClass(_fareRule)] + ; + + //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser); + BOOST_SPIRIT_DEBUG_NODE (start); + BOOST_SPIRIT_DEBUG_NODE (comments); + BOOST_SPIRIT_DEBUG_NODE (fare_rule); + BOOST_SPIRIT_DEBUG_NODE (fare_rule_end); + BOOST_SPIRIT_DEBUG_NODE (fare_key); + BOOST_SPIRIT_DEBUG_NODE (fare_id); + BOOST_SPIRIT_DEBUG_NODE (origin); + BOOST_SPIRIT_DEBUG_NODE (destination); + BOOST_SPIRIT_DEBUG_NODE (dateRangeStart); + BOOST_SPIRIT_DEBUG_NODE (dateRangeEnd); + BOOST_SPIRIT_DEBUG_NODE (date); + BOOST_SPIRIT_DEBUG_NODE (timeRangeStart); + BOOST_SPIRIT_DEBUG_NODE (timeRangeEnd); + BOOST_SPIRIT_DEBUG_NODE (time); + BOOST_SPIRIT_DEBUG_NODE (position); + BOOST_SPIRIT_DEBUG_NODE (channel); + BOOST_SPIRIT_DEBUG_NODE (advancePurchase); + BOOST_SPIRIT_DEBUG_NODE (saturdayStay); + BOOST_SPIRIT_DEBUG_NODE (changeFees); + BOOST_SPIRIT_DEBUG_NODE (nonRefundable); + BOOST_SPIRIT_DEBUG_NODE (minimumStay); + BOOST_SPIRIT_DEBUG_NODE (fare); + BOOST_SPIRIT_DEBUG_NODE (segment); } } + ///////////////////////////////////////////////////////////////////////// // // Entry class for the file parser @@ -500,8 +562,6 @@ STDAIR_LOG_DEBUG ("Parsing fare input file: " << _filename); - - // File to be parsed const std::string* lFileName = &_filename; const char *lChar = (*lFileName).c_str(); @@ -527,10 +587,9 @@ // Launch the parsing of the file and, thanks to the doEndFare // call-back structure, the building of the whole BomRoot BOM - STDAIR_LOG_DEBUG ("Begin parsing") ; + const bool hasParsingBeenSuccesful = boost::spirit::qi::phrase_parse(start, end, lFPParser, boost::spirit::ascii::space); - STDAIR_LOG_DEBUG ("End parsing") ; if (hasParsingBeenSuccesful == false) { // TODO: decide whether to throw an exceqption @@ -545,7 +604,7 @@ } if (hasParsingBeenSuccesful == true && start == end) { STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename - << " succeeded ;)"); + << " succeeded"); } return hasParsingBeenSuccesful; } Modified: trunk/simfqt/simfqt/command/FareParserHelper.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-11-29 15:50:50 UTC (rev 25) +++ trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-12-01 10:34:54 UTC (rev 26) @@ -298,8 +298,10 @@ // Instantiation of rules boost::spirit::qi::rule<iterator_t, boost::spirit::ascii::space_type> - start, comments, fare_rule, fare_id, fare_key, segment, fare_rule_end, - date, time; + start, comments, fare_rule, fare_rule_end, fare_key, fare_id, origin, + destination, dateRangeStart, dateRangeEnd, date, timeRangeStart, + timeRangeEnd, time, position, channel, advancePurchase, saturdayStay, + changeFees, nonRefundable, minimumStay, fare, segment; // Parser Context stdair::BomRoot& _bomRoot; @@ -307,10 +309,7 @@ }; } - /** Short Description - <br> Detailed Description.*/ - ///////////////////////////////////////////////////////////////////////// // // Entry class for the file parser This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-11-29 15:50:56
|
Revision: 25 http://simfqt.svn.sourceforge.net/simfqt/?rev=25&view=rev Author: quannaus Date: 2010-11-29 15:50:50 +0000 (Mon, 29 Nov 2010) Log Message: ----------- [dev] Small change in the iterator initialisation. Modified Paths: -------------- trunk/simfqt/simfqt/command/FareParserHelper.cpp Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-29 15:42:53 UTC (rev 24) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-29 15:50:50 UTC (rev 25) @@ -519,7 +519,7 @@ base_iterator_t inputBegin (fileToBeParsed); // Convert input iterator to an iterator usable by spirit parser - iterator_t start = boost::spirit::make_default_multi_pass (inputBegin); + iterator_t start (boost::spirit::make_default_multi_pass (inputBegin)); iterator_t end; // Initialise the parser (grammar) with the helper/staging structure. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-11-29 15:42:59
|
Revision: 24 http://simfqt.svn.sourceforge.net/simfqt/?rev=24&view=rev Author: quannaus Date: 2010-11-29 15:42:53 +0000 (Mon, 29 Nov 2010) Log Message: ----------- [dev] Fixed a bug in the itertor. Modified Paths: -------------- trunk/simfqt/simfqt/basic/BasParserTypes.hpp trunk/simfqt/simfqt/batches/simfqt.cpp trunk/simfqt/simfqt/command/FareParserHelper.cpp trunk/simfqt/simfqt/command/FareParserHelper.hpp Modified: trunk/simfqt/simfqt/basic/BasParserTypes.hpp =================================================================== --- trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-11-29 08:52:23 UTC (rev 23) +++ trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-11-29 15:42:53 UTC (rev 24) @@ -33,13 +33,13 @@ typedef boost::spirit::qi::int_parser<unsigned int, 10, 1, 1> int1_p_t; /** 2-digit-integer parser */ - typedef boost::spirit::qi::uint_parser<unsigned int, 10, 2, 2> uint2_p_t; + typedef boost::spirit::qi::uint_parser<int, 10, 2, 2> uint2_p_t; /** 4-digit-integer parser */ - typedef boost::spirit::qi::uint_parser<unsigned int, 10, 4, 4> uint4_p_t; + typedef boost::spirit::qi::uint_parser<int, 10, 4, 4> uint4_p_t; /** Up-to-4-digit-integer parser */ - typedef boost::spirit::qi::uint_parser<unsigned int, 10, 1, 4> uint1_4_p_t; + typedef boost::spirit::qi::uint_parser<int, 10, 1, 4> uint1_4_p_t; } #endif // __SIMFQT_BAS_BASCOMPARSERTYPES_HPP Modified: trunk/simfqt/simfqt/batches/simfqt.cpp =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-29 08:52:23 UTC (rev 23) +++ trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-29 15:42:53 UTC (rev 24) @@ -27,7 +27,7 @@ const std::string K_SIMFQT_DEFAULT_LOG_FILENAME ("simfqt.log"); /** Default name and location for the (CSV) input file. */ -const std::string K_SIMFQT_DEFAULT_FARE_INPUT_FILENAME ("../../test/samples/fare02.csv"); +const std::string K_SIMFQT_DEFAULT_FARE_INPUT_FILENAME ("../../test/samples/fare01.csv"); /** Default query string. */ const std::string K_SIMFQT_DEFAULT_QUERY_STRING ("my good old query"); Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-29 08:52:23 UTC (rev 23) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-29 15:42:53 UTC (rev 24) @@ -36,7 +36,7 @@ void storeFareId::operator() (unsigned int iFareId, boost::spirit::qi::unused_type, boost::spirit::qi::unused_type) const { - //_fareRule._fareId = iFareId; + _fareRule._fareId = iFareId; STDAIR_LOG_DEBUG ( "Fare Id: " << _fareRule._fareId); @@ -358,7 +358,6 @@ } // ////////////////////////////////////////////////////////////////// - void doEndFare::operator() (boost::spirit::qi::unused_type, boost::spirit::qi::unused_type, boost::spirit::qi::unused_type) const { @@ -390,40 +389,24 @@ // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// - template <typename ITERATOR> - struct FareRuleParser : - public boost::spirit::qi::grammar<ITERATOR, boost::spirit::ascii::space_type> { + FareRuleParser::FareRuleParser (stdair::BomRoot& ioBomRoot, + FareRuleStruct& iofareRule) : + FareRuleParser::base_type(start), + _bomRoot(ioBomRoot), + _fareRule(iofareRule) { + + start = *(comments | fare_rule) + ; + + comments = (boost::spirit::qi::lexeme[ (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("/")]) >> +(boost::spirit::ascii::char_ - boost::spirit::qi::eol) >> boost::spirit::qi::eol ] + | boost::spirit::qi::lexeme[ (boost::spirit::ascii::char_("/") >> boost::spirit::ascii::char_("*") >> +(boost::spirit::ascii::char_ - boost::spirit::ascii::char_("*")) >> boost::spirit::ascii::char_("*") >> boost::spirit::ascii::char_("/")) ]) + ; - FareRuleParser (stdair::BomRoot& ioBomRoot, - FareRuleStruct& iofareRule) : - FareRuleParser::base_type(start), - _bomRoot(ioBomRoot), - _fareRule(iofareRule) { - - STDAIR_LOG_DEBUG ("Begin parsing"); - - start = * (fare_rule) // *(comments | fare_rule) - ; - - comments = (boost::spirit::qi::lexeme[ - (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("/")]) - >> +(boost::spirit::ascii::char_ - boost::spirit::qi::eol) - >> +(boost::spirit::ascii::char_) - >> boost::spirit::qi::eol ] - | boost::spirit::qi::lexeme[ - (boost::spirit::ascii::char_("/") - >> boost::spirit::ascii::char_("*") - >> +(boost::spirit::ascii::char_ - boost::spirit::ascii::char_("*")) - >> boost::spirit::ascii::char_("*") - >> boost::spirit::ascii::char_("/")) ]) + fare_rule = fare_key + >> +( ';' >> segment ) + >> fare_rule_end[doEndFare(_bomRoot, _fareRule)] ; - fare_rule =// fare_key - //>> +( ';' >> segment ) - //>> - fare_rule_end[doEndFare(_bomRoot, _fareRule)] - ; - fare_rule_end = boost::spirit::ascii::char_(";") ; @@ -448,9 +431,7 @@ >> ';' >> boost::spirit::qi::double_[storeFare(_fareRule)] ; - fare_id = boost::spirit::qi::lexeme[ - uint1_4_p[storeFareId(_fareRule)] ] - ; + fare_id = uint1_4_p[storeFareId(_fareRule)]; date = boost::spirit::qi::lexeme[ uint4_p[boost::phoenix::ref(_fareRule._itYear) = boost::spirit::qi::labels::_1] @@ -483,16 +464,7 @@ BOOST_SPIRIT_DEBUG_NODE (fare_rule_end); BOOST_SPIRIT_DEBUG_NODE (date); BOOST_SPIRIT_DEBUG_NODE (time); - } - - boost::spirit::qi::rule<ITERATOR, boost::spirit::ascii::space_type> - start, comments, fare_rule, fare_id, fare_key, segment, fare_rule_end, - date, time; - - // Parser Context - stdair::BomRoot& _bomRoot; - FareRuleStruct& _fareRule; - }; + } } ///////////////////////////////////////////////////////////////////////// @@ -521,7 +493,15 @@ throw FareInputFileNotFoundException ("The fare file " + _filename + " does not exist or can not be read"); } + } + // ////////////////////////////////////////////////////////////////////// + bool FareRuleFileParser::generateFareRules () { + + STDAIR_LOG_DEBUG ("Parsing fare input file: " << _filename); + + + // File to be parsed const std::string* lFileName = &_filename; const char *lChar = (*lFileName).c_str(); @@ -536,45 +516,37 @@ } // Create an input iterator - base_iterator_t inputBegin(fileToBeParsed); - typedef boost::spirit::multi_pass<base_iterator_t> iterator_t; - - // Convert input iterator to an iterator usable by spirit parser - iterator_t _startIterator = boost::spirit::make_default_multi_pass(inputBegin); - } + base_iterator_t inputBegin (fileToBeParsed); - // ////////////////////////////////////////////////////////////////////// - bool FareRuleFileParser::generateFareRules () { - - STDAIR_LOG_DEBUG ("Parsing fare input file: " << _filename); + // Convert input iterator to an iterator usable by spirit parser + iterator_t start = boost::spirit::make_default_multi_pass (inputBegin); + iterator_t end; // Initialise the parser (grammar) with the helper/staging structure. - typedef FareParserHelper::FareRuleParser<iterator_t> FareRule_T; - FareRule_T lFPParser(_bomRoot, _fareRule); + FareParserHelper::FareRuleParser lFPParser(_bomRoot, _fareRule); // Launch the parsing of the file and, thanks to the doEndFare // call-back structure, the building of the whole BomRoot BOM - STDAIR_LOG_DEBUG ("Begin parsing"); - + STDAIR_LOG_DEBUG ("Begin parsing") ; const bool hasParsingBeenSuccesful = - boost::spirit::qi::phrase_parse(_startIterator, _endIterator, lFPParser, boost::spirit::ascii::space); + boost::spirit::qi::phrase_parse(start, end, lFPParser, boost::spirit::ascii::space); + STDAIR_LOG_DEBUG ("End parsing") ; - STDAIR_LOG_DEBUG ("Finish parsing"); if (hasParsingBeenSuccesful == false) { // TODO: decide whether to throw an exceqption STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename << " failed"); } - // if (_startIterator != _endIterator) { - // // TODO: decide whether to throw an exception - // STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename - // << " failed"); - // } - // if (hasParsingBeenSuccesful == true && _startIterator == _endIterator) { - // STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename - // << " succeeded ;)"); - // } + if (start != end) { + // TODO: decide whether to throw an exception + STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename + << " failed"); + } + if (hasParsingBeenSuccesful == true && start == end) { + STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename + << " succeeded ;)"); + } return hasParsingBeenSuccesful; } Modified: trunk/simfqt/simfqt/command/FareParserHelper.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-11-29 08:52:23 UTC (rev 23) +++ trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-11-29 15:42:53 UTC (rev 24) @@ -291,20 +291,20 @@ */ /** Grammar for the Fare-Rule parser. */ - /*template <typename ITERATOR> struct FareRuleParser : - public boost::spirit::qi::grammar<ITERATOR, boost::spirit::ascii::space_type> { + public boost::spirit::qi::grammar<iterator_t, boost::spirit::ascii::space_type> { FareRuleParser (stdair::BomRoot&, FareRuleStruct&); - boost::spirit::qi::rule<ITERATOR, boost::spirit::ascii::space_type> start, - comments, fare_rule, fare_id, fare_key, segment, fare_rule_end, date, - time; - + // Instantiation of rules + boost::spirit::qi::rule<iterator_t, boost::spirit::ascii::space_type> + start, comments, fare_rule, fare_id, fare_key, segment, fare_rule_end, + date, time; + // Parser Context stdair::BomRoot& _bomRoot; FareRuleStruct& _fareRule; - };*/ + }; } /** Short Description @@ -340,12 +340,6 @@ /** File-name of the CSV-formatted schedule input file. */ stdair::Filename_T _filename; - /** Start iterator for the parser. */ - iterator_t _startIterator; - - /** End iterator for the parser. */ - iterator_t _endIterator; - /** stdair::BomRoot. */ stdair::BomRoot& _bomRoot; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gsa...@us...> - 2010-11-29 08:52:30
|
Revision: 23 http://simfqt.svn.sourceforge.net/simfqt/?rev=23&view=rev Author: gsabatier Date: 2010-11-29 08:52:23 +0000 (Mon, 29 Nov 2010) Log Message: ----------- [Simfqt] Running error with spirit v2 parser Modified Paths: -------------- trunk/simfqt/simfqt/basic/BasParserTypes.hpp trunk/simfqt/simfqt/basic/sources.mk trunk/simfqt/simfqt/batches/simfqt.cpp trunk/simfqt/simfqt/bom/FareRuleStruct.cpp trunk/simfqt/simfqt/command/FareParser.cpp trunk/simfqt/simfqt/command/FareParserHelper.cpp trunk/simfqt/simfqt/command/FareParserHelper.hpp Modified: trunk/simfqt/simfqt/basic/BasParserTypes.hpp =================================================================== --- trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-11-29 08:52:23 UTC (rev 23) @@ -1,22 +1,14 @@ -#ifndef __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP -#define __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP +#ifndef __SIMFQT_BAS_BASCOMPARSERTYPES_HPP +#define __SIMFQT_BAS_BASCOMPARSERTYPES_HPP // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -// Boost -//#define BOOST_SPIRIT_DEBUG -#include <boost/spirit/home/classic/core.hpp> -#include <boost/spirit/home/classic/attribute.hpp> -#include <boost/spirit/home/classic/utility/functor_parser.hpp> -#include <boost/spirit/home/classic/utility/loops.hpp> -#include <boost/spirit/home/classic/utility/chset.hpp> -#include <boost/spirit/home/classic/utility/confix.hpp> -#include <boost/spirit/home/classic/iterator/file_iterator.hpp> -#include <boost/spirit/home/classic/actor/push_back_actor.hpp> -#include <boost/spirit/home/classic/actor/assign_actor.hpp> +// Boost Spirit (Parsing) +#include <boost/spirit/include/qi.hpp> +#include <boost/spirit/include/phoenix_core.hpp> +#include <boost/spirit/include/phoenix_operator.hpp> +#include <boost/spirit/include/support_multi_pass.hpp> namespace SIMFQT { @@ -25,47 +17,29 @@ // Definition of Basic Types // // /////////////////////////////////////////////////////////////////////// - // For a file, the parsing unit is the character (char). For a string, - // it is a "char const *". - // typedef char const* iterator_t; - typedef char char_t; // The types of iterator, scanner and rule are then derived from // the parsing unit. - typedef boost::spirit::classic::file_iterator<char_t> iterator_t; - typedef boost::spirit::classic::scanner<iterator_t> scanner_t; - typedef boost::spirit::classic::rule<scanner_t> rule_t; - + typedef std::istreambuf_iterator<char> base_iterator_t; + typedef boost::spirit::multi_pass<base_iterator_t> iterator_t; + + // /////////////////////////////////////////////////////////////////////// // // Parser related types // // /////////////////////////////////////////////////////////////////////// /** 1-digit-integer parser */ - typedef boost::spirit::classic::int_parser<unsigned int, 10, 1, 1> int1_p_t; + typedef boost::spirit::qi::int_parser<unsigned int, 10, 1, 1> int1_p_t; /** 2-digit-integer parser */ - typedef boost::spirit::classic::uint_parser<unsigned int, 10, 2, 2> uint2_p_t; + typedef boost::spirit::qi::uint_parser<unsigned int, 10, 2, 2> uint2_p_t; /** 4-digit-integer parser */ - typedef boost::spirit::classic::uint_parser<unsigned int, 10, 4, 4> uint4_p_t; + typedef boost::spirit::qi::uint_parser<unsigned int, 10, 4, 4> uint4_p_t; /** Up-to-4-digit-integer parser */ - typedef boost::spirit::classic::uint_parser<unsigned int, 10, 1, 4> uint1_4_p_t; - - /** character set */ - typedef boost::spirit::classic::chset<char_t> chset_t; - - /** (Repeating) sequence of a given number of characters: - repeat_p(min, max) */ - typedef boost::spirit::classic::impl::loop_traits<chset_t, - unsigned int, - unsigned int>::type repeat_p_t; - - /** Bounded-number-of-integers parser */ - typedef boost::spirit::classic::bounded<uint2_p_t, unsigned int> bounded2_p_t; - typedef boost::spirit::classic::bounded<uint4_p_t, unsigned int> bounded4_p_t; - typedef boost::spirit::classic::bounded<uint1_4_p_t, unsigned int> bounded1_4_p_t; - + typedef boost::spirit::qi::uint_parser<unsigned int, 10, 1, 4> uint1_4_p_t; + } -#endif // __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP +#endif // __SIMFQT_BAS_BASCOMPARSERTYPES_HPP Modified: trunk/simfqt/simfqt/basic/sources.mk =================================================================== --- trunk/simfqt/simfqt/basic/sources.mk 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/basic/sources.mk 2010-11-29 08:52:23 UTC (rev 23) @@ -1,5 +1,6 @@ simfqt_bas_h_sources = \ $(top_srcdir)/simfqt/basic/BasConst_General.hpp \ - $(top_srcdir)/simfqt/basic/BasConst_SIMFQT_Service.hpp + $(top_srcdir)/simfqt/basic/BasConst_SIMFQT_Service.hpp \ + $(top_srcdir)/simfqt/basic/BasParserTypes.hpp simfqt_bas_cc_sources = \ $(top_srcdir)/simfqt/basic/BasConst.cpp Modified: trunk/simfqt/simfqt/batches/simfqt.cpp =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-29 08:52:23 UTC (rev 23) @@ -27,7 +27,7 @@ const std::string K_SIMFQT_DEFAULT_LOG_FILENAME ("simfqt.log"); /** Default name and location for the (CSV) input file. */ -const std::string K_SIMFQT_DEFAULT_FARE_INPUT_FILENAME ("../../test/samples/fare01.csv"); +const std::string K_SIMFQT_DEFAULT_FARE_INPUT_FILENAME ("../../test/samples/fare02.csv"); /** Default query string. */ const std::string K_SIMFQT_DEFAULT_QUERY_STRING ("my good old query"); Modified: trunk/simfqt/simfqt/bom/FareRuleStruct.cpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-11-29 08:52:23 UTC (rev 23) @@ -24,6 +24,7 @@ _changeFees("T"), _nonRefundable("T"), _minimumStay(0), _fare(0), _airlineCode(""), _classCode("") { + STDAIR_LOG_DEBUG ("fare rule struct."); } // //////////////////////////////////////////////////////////////////// Modified: trunk/simfqt/simfqt/command/FareParser.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParser.cpp 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/command/FareParser.cpp 2010-11-29 08:52:23 UTC (rev 23) @@ -6,6 +6,7 @@ #include <string> // StdAir //#include <stdair/bom/Inventory.hpp> +#include <stdair/service/Logger.hpp> // AirSched #include <simfqt/command/FareParserHelper.hpp> #include <simfqt/command/FareParser.hpp> @@ -22,6 +23,7 @@ // Parse the CSV-formatted fare input file generate the // corresponding fare rules and fulfill the WorldSchedule. lFareRuleFileParser.generateFareRules (); + STDAIR_LOG_DEBUG ("Finish!"); } } Modified: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-29 08:52:23 UTC (rev 23) @@ -4,6 +4,7 @@ // STL #include <cassert> #include <vector> +#include <fstream> // StdAir #include <stdair/basic/BasFileMgr.hpp> #include <stdair/bom/BomRoot.hpp> @@ -32,16 +33,18 @@ } // ////////////////////////////////////////////////////////////////// - void storeFareId::operator() (unsigned int iFareId) const { - _fareRule._fareId = iFareId; + void storeFareId::operator() (unsigned int iFareId, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { + //_fareRule._fareId = iFareId; - //STDAIR_LOG_DEBUG ( "Fare Id: " << _fareRule._fareId); + STDAIR_LOG_DEBUG ( "Fare Id: " << _fareRule._fareId); _fareRule._nbOfAirlines = 0; - _fareRule._airlineCode = ""; - _fareRule._classCode = ""; - _fareRule._airlineCodeList.clear(); - _fareRule._classCodeList.clear(); + _fareRule._airlineCode = ""; + _fareRule._classCode = ""; + _fareRule._airlineCodeList.clear(); + _fareRule._classCodeList.clear(); } // ////////////////////////////////////////////////////////////////// @@ -51,10 +54,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeOrigin::operator() (iterator_t iStr, - iterator_t iStrEnd) const { - stdair::AirportCode_T lOrigin (iStr, iStrEnd); - //STDAIR_LOG_DEBUG ( "Origin: " << lOrigin); + void storeOrigin::operator() (std::vector<char> iChar, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { + stdair::AirportCode_T lOrigin (iChar.begin(), iChar.end()); + STDAIR_LOG_DEBUG ( "Origin: " << lOrigin); _fareRule._origin = lOrigin; } @@ -65,10 +69,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeDestination::operator() (iterator_t iStr, - iterator_t iStrEnd) const { - stdair::AirportCode_T lDestination (iStr, iStrEnd); - //STDAIR_LOG_DEBUG ( "Destination: " << lDestination); + void storeDestination::operator() (std::vector<char> iChar, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { + stdair::AirportCode_T lDestination (iChar.begin(), iChar.end()); + STDAIR_LOG_DEBUG ( "Destination: " << lDestination); _fareRule._destination = lDestination; } @@ -79,10 +84,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeDateRangeStart::operator() (iterator_t iStr, - iterator_t iStrEnd) const { + void storeDateRangeStart::operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._dateRangeStart = _fareRule.getDate(); - //STDAIR_LOG_DEBUG ("Date Range Start: "<< _fareRule._dateRangeStart); + STDAIR_LOG_DEBUG ("Date Range Start: "<< _fareRule._dateRangeStart); } // ////////////////////////////////////////////////////////////////// @@ -92,10 +98,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeDateRangeEnd::operator() (iterator_t iStr, - iterator_t iStrEnd) const { + void storeDateRangeEnd::operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._dateRangeEnd = _fareRule.getDate(); - //STDAIR_LOG_DEBUG ("Date Range End: " << _fareRule._dateRangeEnd); + STDAIR_LOG_DEBUG ("Date Range End: " << _fareRule._dateRangeEnd); } // ////////////////////////////////////////////////////////////////// @@ -105,10 +112,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeStartRangeTime::operator() (iterator_t iStr, - iterator_t iStrEnd) const { + void storeStartRangeTime::operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._timeRangeStart = _fareRule.getTime(); - //STDAIR_LOG_DEBUG ("Time Range Start: " << _fareRule._timeRangeStart); + STDAIR_LOG_DEBUG ("Time Range Start: " << _fareRule._timeRangeStart); // Reset the number of seconds _fareRule._itSeconds = 0; } @@ -120,10 +128,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeEndRangeTime::operator() (iterator_t iStr, - iterator_t iStrEnd) const { + void storeEndRangeTime::operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._timeRangeEnd = _fareRule.getTime(); - // STDAIR_LOG_DEBUG ("Time Range End: " << _fareRule._timeRangeEnd); + STDAIR_LOG_DEBUG ("Time Range End: " << _fareRule._timeRangeEnd); // Reset the number of seconds _fareRule._itSeconds = 0; } @@ -135,11 +144,12 @@ } // ////////////////////////////////////////////////////////////////// - void storePOS::operator() (iterator_t iStr, - iterator_t iStrEnd) const { - stdair::AirlineCode_T lPOS (iStr, iStrEnd); + void storePOS::operator() (std::vector<char> iChar, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { + stdair::AirlineCode_T lPOS (iChar.begin(), iChar.end()); _fareRule._pos = lPOS; - //STDAIR_LOG_DEBUG ("POS: " << _fareRule._pos); + STDAIR_LOG_DEBUG ("POS: " << _fareRule._pos); } // ////////////////////////////////////////////////////////////////// @@ -149,15 +159,16 @@ } // ////////////////////////////////////////////////////////////////// - void storeChannel::operator() (iterator_t iStr, - iterator_t iStrEnd) const { - stdair::ChannelLabel_T lChannel (iStr, iStrEnd); + void storeChannel::operator() (std::vector<char> iChar, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { + stdair::ChannelLabel_T lChannel (iChar.begin(), iChar.end()); _fareRule._channel = lChannel; if (lChannel != "IN" && lChannel != "IF" && lChannel != "DN" && lChannel != "DF") { STDAIR_LOG_DEBUG ("Invalid channel " << lChannel); } - // STDAIR_LOG_DEBUG ("Channel: " << _fareRule._channel); + STDAIR_LOG_DEBUG ("Channel: " << _fareRule._channel); } // ////////////////////////////////////////////////////////////////// @@ -167,9 +178,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeAdvancePurchase::operator() (unsigned int iAdancePurchase) const { + void storeAdvancePurchase::operator() (unsigned int iAdancePurchase, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._advancePurchase = iAdancePurchase; - //STDAIR_LOG_DEBUG ( "Advance Purchase: " << _fareRule._advancePurchase); + STDAIR_LOG_DEBUG ( "Advance Purchase: " << _fareRule._advancePurchase); } // ////////////////////////////////////////////////////////////////// @@ -179,7 +192,9 @@ } // ////////////////////////////////////////////////////////////////// - void storeSaturdayStay::operator() (char iSaturdayStay) const { + void storeSaturdayStay::operator() (char iSaturdayStay, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { bool lBool = false; if (iSaturdayStay == 'T') { lBool = true; @@ -190,7 +205,7 @@ } stdair::SaturdayStay_T lSaturdayStay (lBool); _fareRule._saturdayStay = lSaturdayStay; - //STDAIR_LOG_DEBUG ("Saturday Stay: " << _fareRule._saturdayStay); + STDAIR_LOG_DEBUG ("Saturday Stay: " << _fareRule._saturdayStay); } // ////////////////////////////////////////////////////////////////// @@ -200,7 +215,9 @@ } // ////////////////////////////////////////////////////////////////// - void storeChangeFees::operator() (char iChangefees) const { + void storeChangeFees::operator() (char iChangefees, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { bool lBool = false; if (iChangefees == 'T') { @@ -212,7 +229,7 @@ } stdair::ChangeFees_T lChangefees (lBool); _fareRule._changeFees = lChangefees; - //STDAIR_LOG_DEBUG ("Change fees: " << _fareRule._changeFees); + STDAIR_LOG_DEBUG ("Change fees: " << _fareRule._changeFees); } // ////////////////////////////////////////////////////////////////// @@ -222,7 +239,9 @@ } // ////////////////////////////////////////////////////////////////// - void storeNonRefundable::operator() (char iNonRefundable) const { + void storeNonRefundable::operator() (char iNonRefundable, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { bool lBool = false; if (iNonRefundable == 'T') { lBool = true; @@ -233,7 +252,7 @@ } stdair::NonRefundable_T lNonRefundable (lBool); _fareRule._nonRefundable = lNonRefundable; - // STDAIR_LOG_DEBUG ("Non refundable: " << _fareRule._nonRefundable); + STDAIR_LOG_DEBUG ("Non refundable: " << _fareRule._nonRefundable); } // ////////////////////////////////////////////////////////////////// @@ -243,9 +262,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeMinimumStay::operator() (unsigned int iMinStay) const { + void storeMinimumStay::operator() (unsigned int iMinStay, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._minimumStay = iMinStay; - //STDAIR_LOG_DEBUG ("Minimum Stay: " << _fareRule._minimumStay ); + STDAIR_LOG_DEBUG ("Minimum Stay: " << _fareRule._minimumStay ); } // ////////////////////////////////////////////////////////////////// @@ -255,9 +276,11 @@ } // ////////////////////////////////////////////////////////////////// - void storeFare::operator() (double iFare) const { + void storeFare::operator() (double iFare, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { _fareRule._fare = iFare; - // STDAIR_LOG_DEBUG ("Fare: " << _fareRule._fare); + STDAIR_LOG_DEBUG ("Fare: " << _fareRule._fare); } // ////////////////////////////////////////////////////////////////// @@ -267,11 +290,12 @@ } // ////////////////////////////////////////////////////////////////// - void storeAirlineCode::operator() (iterator_t iStr, - iterator_t iStrEnd) const { + void storeAirlineCode::operator() (std::vector<char> iChar, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { bool lAlreadyInTheList = false; - stdair::AirlineCode_T lAirlineCode (iStr, iStrEnd); + stdair::AirlineCode_T lAirlineCode (iChar.begin(), iChar.end()); // Update the airline code _fareRule._airlineCode = lAirlineCode; // Test if the FareRule Struct stands for interline products @@ -299,7 +323,7 @@ << lAirlineCode);*/ _fareRule._airlineCodeList.push_back (lAirlineCode); } - // STDAIR_LOG_DEBUG ( "Airline code: " << lAirlineCode); + STDAIR_LOG_DEBUG ( "Airline code: " << lAirlineCode); } // ////////////////////////////////////////////////////////////////// @@ -309,7 +333,9 @@ } // ////////////////////////////////////////////////////////////////// - void storeClass::operator() (char iChar) const { + void storeClass::operator() (char iChar, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { std::ostringstream ostr; ostr << iChar; std::string classCodeStr = ostr.str(); @@ -319,7 +345,7 @@ std::ostringstream ostrr; ostrr << _fareRule._classCode << classCodeStr; _fareRule._classCode = ostrr.str(); - //STDAIR_LOG_DEBUG ("Class Code: " << lClassCode << std::endl); + STDAIR_LOG_DEBUG ("Class Code: " << lClassCode << std::endl); } @@ -333,164 +359,152 @@ // ////////////////////////////////////////////////////////////////// - void doEndFare::operator() (iterator_t iStr, - iterator_t iStrEnd) const { + void doEndFare::operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const { // Generation of the fare rule object. + STDAIR_LOG_DEBUG ("Do End"); FareRuleGenerator::createFareRule (_bomRoot, _fareRule); - } - + } + // /////////////////////////////////////////////////////////////////// // // Utility Parsers // // /////////////////////////////////////////////////////////////////// - + /** 1-digit-integer parser */ + int1_p_t int1_p; + /** 2-digit-integer parser */ uint2_p_t uint2_p; - + /** 4-digit-integer parser */ uint4_p_t uint4_p; - + /** Up-to-4-digit-integer parser */ uint1_4_p_t uint1_4_p; - /** Sequence of (capital) alphabetic characters: chset_p("A-Z") */ - chset_t alpha_cap_set_p ("A-Z"); - - /** Airport Parser: repeat_p(3)[chset_p("0-9A-Z")] */ - repeat_p_t airport_p (chset_t("0-9A-Z").derived(), 3, 3); - - /** Year Parser: limit_d(2000u, 2099u)[uint4_p] */ - bounded4_p_t year_p (uint4_p.derived(), 2000u, 2099u); - - /** Month Parser: limit_d(1u, 12u)[uint2_p] */ - bounded2_p_t month_p (uint2_p.derived(), 1u, 12u); - - /** Day Parser: limit_d(1u, 31u)[uint2_p] */ - bounded2_p_t day_p (uint2_p.derived(), 1u, 31u); - - /** Hour Parser: limit_d(0u, 23u)[uint2_p] */ - bounded2_p_t hours_p (uint2_p.derived(), 0u, 23u); - - /** Minute Parser: limit_d(0u, 59u)[uint2_p] */ - bounded2_p_t minutes_p (uint2_p.derived(), 0u, 59u); - - /** Second Parser: limit_d(0u, 59u)[uint2_p] */ - bounded2_p_t seconds_p (uint2_p.derived(), 0u, 59u); - - /** Airline Code Parser: repeat_p(2,3)[chset_p("0-9A-Z")] */ - repeat_p_t airline_code_p (chset_t("0-9A-Z").derived(), 2, 3); - - /** Channel type Parser: repeat_p(2,3)[chset_p("A-ZA-Z")] */ - repeat_p_t channel_type_p (chset_t("A-Z").derived(), 2, 3); - // ////////////////////////////////////////////////////////////////// // (Boost Spirit) Grammar Definition // ////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////// - FareRuleParser:: - FareRuleParser (stdair::BomRoot& ioBomRoot, - FareRuleStruct& ioFareRule) - : _bomRoot (ioBomRoot), - _fareRule (ioFareRule) { - } + template <typename ITERATOR> + struct FareRuleParser : + public boost::spirit::qi::grammar<ITERATOR, boost::spirit::ascii::space_type> { - // ////////////////////////////////////////////////////////////////// - template<typename ScannerT> - FareRuleParser::definition<ScannerT>:: - definition (FareRuleParser const& self) { + FareRuleParser (stdair::BomRoot& ioBomRoot, + FareRuleStruct& iofareRule) : + FareRuleParser::base_type(start), + _bomRoot(ioBomRoot), + _fareRule(iofareRule) { - fare_rule_list = *( comments | fare_rule ) - ; + STDAIR_LOG_DEBUG ("Begin parsing"); + + start = * (fare_rule) // *(comments | fare_rule) + ; - comments = boost::spirit::classic::comment_p("//") - | boost::spirit::classic::comment_p("/*", "*/") + comments = (boost::spirit::qi::lexeme[ + (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("/")]) + >> +(boost::spirit::ascii::char_ - boost::spirit::qi::eol) + >> +(boost::spirit::ascii::char_) + >> boost::spirit::qi::eol ] + | boost::spirit::qi::lexeme[ + (boost::spirit::ascii::char_("/") + >> boost::spirit::ascii::char_("*") + >> +(boost::spirit::ascii::char_ - boost::spirit::ascii::char_("*")) + >> boost::spirit::ascii::char_("*") + >> boost::spirit::ascii::char_("/")) ]) ; - fare_rule = fare_key - >> +( ';' >> segment ) - >> fare_rule_end[doEndFare(self._bomRoot, self._fareRule)] + fare_rule =// fare_key + //>> +( ';' >> segment ) + //>> + fare_rule_end[doEndFare(_bomRoot, _fareRule)] ; - fare_rule_end = boost::spirit::classic::ch_p(';') + fare_rule_end = boost::spirit::ascii::char_(";") ; fare_key = fare_id - >> ';' >> (airport_p)[storeOrigin(self._fareRule)] - >> ';' >> (airport_p)[storeDestination(self._fareRule)] - >> ';' >> date[storeDateRangeStart(self._fareRule)] - >> ';' >> date[storeDateRangeEnd(self._fareRule)] - >> ';' >> time[storeStartRangeTime(self._fareRule)] - >> ';' >> time[storeEndRangeTime(self._fareRule)] - >> ';' >> (airport_p)[storePOS(self._fareRule)] - >> ';' >> (channel_type_p)[storeChannel(self._fareRule)] - >> ';' >> (uint1_4_p)[storeAdvancePurchase(self._fareRule)] - >> ';' >> (alpha_cap_set_p)[storeSaturdayStay(self._fareRule)] - >> ';' >> (alpha_cap_set_p)[storeChangeFees(self._fareRule)] - >> ';' >> (alpha_cap_set_p)[storeNonRefundable(self._fareRule)] - >> ';' >> (uint1_4_p)[storeMinimumStay(self._fareRule)] - >> ';' >> (boost::spirit::classic::ureal_p)[storeFare(self._fareRule)] + >> ';' >> boost::spirit::qi::lexeme[ + (boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")])[storeOrigin(_fareRule)] ] + >> ';' >> boost::spirit::qi::lexeme[ + (boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")])[storeDestination(_fareRule)] ] + >> ';' >> date[storeDateRangeStart(_fareRule)] + >> ';' >> date[storeDateRangeEnd(_fareRule)] + >> ';' >> time[storeStartRangeTime(_fareRule)] + >> ';' >> time[storeEndRangeTime(_fareRule)] + >> ';' >> boost::spirit::qi::lexeme[ + (boost::spirit::qi::repeat(3)[boost::spirit::ascii::char_("A-Z")])[storePOS(_fareRule)] ] + >> ';' >> boost::spirit::qi::lexeme[ + (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")])[storeChannel(_fareRule)] ] + >> ';' >> (uint1_4_p)[storeAdvancePurchase(_fareRule)] + >> ';' >> boost::spirit::ascii::char_("A-Z")[storeSaturdayStay(_fareRule)] + >> ';' >> boost::spirit::ascii::char_("A-Z")[storeChangeFees(_fareRule)] + >> ';' >> boost::spirit::ascii::char_("A-Z")[storeNonRefundable(_fareRule)] + >> ';' >> uint1_4_p[storeMinimumStay(_fareRule)] + >> ';' >> boost::spirit::qi::double_[storeFare(_fareRule)] ; - fare_id = boost::spirit::classic::lexeme_d[ - (uint1_4_p)[storeFareId(self._fareRule)]] + fare_id = boost::spirit::qi::lexeme[ + uint1_4_p[storeFareId(_fareRule)] ] ; - date = boost::spirit::classic::lexeme_d[ - (year_p)[boost::spirit::classic::assign_a(self._fareRule._itYear)] - >> '-' - >> (month_p)[boost::spirit::classic::assign_a(self._fareRule._itMonth)] - >> '-' - >> (day_p)[boost::spirit::classic::assign_a(self._fareRule._itDay)]] + date = boost::spirit::qi::lexeme[ + uint4_p[boost::phoenix::ref(_fareRule._itYear) = boost::spirit::qi::labels::_1] + >> '-' + >> uint2_p[boost::phoenix::ref(_fareRule._itMonth) =boost::spirit::qi::labels::_1] + >> '-' + >> uint2_p[boost::phoenix::ref(_fareRule._itDay) = boost::spirit::qi::labels::_1] ] ; - - time = boost::spirit::classic::lexeme_d[ - (hours_p)[boost::spirit::classic::assign_a(self._fareRule._itHours)] - >> ':' - >> (minutes_p)[boost::spirit::classic::assign_a(self._fareRule._itMinutes)] - >> !(':' >> (seconds_p)[boost::spirit::classic::assign_a(self._fareRule._itSeconds)])] - ; + + time = boost::spirit::qi::lexeme[ + uint2_p[boost::phoenix::ref(_fareRule._itHours) = boost::spirit::qi::labels::_1] + >> ':' + >> uint2_p[boost::phoenix::ref(_fareRule._itMinutes) = boost::spirit::qi::labels::_1] + >> !(':' >> (uint2_p)[boost::phoenix::ref(_fareRule._itSeconds) = boost::spirit::qi::labels::_1]) ] + ; - segment = boost::spirit::classic::lexeme_d[ - (airline_code_p)[storeAirlineCode(self._fareRule)]] - >> ';' >> (alpha_cap_set_p)[storeClass(self._fareRule)] + segment = boost::spirit::qi::lexeme[ + (boost::spirit::qi::repeat(2)[boost::spirit::ascii::char_("A-Z")])[storeAirlineCode(_fareRule)] ] + >> ';' + >> boost::spirit::ascii::char_("A-Z")[storeClass(_fareRule)] ; - //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser); - BOOST_SPIRIT_DEBUG_NODE (fare_rule_list); - BOOST_SPIRIT_DEBUG_NODE (comments); - BOOST_SPIRIT_DEBUG_NODE (fare_rule); - BOOST_SPIRIT_DEBUG_NODE (fare_id); - BOOST_SPIRIT_DEBUG_NODE (fare_key); - BOOST_SPIRIT_DEBUG_NODE (segment); - BOOST_SPIRIT_DEBUG_NODE (fare_rule_end); - BOOST_SPIRIT_DEBUG_NODE (date); - BOOST_SPIRIT_DEBUG_NODE (time); + //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser); + BOOST_SPIRIT_DEBUG_NODE (start); + BOOST_SPIRIT_DEBUG_NODE (comments); + BOOST_SPIRIT_DEBUG_NODE (fare_rule); + BOOST_SPIRIT_DEBUG_NODE (fare_id); + BOOST_SPIRIT_DEBUG_NODE (fare_key); + BOOST_SPIRIT_DEBUG_NODE (segment); + BOOST_SPIRIT_DEBUG_NODE (fare_rule_end); + BOOST_SPIRIT_DEBUG_NODE (date); + BOOST_SPIRIT_DEBUG_NODE (time); + } - } + boost::spirit::qi::rule<ITERATOR, boost::spirit::ascii::space_type> + start, comments, fare_rule, fare_id, fare_key, segment, fare_rule_end, + date, time; + + // Parser Context + stdair::BomRoot& _bomRoot; + FareRuleStruct& _fareRule; + }; - // ////////////////////////////////////////////////////////////////// - template<typename ScannerT> - boost::spirit::classic::rule<ScannerT> const& - FareRuleParser::definition<ScannerT>::start() const { - return fare_rule_list; - } - } - - ///////////////////////////////////////////////////////////////////////// // // Entry class for the file parser // ///////////////////////////////////////////////////////////////////////// - + // ////////////////////////////////////////////////////////////////////// FareRuleFileParser:: - FareRuleFileParser (stdair::BomRoot& ioBomRoot, - const stdair::Filename_T& iFilename) + FareRuleFileParser (stdair::BomRoot& ioBomRoot, + const stdair::Filename_T& iFilename) : _filename (iFilename), _bomRoot (ioBomRoot) { init(); } @@ -503,61 +517,65 @@ if (doesExistAndIsReadable == false) { STDAIR_LOG_ERROR ("The fare schedule file " << _filename - << " does not exist or can not be read."); + << " does not exist or can not be read."); throw FareInputFileNotFoundException ("The fare file " + _filename + " does not exist or can not be read"); } - // Open the file - _startIterator = iterator_t (_filename); + // File to be parsed + const std::string* lFileName = &_filename; + const char *lChar = (*lFileName).c_str(); + std::ifstream fileToBeParsed(lChar, std::ios_base::in); // Check the filename exists and can be open - if (!_startIterator) { + if (fileToBeParsed == false) { STDAIR_LOG_ERROR ("The fare file " << _filename << " can not be open." << std::endl); throw FareInputFileNotFoundException ("The file " + _filename + " does not exist or can not be read"); } + + // Create an input iterator + base_iterator_t inputBegin(fileToBeParsed); + typedef boost::spirit::multi_pass<base_iterator_t> iterator_t; - // Create an EOF iterator - _endIterator = _startIterator.make_end(); + // Convert input iterator to an iterator usable by spirit parser + iterator_t _startIterator = boost::spirit::make_default_multi_pass(inputBegin); } // ////////////////////////////////////////////////////////////////////// bool FareRuleFileParser::generateFareRules () { - bool oResult = false; STDAIR_LOG_DEBUG ("Parsing fare input file: " << _filename); // Initialise the parser (grammar) with the helper/staging structure. - FareParserHelper::FareRuleParser lFPParser (_bomRoot, _fareRule); + typedef FareParserHelper::FareRuleParser<iterator_t> FareRule_T; + FareRule_T lFPParser(_bomRoot, _fareRule); // Launch the parsing of the file and, thanks to the doEndFare // call-back structure, the building of the whole BomRoot BOM - boost::spirit::classic::parse_info<iterator_t> info = - boost::spirit::classic::parse (_startIterator, _endIterator, lFPParser, - boost::spirit::classic::space_p); - - // Retrieves whether or not the parsing was successful - oResult = info.hit; + STDAIR_LOG_DEBUG ("Begin parsing"); + + const bool hasParsingBeenSuccesful = + boost::spirit::qi::phrase_parse(_startIterator, _endIterator, lFPParser, boost::spirit::ascii::space); - const std::string hasBeenFullyReadStr = (info.full == true)?"":"not "; - if (oResult == true) { - STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename - << " succeeded: read " << info.length - << " characters. The input file has " - << hasBeenFullyReadStr - << "been fully read. Stop point: " << info.stop); + STDAIR_LOG_DEBUG ("Finish parsing"); + if (hasParsingBeenSuccesful == false) { + // TODO: decide whether to throw an exceqption + STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename + << " failed"); - } else { - // TODO: decide whether to throw an exception - STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename - << " failed: read " << info.length - << " characters. The input file has " - << hasBeenFullyReadStr - << "been fully read. Stop point: " << info.stop); } - return oResult; + // if (_startIterator != _endIterator) { + // // TODO: decide whether to throw an exception + // STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename + // << " failed"); + // } + // if (hasParsingBeenSuccesful == true && _startIterator == _endIterator) { + // STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename + // << " succeeded ;)"); + // } + return hasParsingBeenSuccesful; } } Modified: trunk/simfqt/simfqt/command/FareParserHelper.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-11-06 10:01:27 UTC (rev 22) +++ trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-11-29 08:52:23 UTC (rev 23) @@ -6,10 +6,10 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <string> -// #define BOOST_SPIRIT_DEBUG +//#define BOOST_SPIRIT_DEBUG // StdAir #include <stdair/command/CmdAbstract.hpp> -// AirSched +// Simfqt #include <simfqt/SIMFQT_Types.hpp> #include <simfqt/basic/BasParserTypes.hpp> #include <simfqt/bom/FareRuleStruct.hpp> @@ -40,7 +40,9 @@ /** Actor Constructor. */ storeFareId (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (unsigned int) const; + void operator() (unsigned int, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed origin. */ @@ -48,7 +50,9 @@ /** Actor Constructor. */ storeOrigin (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (std::vector<char>, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed destination. */ @@ -56,7 +60,9 @@ /** Actor Constructor. */ storeDestination (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (std::vector<char>, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed start of the date range. */ @@ -64,7 +70,9 @@ /** Actor Constructor. */ storeDateRangeStart (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed end of the date range. */ @@ -72,7 +80,9 @@ /** Actor Constructor. */ storeDateRangeEnd (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed start range time. */ @@ -80,7 +90,9 @@ /** Actor Constructor. */ storeStartRangeTime (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t iStr, iterator_t iStrEnd) const; + void operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed end start range time. */ @@ -88,7 +100,9 @@ /** Actor Constructor. */ storeEndRangeTime (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed customer position. */ @@ -96,7 +110,9 @@ /** Actor Constructor. */ storePOS (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (std::vector<char>, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the channel distribution. */ @@ -104,7 +120,9 @@ /** Actor Constructor. */ storeChannel (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (std::vector<char>, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed advance purchase days. */ @@ -112,7 +130,9 @@ /** Actor Constructor. */ storeAdvancePurchase (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (unsigned int) const; + void operator() (unsigned int, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed saturday night. */ @@ -120,7 +140,9 @@ /** Actor Constructor. */ storeSaturdayStay (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (char) const; + void operator() (char, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed change fees. */ @@ -128,7 +150,9 @@ /** Actor Constructor. */ storeChangeFees (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (char) const; + void operator() (char, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed refundable option */ @@ -136,7 +160,9 @@ /** Actor Constructor. */ storeNonRefundable (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (char) const; + void operator() (char, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed minimum stay. */ @@ -144,7 +170,9 @@ /** Actor Constructor. */ storeMinimumStay (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (unsigned int) const; + void operator() (unsigned int, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed fare value. */ @@ -152,7 +180,9 @@ /** Actor Constructor. */ storeFare (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (double) const; + void operator() (double, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed airline code. */ @@ -160,7 +190,9 @@ /** Actor Constructor. */ storeAirlineCode (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (std::vector<char>, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Store the parsed class. */ @@ -168,7 +200,9 @@ /** Actor Constructor. */ storeClass (FareRuleStruct&); /** Actor Function (functor). */ - void operator() (char) const; + void operator() (char, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; }; /** Mark the end of the fare-rule parsing. */ @@ -176,7 +210,9 @@ /** Actor Constructor. */ doEndFare (stdair::BomRoot&, FareRuleStruct&); /** Actor Function (functor). */ - void operator() (iterator_t, iterator_t) const; + void operator() (boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type, + boost::spirit::qi::unused_type) const; /** Actor Specific Context. */ stdair::BomRoot& _bomRoot; }; @@ -255,27 +291,20 @@ */ /** Grammar for the Fare-Rule parser. */ + /*template <typename ITERATOR> struct FareRuleParser : - public boost::spirit::classic::grammar<FareRuleParser> { + public boost::spirit::qi::grammar<ITERATOR, boost::spirit::ascii::space_type> { FareRuleParser (stdair::BomRoot&, FareRuleStruct&); - template <typename ScannerT> - struct definition { - definition (FareRuleParser const& self); + boost::spirit::qi::rule<ITERATOR, boost::spirit::ascii::space_type> start, + comments, fare_rule, fare_id, fare_key, segment, fare_rule_end, date, + time; - // Instantiation of rules - boost::spirit::classic::rule<ScannerT> fare_rule_list, comments, - fare_rule, fare_id, fare_key, segment, fare_rule_end, date, time; - - /** Entry point of the parser. */ - boost::spirit::classic::rule<ScannerT> const& start() const; - }; - // Parser Context stdair::BomRoot& _bomRoot; FareRuleStruct& _fareRule; - }; + };*/ } /** Short Description @@ -316,7 +345,7 @@ /** End iterator for the parser. */ iterator_t _endIterator; - + /** stdair::BomRoot. */ stdair::BomRoot& _bomRoot; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-11-06 10:01:33
|
Revision: 22 http://simfqt.svn.sourceforge.net/simfqt/?rev=22&view=rev Author: denis_arnaud Date: 2010-11-06 10:01:27 +0000 (Sat, 06 Nov 2010) Log Message: ----------- [Dev] The (output) log file is ignored: it should not be versionned. Removed Paths: ------------- trunk/simfqt/simfqt/batches/simfqt.log Deleted: trunk/simfqt/simfqt/batches/simfqt.log =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.log 2010-11-02 18:21:15 UTC (rev 21) +++ trunk/simfqt/simfqt/batches/simfqt.log 2010-11-06 10:01:27 UTC (rev 22) @@ -1,2 +0,0 @@ -[D]../../simfqt/command/FareParserHelper.cpp:530: Parsing fare input file: ../../test/samples/fare01.csv -[D]../../simfqt/command/FareParserHelper.cpp:550: Parsing of fare input file: ../../test/samples/fare01.csv succeeded: read 417 characters. The input file has not been fully read. Stop point: 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-11-02 18:21:21
|
Revision: 21 http://simfqt.svn.sourceforge.net/simfqt/?rev=21&view=rev Author: denis_arnaud Date: 2010-11-02 18:21:15 +0000 (Tue, 02 Nov 2010) Log Message: ----------- [Test] Fixed the SimFQT, as it was using the old API of the SimFQT service. Modified Paths: -------------- trunk/simfqt/test/simfqt/FQTTestSuite.cpp Modified: trunk/simfqt/test/simfqt/FQTTestSuite.cpp =================================================================== --- trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-11-02 18:19:06 UTC (rev 20) +++ trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-11-02 18:21:15 UTC (rev 21) @@ -21,11 +21,14 @@ try { + // Fare input file name + stdair::Filename_T lFareInputFilename ("../samples/fare01.csv"); + // Airline code - std::string lAirlineCode ("SV"); + //std::string lAirlineCode ("SV"); // Number of passengers in the travelling group - SIMFQT::PartySize_T lPartySize = 5; + //SIMFQT::PartySize_T lPartySize = 5; // Output log File std::string lLogFilename ("FQTTestSuite.log"); @@ -38,28 +41,22 @@ // Initialise the list of classes/buckets const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); - SIMFQT::SIMFQT_Service simfqtService (lLogParams, lAirlineCode); + SIMFQT::SIMFQT_Service simfqtService (lLogParams, lFareInputFilename); // Perform a price quotation //simfqtService.priceQuote (lAirlineCode, lPartySize); } catch (const SIMFQT::RootException& otexp) { - std::cerr << "Standard exception: " << otexp.what() << std::endl; - return; + std::cerr << "SimFQT exception: " << otexp.what() << std::endl; } catch (const std::exception& stde) { std::cerr << "Standard exception: " << stde.what() << std::endl; - return; - - } catch (...) { - return; } - } // ////////////////////////////////////////////////////////////////////// void FQTTestSuite::simpleFQT () { - // TODO: Check that the fqt goes as expected + // TODO: Check that the FQT goes as expected CPPUNIT_ASSERT_NO_THROW ( simpleFQTHelper();); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-11-02 18:19:14
|
Revision: 20 http://simfqt.svn.sourceforge.net/simfqt/?rev=20&view=rev Author: denis_arnaud Date: 2010-11-02 18:19:06 +0000 (Tue, 02 Nov 2010) Log Message: ----------- [Dev] Suppressed the try-catch clause in the SimFQT batch. Modified Paths: -------------- trunk/simfqt/simfqt/batches/simfqt.cpp Property Changed: ---------------- trunk/simfqt/simfqt/batches/ Property changes on: trunk/simfqt/simfqt/batches ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile .log + .deps .libs Makefile.in Makefile simfqt simfqt.log Modified: trunk/simfqt/simfqt/batches/simfqt.cpp =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-02 16:57:09 UTC (rev 19) +++ trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-02 18:19:06 UTC (rev 20) @@ -27,7 +27,7 @@ const std::string K_SIMFQT_DEFAULT_LOG_FILENAME ("simfqt.log"); /** Default name and location for the (CSV) input file. */ -const std::string K_SIMFQT_DEFAULT_INPUT_FILENAME ("../../test/samples/fare01.csv"); +const std::string K_SIMFQT_DEFAULT_FARE_INPUT_FILENAME ("../../test/samples/fare01.csv"); /** Default query string. */ const std::string K_SIMFQT_DEFAULT_QUERY_STRING ("my good old query"); @@ -87,7 +87,7 @@ /** Read and parse the command line options. */ int readConfiguration (int argc, char* argv[], std::string& ioQueryString, - stdair::Filename_T& ioInputFilename, + stdair::Filename_T& ioFareInputFilename, std::string& ioLogFilename) { // Initialise the travel query string, if that one is empty @@ -111,8 +111,8 @@ boost::program_options::options_description config ("Configuration"); config.add_options() ("input,i", - boost::program_options::value< std::string >(&ioInputFilename)->default_value(K_SIMFQT_DEFAULT_INPUT_FILENAME), - "(CVS) input file for the demand distributions") + boost::program_options::value< std::string >(&ioFareInputFilename)->default_value(K_SIMFQT_DEFAULT_FARE_INPUT_FILENAME), + "(CVS) input file for the fares") ("log,l", boost::program_options::value< std::string >(&ioLogFilename)->default_value(K_SIMFQT_DEFAULT_LOG_FILENAME), "Filepath for the logs") @@ -157,8 +157,8 @@ } if (vm.count ("input")) { - ioInputFilename = vm["input"].as< std::string >(); - std::cout << "Input filename is: " << ioInputFilename << std::endl; + ioFareInputFilename = vm["input"].as< std::string >(); + std::cout << "Input filename is: " << ioFareInputFilename << std::endl; } if (vm.count ("log")) { @@ -174,39 +174,36 @@ // /////////////// M A I N ///////////////// int main (int argc, char* argv[]) { - try { - // Query - std::string lQuery; + // Query + std::string lQuery; - // Input file name - stdair::Filename_T lInputFilename; + // Fare input file name + stdair::Filename_T lFareInputFilename; - // Output log File - std::string lLogFilename; + // Output log File + std::string lLogFilename; - // Call the command-line option parser - const int lOptionParserStatus = - readConfiguration (argc, argv, lQuery, lInputFilename, lLogFilename); + // Call the command-line option parser + const int lOptionParserStatus = + readConfiguration (argc, argv, lQuery, lFareInputFilename, lLogFilename); - if (lOptionParserStatus == K_SIMFQT_EARLY_RETURN_STATUS) { - return 0; - } + if (lOptionParserStatus == K_SIMFQT_EARLY_RETURN_STATUS) { + return 0; + } - // Set the log parameters - std::ofstream logOutputFile; - // Open and clean the log outputfile - logOutputFile.open (lLogFilename.c_str()); - logOutputFile.clear(); + // Set the log parameters + std::ofstream logOutputFile; + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); - // Initialise the Simfqt service object - const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); - SIMFQT::SIMFQT_Service simfqtService (lLogParams, lInputFilename); + // Initialise the Simfqt service object + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + SIMFQT::SIMFQT_Service simfqtService (lLogParams, lFareInputFilename); - // Close the Log outputFile - logOutputFile.close(); + // Close the Log outputFile + logOutputFile.close(); - } CATCH_ALL_EXCEPTIONS - return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gsa...@us...> - 2010-11-02 16:57:15
|
Revision: 19 http://simfqt.svn.sourceforge.net/simfqt/?rev=19&view=rev Author: gsabatier Date: 2010-11-02 16:57:09 +0000 (Tue, 02 Nov 2010) Log Message: ----------- [test] Bug fixed in FQTTestSuite.cpp file: no more call to priceQuote function Modified Paths: -------------- trunk/simfqt/test/simfqt/FQTTestSuite.cpp Modified: trunk/simfqt/test/simfqt/FQTTestSuite.cpp =================================================================== --- trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-11-02 16:01:27 UTC (rev 18) +++ trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-11-02 16:57:09 UTC (rev 19) @@ -41,7 +41,7 @@ SIMFQT::SIMFQT_Service simfqtService (lLogParams, lAirlineCode); // Perform a price quotation - simfqtService.priceQuote (lAirlineCode, lPartySize); + //simfqtService.priceQuote (lAirlineCode, lPartySize); } catch (const SIMFQT::RootException& otexp) { std::cerr << "Standard exception: " << otexp.what() << std::endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gsa...@us...> - 2010-11-02 16:01:35
|
Revision: 18 http://simfqt.svn.sourceforge.net/simfqt/?rev=18&view=rev Author: gsabatier Date: 2010-11-02 16:01:27 +0000 (Tue, 02 Nov 2010) Log Message: ----------- The simfqt parser files are now committed Modified Paths: -------------- trunk/simfqt/simfqt/SIMFQT_Service.hpp trunk/simfqt/simfqt/SIMFQT_Types.hpp trunk/simfqt/simfqt/batches/Makefile.am trunk/simfqt/simfqt/batches/sources.mk trunk/simfqt/simfqt/bom/Makefile.am trunk/simfqt/simfqt/bom/sources.mk trunk/simfqt/simfqt/command/FareQuoter.cpp trunk/simfqt/simfqt/command/FareQuoter.hpp trunk/simfqt/simfqt/command/sources.mk trunk/simfqt/simfqt/factory/FacSupervisor.cpp trunk/simfqt/simfqt/factory/FacSupervisor.hpp trunk/simfqt/simfqt/factory/sources.mk trunk/simfqt/simfqt/service/SIMFQT_Service.cpp Added Paths: ----------- trunk/simfqt/simfqt/basic/BasParserTypes.hpp trunk/simfqt/simfqt/batches/simfqt.cpp trunk/simfqt/simfqt/batches/simfqt.log trunk/simfqt/simfqt/bom/FareRuleStruct.cpp trunk/simfqt/simfqt/bom/FareRuleStruct.hpp trunk/simfqt/simfqt/command/FareParser.cpp trunk/simfqt/simfqt/command/FareParser.hpp trunk/simfqt/simfqt/command/FareParserHelper.cpp trunk/simfqt/simfqt/command/FareParserHelper.hpp trunk/simfqt/simfqt/command/FareRuleGenerator.cpp trunk/simfqt/simfqt/command/FareRuleGenerator.hpp Removed Paths: ------------- trunk/simfqt/simfqt/bom/BomAbstract.cpp trunk/simfqt/simfqt/bom/BomAbstract.hpp trunk/simfqt/simfqt/factory/FacBomAbstract.cpp trunk/simfqt/simfqt/factory/FacBomAbstract.hpp Property Changed: ---------------- trunk/simfqt/simfqt/batches/ Modified: trunk/simfqt/simfqt/SIMFQT_Service.hpp =================================================================== --- trunk/simfqt/simfqt/SIMFQT_Service.hpp 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/SIMFQT_Service.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -26,11 +26,7 @@ /** Interface for the SIMFQT Services. */ class SIMFQT_Service { public: - // /////////// Business Methods ///////////// - /** Perform a price quotation for the travel request. */ - Price_T priceQuote (const AirlineCode_T&, const PartySize_T&); - - + // /////////// Business Methods ///////////// // ////////////////// Constructors and Destructors ////////////////// /** Constructor. <br>The init() method is called; see the corresponding documentation Modified: trunk/simfqt/simfqt/SIMFQT_Types.hpp =================================================================== --- trunk/simfqt/simfqt/SIMFQT_Types.hpp 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/SIMFQT_Types.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -5,13 +5,25 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <exception> +#include <vector> #include <string> +// StdAir namespace SIMFQT { // ///////// Exceptions /////////// class RootException : public std::exception { + public: + /** Constructors. */ + RootException (const std::string& iWhat) : _what (iWhat) {} + RootException () : _what ("No more details") {} + /** Destructor. */ + virtual ~RootException() throw() {} + /** Give the details of the exception. */ + const char* what() const throw() { return _what.c_str(); } + protected: + /** Details for the exception. */ + std::string _what; }; class NonInitialisedServiceException : public RootException { @@ -32,7 +44,20 @@ class QuotingException : public RootException { }; + class FileException : public RootException { + public: + /** Constructor. */ + FileException (const std::string& iWhat) : RootException (iWhat) {} + }; + class FareInputFileNotFoundException : public FileException { + public: + /** Constructor. */ + FareInputFileNotFoundException (const std::string& iWhat) + : FileException (iWhat) {} + }; + + // /////////////// Log ///////////// /** Level of logs. */ namespace LOG { @@ -50,14 +75,11 @@ // //////// Type definitions ///////// /** ID for the Fare Quote system. */ - typedef std::string FareQuoteID_T; + typedef unsigned int FareQuoteID_T; - /** Price, in Euros. */ + /** Price in euros. */ typedef double Price_T; - /** IATA code of an airline. */ - typedef std::string AirlineCode_T; - /** Number of passengers (in a group) for a booking. */ typedef unsigned short PartySize_T; Added: trunk/simfqt/simfqt/basic/BasParserTypes.hpp =================================================================== --- trunk/simfqt/simfqt/basic/BasParserTypes.hpp (rev 0) +++ trunk/simfqt/simfqt/basic/BasParserTypes.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,71 @@ +#ifndef __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP +#define __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// Boost +//#define BOOST_SPIRIT_DEBUG +#include <boost/spirit/home/classic/core.hpp> +#include <boost/spirit/home/classic/attribute.hpp> +#include <boost/spirit/home/classic/utility/functor_parser.hpp> +#include <boost/spirit/home/classic/utility/loops.hpp> +#include <boost/spirit/home/classic/utility/chset.hpp> +#include <boost/spirit/home/classic/utility/confix.hpp> +#include <boost/spirit/home/classic/iterator/file_iterator.hpp> +#include <boost/spirit/home/classic/actor/push_back_actor.hpp> +#include <boost/spirit/home/classic/actor/assign_actor.hpp> + +namespace SIMFQT { + + // /////////////////////////////////////////////////////////////////////// + // + // Definition of Basic Types + // + // /////////////////////////////////////////////////////////////////////// + // For a file, the parsing unit is the character (char). For a string, + // it is a "char const *". + // typedef char const* iterator_t; + typedef char char_t; + + // The types of iterator, scanner and rule are then derived from + // the parsing unit. + typedef boost::spirit::classic::file_iterator<char_t> iterator_t; + typedef boost::spirit::classic::scanner<iterator_t> scanner_t; + typedef boost::spirit::classic::rule<scanner_t> rule_t; + + // /////////////////////////////////////////////////////////////////////// + // + // Parser related types + // + // /////////////////////////////////////////////////////////////////////// + /** 1-digit-integer parser */ + typedef boost::spirit::classic::int_parser<unsigned int, 10, 1, 1> int1_p_t; + + /** 2-digit-integer parser */ + typedef boost::spirit::classic::uint_parser<unsigned int, 10, 2, 2> uint2_p_t; + + /** 4-digit-integer parser */ + typedef boost::spirit::classic::uint_parser<unsigned int, 10, 4, 4> uint4_p_t; + + /** Up-to-4-digit-integer parser */ + typedef boost::spirit::classic::uint_parser<unsigned int, 10, 1, 4> uint1_4_p_t; + + /** character set */ + typedef boost::spirit::classic::chset<char_t> chset_t; + + /** (Repeating) sequence of a given number of characters: + repeat_p(min, max) */ + typedef boost::spirit::classic::impl::loop_traits<chset_t, + unsigned int, + unsigned int>::type repeat_p_t; + + /** Bounded-number-of-integers parser */ + typedef boost::spirit::classic::bounded<uint2_p_t, unsigned int> bounded2_p_t; + typedef boost::spirit::classic::bounded<uint4_p_t, unsigned int> bounded4_p_t; + typedef boost::spirit::classic::bounded<uint1_4_p_t, unsigned int> bounded1_4_p_t; + +} +#endif // __AIRSCHED_BAS_BASCOMPARSERTYPES_HPP Property changes on: trunk/simfqt/simfqt/batches ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile + .deps .libs Makefile.in Makefile .log Modified: trunk/simfqt/simfqt/batches/Makefile.am =================================================================== --- trunk/simfqt/simfqt/batches/Makefile.am 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/batches/Makefile.am 2010-11-02 16:01:27 UTC (rev 18) @@ -7,9 +7,10 @@ MAINTAINERCLEANFILES = Makefile.in # Binaries (batches) -bin_PROGRAMS = +bin_PROGRAMS = simfqt -#simfqt_SOURCES = $(batches_h_sources) $(batches_cc_sources) -#simfqt_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS) -#simfqt_LDADD = -#simfqt_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(STDAIR_LIBS) $(top_builddir)/simfqt/core/libsimfqt.la +simfqt_SOURCES = $(simfqt_batches_h_sources) $(simfqt_batches_cc_sources) +simfqt_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS) +simfqt_LDADD = +simfqt_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(STDAIR_LIBS) \ + $(top_builddir)/simfqt/core/libsimfqt.la Added: trunk/simfqt/simfqt/batches/simfqt.cpp =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.cpp (rev 0) +++ trunk/simfqt/simfqt/batches/simfqt.cpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,212 @@ +// STL +#include <cassert> +#include <iostream> +#include <sstream> +#include <fstream> +#include <vector> +#include <list> +#include <string> +// Boost (Extended STL) +#include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/date_time/gregorian/gregorian.hpp> +#include <boost/tokenizer.hpp> +#include <boost/program_options.hpp> +// StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/STDAIR_Service.hpp> +#include <stdair/service/Logger.hpp> +// Simfqt +#include <simfqt/SIMFQT_Service.hpp> + +// //////// Type definitions /////// +typedef std::vector<std::string> WordList_T; + + +// //////// Constants ////// +/** Default name and location for the log file. */ +const std::string K_SIMFQT_DEFAULT_LOG_FILENAME ("simfqt.log"); + +/** Default name and location for the (CSV) input file. */ +const std::string K_SIMFQT_DEFAULT_INPUT_FILENAME ("../../test/samples/fare01.csv"); + +/** Default query string. */ +const std::string K_SIMFQT_DEFAULT_QUERY_STRING ("my good old query"); + + +// ////////////////////////////////////////////////////////////////////// +void tokeniseStringIntoWordList (const std::string& iPhrase, + WordList_T& ioWordList) { + // Empty the word list + ioWordList.clear(); + + // Boost Tokeniser + typedef boost::tokenizer<boost::char_separator<char> > Tokeniser_T; + + // Define the separators + const boost::char_separator<char> lSepatorList(" .,;:|+-*/_=!@#$%`~^&(){}[]?'<>\""); + + // Initialise the phrase to be tokenised + Tokeniser_T lTokens (iPhrase, lSepatorList); + for (Tokeniser_T::const_iterator tok_iter = lTokens.begin(); + tok_iter != lTokens.end(); ++tok_iter) { + const std::string& lTerm = *tok_iter; + ioWordList.push_back (lTerm); + } + +} + +// ////////////////////////////////////////////////////////////////////// +std::string createStringFromWordList (const WordList_T& iWordList) { + std::ostringstream oStr; + + unsigned short idx = iWordList.size(); + for (WordList_T::const_iterator itWord = iWordList.begin(); + itWord != iWordList.end(); ++itWord, --idx) { + const std::string& lWord = *itWord; + oStr << lWord; + if (idx > 1) { + oStr << " "; + } + } + + return oStr.str(); +} + + +// ///////// Parsing of Options & Configuration ///////// +// A helper function to simplify the main part. +template<class T> std::ostream& operator<< (std::ostream& os, + const std::vector<T>& v) { + std::copy (v.begin(), v.end(), std::ostream_iterator<T> (std::cout, " ")); + return os; +} + +/** Early return status (so that it can be differentiated from an error). */ +const int K_SIMFQT_EARLY_RETURN_STATUS = 99; + +/** Read and parse the command line options. */ +int readConfiguration (int argc, char* argv[], + std::string& ioQueryString, + stdair::Filename_T& ioInputFilename, + std::string& ioLogFilename) { + + // Initialise the travel query string, if that one is empty + if (ioQueryString.empty() == true) { + ioQueryString = K_SIMFQT_DEFAULT_QUERY_STRING; + } + + // Transform the query string into a list of words (STL strings) + WordList_T lWordList; + tokeniseStringIntoWordList (ioQueryString, lWordList); + + // Declare a group of options that will be allowed only on command line + boost::program_options::options_description generic ("Generic options"); + generic.add_options() + ("prefix", "print installation prefix") + ("version,v", "print version string") + ("help,h", "produce help message"); + + // Declare a group of options that will be allowed both on command + // line and in config file + boost::program_options::options_description config ("Configuration"); + config.add_options() + ("input,i", + boost::program_options::value< std::string >(&ioInputFilename)->default_value(K_SIMFQT_DEFAULT_INPUT_FILENAME), + "(CVS) input file for the demand distributions") + ("log,l", + boost::program_options::value< std::string >(&ioLogFilename)->default_value(K_SIMFQT_DEFAULT_LOG_FILENAME), + "Filepath for the logs") + ("query,q", + boost::program_options::value< WordList_T >(&lWordList)->multitoken(), + "Query word list") + ; + + // Hidden options, will be allowed both on command line and + // in config file, but will not be shown to the user. + boost::program_options::options_description hidden ("Hidden options"); + hidden.add_options() + ("copyright", + boost::program_options::value< std::vector<std::string> >(), + "Show the copyright (license)"); + + boost::program_options::options_description cmdline_options; + cmdline_options.add(generic).add(config).add(hidden); + + boost::program_options::options_description config_file_options; + config_file_options.add(config).add(hidden); + + boost::program_options::options_description visible ("Allowed options"); + visible.add(generic).add(config); + + boost::program_options::positional_options_description p; + p.add ("copyright", -1); + + boost::program_options::variables_map vm; + boost::program_options:: + store (boost::program_options::command_line_parser (argc, argv). + options (cmdline_options).positional(p).run(), vm); + + std::ifstream ifs ("simfqt.cfg"); + boost::program_options::store (parse_config_file (ifs, config_file_options), + vm); + boost::program_options::notify (vm); + + if (vm.count ("help")) { + std::cout << visible << std::endl; + return K_SIMFQT_EARLY_RETURN_STATUS; + } + + if (vm.count ("input")) { + ioInputFilename = vm["input"].as< std::string >(); + std::cout << "Input filename is: " << ioInputFilename << std::endl; + } + + if (vm.count ("log")) { + ioLogFilename = vm["log"].as< std::string >(); + std::cout << "Log filename is: " << ioLogFilename << std::endl; + } + + ioQueryString = createStringFromWordList (lWordList); + std::cout << "The query string is: " << ioQueryString << std::endl; + + return 0; +} + +// /////////////// M A I N ///////////////// +int main (int argc, char* argv[]) { + try { + + // Query + std::string lQuery; + + // Input file name + stdair::Filename_T lInputFilename; + + // Output log File + std::string lLogFilename; + + // Call the command-line option parser + const int lOptionParserStatus = + readConfiguration (argc, argv, lQuery, lInputFilename, lLogFilename); + + if (lOptionParserStatus == K_SIMFQT_EARLY_RETURN_STATUS) { + return 0; + } + + // Set the log parameters + std::ofstream logOutputFile; + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + // Initialise the Simfqt service object + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + SIMFQT::SIMFQT_Service simfqtService (lLogParams, lInputFilename); + + // Close the Log outputFile + logOutputFile.close(); + + } CATCH_ALL_EXCEPTIONS + + return 0; +} Added: trunk/simfqt/simfqt/batches/simfqt.log =================================================================== --- trunk/simfqt/simfqt/batches/simfqt.log (rev 0) +++ trunk/simfqt/simfqt/batches/simfqt.log 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,2 @@ +[D]../../simfqt/command/FareParserHelper.cpp:530: Parsing fare input file: ../../test/samples/fare01.csv +[D]../../simfqt/command/FareParserHelper.cpp:550: Parsing of fare input file: ../../test/samples/fare01.csv succeeded: read 417 characters. The input file has not been fully read. Stop point: 1 Modified: trunk/simfqt/simfqt/batches/sources.mk =================================================================== --- trunk/simfqt/simfqt/batches/sources.mk 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/batches/sources.mk 2010-11-02 16:01:27 UTC (rev 18) @@ -1,2 +1,2 @@ -batches_h_sources = -batches_cc_sources = +simfqt_batches_h_sources = +simfqt_batches_cc_sources = $(top_srcdir)/simfqt/batches/simfqt.cpp Deleted: trunk/simfqt/simfqt/bom/BomAbstract.cpp =================================================================== --- trunk/simfqt/simfqt/bom/BomAbstract.cpp 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/bom/BomAbstract.cpp 2010-11-02 16:01:27 UTC (rev 18) @@ -1,9 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// SIMFQT -#include <simfqt/bom/BomAbstract.hpp> - -namespace SIMFQT { - -} Deleted: trunk/simfqt/simfqt/bom/BomAbstract.hpp =================================================================== --- trunk/simfqt/simfqt/bom/BomAbstract.hpp 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/bom/BomAbstract.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -1,91 +0,0 @@ -#ifndef __SIMFQT_BOM_BOMABSTRACT_HPP -#define __SIMFQT_BOM_BOMABSTRACT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -#include <string> - -namespace SIMFQT { - - /** Base class for the Business Object Model (BOM) layer. */ - class BomAbstract { - friend class FacBomAbstract; - public: - // /////////// Display support methods ///////// - /** Dump a Business Object into an output stream. - @param ostream& the output stream. */ - virtual void toStream (std::ostream& ioOut) const = 0; - - /** Read a Business Object from an input stream. - @param istream& the input stream. */ - virtual void fromStream (std::istream& ioIn) = 0; - - /** Get the serialised version of the Business Object. */ - virtual std::string toString() const = 0; - - /** Get a string describing the whole key (differentiating two objects - at any level). */ - virtual std::string describeKey() const = 0; - - /** Get a string describing the short key (differentiating two objects - at the same level). */ - virtual std::string describeShortKey() const = 0; - - - protected: - /** Protected Default Constructor to ensure this class is abtract. */ - BomAbstract() {} - BomAbstract(const BomAbstract&) {} - - /** Destructor. */ - virtual ~BomAbstract() {} - }; -} - -/** - Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing - Output Operators" (p653) of his book "The C++ Standard Library: A Tutorial - and Reference", published by Addison-Wesley. - */ -template <class charT, class traits> -inline -std::basic_ostream<charT, traits>& -operator<< (std::basic_ostream<charT, traits>& ioOut, - const SIMFQT::BomAbstract& iBom) { - /** - string stream: - - with same format - - without special field width - */ - std::basic_ostringstream<charT,traits> ostr; - ostr.copyfmt (ioOut); - ostr.width (0); - - // Fill string stream - iBom.toStream (ostr); - - // Print string stream - ioOut << ostr.str(); - - return ioOut; -} - -/** - Piece of code given by Nicolai M. Josuttis, Section 13.12.1 "Implementing - Output Operators" (pp655-657) of his book "The C++ Standard Library: - A Tutorial and Reference", published by Addison-Wesley. - */ -template <class charT, class traits> -inline -std::basic_istream<charT, traits>& -operator>> (std::basic_istream<charT, traits>& ioIn, - SIMFQT::BomAbstract& ioBom) { - // Fill Bom object with input stream - ioBom.fromStream (ioIn); - return ioIn; -} - -#endif // __SIMFQT_BOM_BOMABSTRACT_HPP Added: trunk/simfqt/simfqt/bom/FareRuleStruct.cpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.cpp (rev 0) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.cpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,49 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <sstream> +// StdAir +#include <stdair/basic/BasConst_General.hpp> +#include <stdair/service/Logger.hpp> +// SIMFQT +#include <simfqt/SIMFQT_Types.hpp> +#include <simfqt/bom/FareRuleStruct.hpp> + +namespace SIMFQT { + + // //////////////////////////////////////////////////////////////////// + FareRuleStruct::FareRuleStruct () + :_fareId(0), _origin(""), _destination(""), + _dateRangeStart(stdair::DEFAULT_DATE), + _dateRangeEnd(stdair::DEFAULT_DATE), + _timeRangeStart(stdair::DEFAULT_EPSILON_DURATION), + _timeRangeEnd(stdair::DEFAULT_EPSILON_DURATION), + _pos (""), _advancePurchase(0), _saturdayStay("T"), + _changeFees("T"), _nonRefundable("T"), + _minimumStay(0), _fare(0), + _airlineCode(""), _classCode("") { + } + + // //////////////////////////////////////////////////////////////////// + stdair::Date_T FareRuleStruct::getDate() const { + return stdair::Date_T (_itYear, _itMonth, _itDay); + } + + // //////////////////////////////////////////////////////////////////// + stdair::Duration_T FareRuleStruct::getTime() const { + return boost::posix_time::hours (_itHours) + + boost::posix_time::minutes (_itMinutes) + + boost::posix_time::seconds (_itSeconds); + } + + + // //////////////////////////////////////////////////////////////////// + const std::string FareRuleStruct::describe () const { + std::ostringstream ostr; + return ostr.str(); + } + +} + Added: trunk/simfqt/simfqt/bom/FareRuleStruct.hpp =================================================================== --- trunk/simfqt/simfqt/bom/FareRuleStruct.hpp (rev 0) +++ trunk/simfqt/simfqt/bom/FareRuleStruct.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,108 @@ +#ifndef __SIMFQT_BOM_FARERULESTRUCT_HPP +#define __SIMFQT_BOM_FARERULESTRUCT_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +#include <vector> +// STDAIR +#include <stdair/STDAIR_Types.hpp> +#include <stdair/basic/StructAbstract.hpp> +// SIMFQT +#include <simfqt/SIMFQT_Types.hpp> + +namespace SIMFQT { + + /** Utility Structure for the parsing of Flight-Period structures. */ + struct FareRuleStruct : public stdair::StructAbstract { + public: + + /** Default constructor. */ + FareRuleStruct (); + + /** Get the date from the staging details. */ + stdair::Date_T getDate() const; + + /** Get the time from the staging details. */ + stdair::Duration_T getTime() const; + + /** Display of the structure. */ + const std::string describe() const; + + // ////////////////// Attributes ///////////////// + /** Staging Date. */ + unsigned int _itYear; + unsigned int _itMonth; + unsigned int _itDay; + + /** Staging Time. */ + long _itHours; + long _itMinutes; + long _itSeconds; + + + unsigned long int _nbOfAirlines; + + /** Fare ID. */ + SIMFQT::FareQuoteID_T _fareId; + + /** Origin. */ + stdair::AirportCode_T _origin; + + /** Destination. */ + stdair::AirportCode_T _destination; + + /** Start Range date available for this fare rule.*/ + stdair::Date_T _dateRangeStart; + + /** Start Range date available for this fare rule.*/ + stdair::Date_T _dateRangeEnd; + + /** Start time from the time range available for this fare rule.*/ + stdair::Duration_T _timeRangeStart; + + /** End time from the time range available for this fare rule.*/ + stdair::Duration_T _timeRangeEnd; + + /** Point-of-sale. */ + stdair::AirlineCode_T _pos; + + /** Channel distribution. */ + stdair::ChannelLabel_T _channel; + + /** Number of days that the ticket is sold before the flightDate.*/ + stdair::DayDuration_T _advancePurchase; + + /** Boolean saying whether a saturday is considered during the stay .*/ + stdair::SaturdayStay_T _saturdayStay; + + /** Boolean saying whether the change fees option is requested or not.*/ + stdair::ChangeFees_T _changeFees; + + /** Boolean saying whether the refundable option is requested or not.*/ + stdair::NonRefundable_T _nonRefundable; + + /** Number of days that the customer spent into the destination city.*/ + stdair::DayDuration_T _minimumStay; + + /** Price.*/ + stdair::PriceValue_T _fare; + + /** Airline code */ + stdair::AirlineCode_T _airlineCode; + + /** Code */ + stdair::ClassCode_T _classCode; + + /** Airline Code List*/ + stdair::AirlineCodeList_T _airlineCodeList; + + /** Class Code List*/ + stdair::ClassCodeList_T _classCodeList; + + }; + +} +#endif // __SIMFQT_BOM_FARERULESTRUCT_HPP Modified: trunk/simfqt/simfqt/bom/Makefile.am =================================================================== --- trunk/simfqt/simfqt/bom/Makefile.am 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/bom/Makefile.am 2010-11-02 16:01:27 UTC (rev 18) @@ -6,7 +6,7 @@ noinst_LTLIBRARIES = libsimfqtbom.la libsimfqtbom_la_SOURCES = $(simfqt_bom_h_sources) $(simfqt_bom_cc_sources) -libsimfqtbom_la_CXXFLAGS = +libsimfqtbom_la_CXXFLAGS = $(STDAIR_CFLAGS) libsimfqtbom_la_LDFLAGS = # Modified: trunk/simfqt/simfqt/bom/sources.mk =================================================================== --- trunk/simfqt/simfqt/bom/sources.mk 2010-11-01 10:54:47 UTC (rev 17) +++ trunk/simfqt/simfqt/bom/sources.mk 2010-11-02 16:01:27 UTC (rev 18) @@ -1,4 +1,2 @@ -simfqt_bom_h_sources = \ - $(top_srcdir)/simfqt/bom/BomAbstract.hpp -simfqt_bom_cc_sources = \ - $(top_srcdir)/simfqt/bom/BomAbstract.cpp +simfqt_bom_h_sources = $(top_srcdir)/simfqt/bom/FareRuleStruct.hpp +simfqt_bom_cc_sources = $(top_srcdir)/simfqt/bom/FareRuleStruct.cpp Added: trunk/simfqt/simfqt/command/FareParser.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParser.cpp (rev 0) +++ trunk/simfqt/simfqt/command/FareParser.cpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,27 @@ +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <string> +// StdAir +//#include <stdair/bom/Inventory.hpp> +// AirSched +#include <simfqt/command/FareParserHelper.hpp> +#include <simfqt/command/FareParser.hpp> + +namespace SIMFQT { + + // ////////////////////////////////////////////////////////////////////// + void FareParser::fareRuleGeneration (const stdair::Filename_T& iFilename, + stdair::BomRoot& ioBomRoot) { + + // Initialise the Fare file parser. + FareRuleFileParser lFareRuleFileParser (ioBomRoot, iFilename); + + // Parse the CSV-formatted fare input file generate the + // corresponding fare rules and fulfill the WorldSchedule. + lFareRuleFileParser.generateFareRules (); + } + +} Added: trunk/simfqt/simfqt/command/FareParser.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParser.hpp (rev 0) +++ trunk/simfqt/simfqt/command/FareParser.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,31 @@ +#ifndef __SIMFQT_CMD_FAREPARSER_HPP +#define __SIMFQT_CMD_FAREPARSER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// StdAir +#include <stdair/STDAIR_Types.hpp> +#include <stdair/command/CmdAbstract.hpp> + +// Forward declarations. +namespace stdair { + class BomRoot; +} + +namespace SIMFQT { + + /** Class wrapping the parser entry point. */ + class FareParser : public stdair::CmdAbstract { + public: + /** Parses the CSV file describing the fares for the + simulator, and generates the inventories accordingly. + @param const stdair::Filename_T& The file-name of the CSV-formatted + schedule input file. + @param stdair::BomRoot& Root of the BOM tree. */ + static void fareRuleGeneration (const stdair::Filename_T&, stdair::BomRoot&); + }; +} +#endif // __SIMFQT_CMD_FAREPARSER_HPP Added: trunk/simfqt/simfqt/command/FareParserHelper.cpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.cpp (rev 0) +++ trunk/simfqt/simfqt/command/FareParserHelper.cpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,563 @@ + // ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <cassert> +#include <vector> +// StdAir +#include <stdair/basic/BasFileMgr.hpp> +#include <stdair/bom/BomRoot.hpp> +#include <stdair/service/Logger.hpp> +// SIMFQT +#include <simfqt/command/FareParserHelper.hpp> +#include <simfqt/command/FareRuleGenerator.hpp> + +namespace SIMFQT { + + namespace FareParserHelper { + + // ////////////////////////////////////////////////////////////////// + // Semantic actions + // ////////////////////////////////////////////////////////////////// + + ParserSemanticAction:: + ParserSemanticAction (FareRuleStruct& ioFareRule) + : _fareRule (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + storeFareId:: + storeFareId (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeFareId::operator() (unsigned int iFareId) const { + _fareRule._fareId = iFareId; + + //STDAIR_LOG_DEBUG ( "Fare Id: " << _fareRule._fareId); + + _fareRule._nbOfAirlines = 0; + _fareRule._airlineCode = ""; + _fareRule._classCode = ""; + _fareRule._airlineCodeList.clear(); + _fareRule._classCodeList.clear(); + } + + // ////////////////////////////////////////////////////////////////// + storeOrigin :: + storeOrigin (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeOrigin::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + stdair::AirportCode_T lOrigin (iStr, iStrEnd); + //STDAIR_LOG_DEBUG ( "Origin: " << lOrigin); + _fareRule._origin = lOrigin; + } + + // ////////////////////////////////////////////////////////////////// + storeDestination :: + storeDestination (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeDestination::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + stdair::AirportCode_T lDestination (iStr, iStrEnd); + //STDAIR_LOG_DEBUG ( "Destination: " << lDestination); + _fareRule._destination = lDestination; + } + + // ////////////////////////////////////////////////////////////////// + storeDateRangeStart:: + storeDateRangeStart (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeDateRangeStart::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + _fareRule._dateRangeStart = _fareRule.getDate(); + //STDAIR_LOG_DEBUG ("Date Range Start: "<< _fareRule._dateRangeStart); + } + + // ////////////////////////////////////////////////////////////////// + storeDateRangeEnd:: + storeDateRangeEnd(FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeDateRangeEnd::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + _fareRule._dateRangeEnd = _fareRule.getDate(); + //STDAIR_LOG_DEBUG ("Date Range End: " << _fareRule._dateRangeEnd); + } + + // ////////////////////////////////////////////////////////////////// + storeStartRangeTime:: + storeStartRangeTime (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeStartRangeTime::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + _fareRule._timeRangeStart = _fareRule.getTime(); + //STDAIR_LOG_DEBUG ("Time Range Start: " << _fareRule._timeRangeStart); + // Reset the number of seconds + _fareRule._itSeconds = 0; + } + + // ////////////////////////////////////////////////////////////////// + storeEndRangeTime:: + storeEndRangeTime (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeEndRangeTime::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + _fareRule._timeRangeEnd = _fareRule.getTime(); + // STDAIR_LOG_DEBUG ("Time Range End: " << _fareRule._timeRangeEnd); + // Reset the number of seconds + _fareRule._itSeconds = 0; + } + + // ////////////////////////////////////////////////////////////////// + storePOS :: + storePOS (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storePOS::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + stdair::AirlineCode_T lPOS (iStr, iStrEnd); + _fareRule._pos = lPOS; + //STDAIR_LOG_DEBUG ("POS: " << _fareRule._pos); + } + + // ////////////////////////////////////////////////////////////////// + storeChannel :: + storeChannel (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeChannel::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + stdair::ChannelLabel_T lChannel (iStr, iStrEnd); + _fareRule._channel = lChannel; + if (lChannel != "IN" && lChannel != "IF" + && lChannel != "DN" && lChannel != "DF") { + STDAIR_LOG_DEBUG ("Invalid channel " << lChannel); + } + // STDAIR_LOG_DEBUG ("Channel: " << _fareRule._channel); + } + + // ////////////////////////////////////////////////////////////////// + storeAdvancePurchase :: + storeAdvancePurchase (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeAdvancePurchase::operator() (unsigned int iAdancePurchase) const { + _fareRule._advancePurchase = iAdancePurchase; + //STDAIR_LOG_DEBUG ( "Advance Purchase: " << _fareRule._advancePurchase); + } + + // ////////////////////////////////////////////////////////////////// + storeSaturdayStay :: + storeSaturdayStay (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeSaturdayStay::operator() (char iSaturdayStay) const { + bool lBool = false; + if (iSaturdayStay == 'T') { + lBool = true; + } else { + if (iSaturdayStay != 'F') { + STDAIR_LOG_DEBUG ("Invalid saturdayStay char " << iSaturdayStay); + } + } + stdair::SaturdayStay_T lSaturdayStay (lBool); + _fareRule._saturdayStay = lSaturdayStay; + //STDAIR_LOG_DEBUG ("Saturday Stay: " << _fareRule._saturdayStay); + } + + // ////////////////////////////////////////////////////////////////// + storeChangeFees :: + storeChangeFees (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeChangeFees::operator() (char iChangefees) const { + + bool lBool = false; + if (iChangefees == 'T') { + lBool = true; + } else { + if (iChangefees != 'F') { + STDAIR_LOG_DEBUG ("Invalid change fees char " << iChangefees); + } + } + stdair::ChangeFees_T lChangefees (lBool); + _fareRule._changeFees = lChangefees; + //STDAIR_LOG_DEBUG ("Change fees: " << _fareRule._changeFees); + } + + // ////////////////////////////////////////////////////////////////// + storeNonRefundable :: + storeNonRefundable (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeNonRefundable::operator() (char iNonRefundable) const { + bool lBool = false; + if (iNonRefundable == 'T') { + lBool = true; + } else { + if (iNonRefundable != 'F') { + STDAIR_LOG_DEBUG ("Invalid non refundable char " << iNonRefundable); + } + } + stdair::NonRefundable_T lNonRefundable (lBool); + _fareRule._nonRefundable = lNonRefundable; + // STDAIR_LOG_DEBUG ("Non refundable: " << _fareRule._nonRefundable); + } + + // ////////////////////////////////////////////////////////////////// + storeMinimumStay :: + storeMinimumStay (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeMinimumStay::operator() (unsigned int iMinStay) const { + _fareRule._minimumStay = iMinStay; + //STDAIR_LOG_DEBUG ("Minimum Stay: " << _fareRule._minimumStay ); + } + + // ////////////////////////////////////////////////////////////////// + storeFare :: + storeFare (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeFare::operator() (double iFare) const { + _fareRule._fare = iFare; + // STDAIR_LOG_DEBUG ("Fare: " << _fareRule._fare); + } + + // ////////////////////////////////////////////////////////////////// + storeAirlineCode :: + storeAirlineCode (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeAirlineCode::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + + bool lAlreadyInTheList = false; + stdair::AirlineCode_T lAirlineCode (iStr, iStrEnd); + // Update the airline code + _fareRule._airlineCode = lAirlineCode; + // Test if the FareRule Struct stands for interline products + if (_fareRule._airlineCodeList.size() > 0) { + // Update the number of airlines if necessary + std::vector<stdair::AirlineCode_T>::iterator Airline_iterator; + for (Airline_iterator = _fareRule._airlineCodeList.begin(); + Airline_iterator != _fareRule._airlineCodeList.end(); + ++Airline_iterator) { + stdair::AirlineCode_T lPreviousAirlineCode = + *Airline_iterator; + if (lPreviousAirlineCode == lAirlineCode) { + lAlreadyInTheList = true; + /*STDAIR_LOG_DEBUG ("Airline Code Already Existing: " + << lAirlineCode);*/ + } + } + if (lAlreadyInTheList == false) { + /*STDAIR_LOG_DEBUG ("New Airline Code: " + << lAirlineCode);*/ + _fareRule._airlineCodeList.push_back(lAirlineCode); + } + } else { + /*STDAIR_LOG_DEBUG ("First Airline Code: " + << lAirlineCode);*/ + _fareRule._airlineCodeList.push_back (lAirlineCode); + } + // STDAIR_LOG_DEBUG ( "Airline code: " << lAirlineCode); + } + + // ////////////////////////////////////////////////////////////////// + storeClass :: + storeClass (FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + void storeClass::operator() (char iChar) const { + std::ostringstream ostr; + ostr << iChar; + std::string classCodeStr = ostr.str(); + const stdair::ClassCode_T lClassCode (classCodeStr); + _fareRule._classCodeList.push_back(lClassCode); + // Insertion of this class Code in the whole classCode name + std::ostringstream ostrr; + ostrr << _fareRule._classCode << classCodeStr; + _fareRule._classCode = ostrr.str(); + //STDAIR_LOG_DEBUG ("Class Code: " << lClassCode << std::endl); + + } + + // ////////////////////////////////////////////////////////////////// + doEndFare:: + doEndFare (stdair::BomRoot& ioBomRoot, + FareRuleStruct& ioFareRule) + : ParserSemanticAction (ioFareRule), + _bomRoot (ioBomRoot) { + } + + // ////////////////////////////////////////////////////////////////// + + void doEndFare::operator() (iterator_t iStr, + iterator_t iStrEnd) const { + + // Generation of the fare rule object. + FareRuleGenerator::createFareRule (_bomRoot, _fareRule); + } + + // /////////////////////////////////////////////////////////////////// + // + // Utility Parsers + // + // /////////////////////////////////////////////////////////////////// + + /** 2-digit-integer parser */ + uint2_p_t uint2_p; + + /** 4-digit-integer parser */ + uint4_p_t uint4_p; + + /** Up-to-4-digit-integer parser */ + uint1_4_p_t uint1_4_p; + + /** Sequence of (capital) alphabetic characters: chset_p("A-Z") */ + chset_t alpha_cap_set_p ("A-Z"); + + /** Airport Parser: repeat_p(3)[chset_p("0-9A-Z")] */ + repeat_p_t airport_p (chset_t("0-9A-Z").derived(), 3, 3); + + /** Year Parser: limit_d(2000u, 2099u)[uint4_p] */ + bounded4_p_t year_p (uint4_p.derived(), 2000u, 2099u); + + /** Month Parser: limit_d(1u, 12u)[uint2_p] */ + bounded2_p_t month_p (uint2_p.derived(), 1u, 12u); + + /** Day Parser: limit_d(1u, 31u)[uint2_p] */ + bounded2_p_t day_p (uint2_p.derived(), 1u, 31u); + + /** Hour Parser: limit_d(0u, 23u)[uint2_p] */ + bounded2_p_t hours_p (uint2_p.derived(), 0u, 23u); + + /** Minute Parser: limit_d(0u, 59u)[uint2_p] */ + bounded2_p_t minutes_p (uint2_p.derived(), 0u, 59u); + + /** Second Parser: limit_d(0u, 59u)[uint2_p] */ + bounded2_p_t seconds_p (uint2_p.derived(), 0u, 59u); + + /** Airline Code Parser: repeat_p(2,3)[chset_p("0-9A-Z")] */ + repeat_p_t airline_code_p (chset_t("0-9A-Z").derived(), 2, 3); + + /** Channel type Parser: repeat_p(2,3)[chset_p("A-ZA-Z")] */ + repeat_p_t channel_type_p (chset_t("A-Z").derived(), 2, 3); + + // ////////////////////////////////////////////////////////////////// + // (Boost Spirit) Grammar Definition + // ////////////////////////////////////////////////////////////////// + + // ////////////////////////////////////////////////////////////////// + FareRuleParser:: + FareRuleParser (stdair::BomRoot& ioBomRoot, + FareRuleStruct& ioFareRule) + : _bomRoot (ioBomRoot), + _fareRule (ioFareRule) { + } + + // ////////////////////////////////////////////////////////////////// + template<typename ScannerT> + FareRuleParser::definition<ScannerT>:: + definition (FareRuleParser const& self) { + + fare_rule_list = *( comments | fare_rule ) + ; + + comments = boost::spirit::classic::comment_p("//") + | boost::spirit::classic::comment_p("/*", "*/") + ; + + fare_rule = fare_key + >> +( ';' >> segment ) + >> fare_rule_end[doEndFare(self._bomRoot, self._fareRule)] + ; + + fare_rule_end = boost::spirit::classic::ch_p(';') + ; + + fare_key = fare_id + >> ';' >> (airport_p)[storeOrigin(self._fareRule)] + >> ';' >> (airport_p)[storeDestination(self._fareRule)] + >> ';' >> date[storeDateRangeStart(self._fareRule)] + >> ';' >> date[storeDateRangeEnd(self._fareRule)] + >> ';' >> time[storeStartRangeTime(self._fareRule)] + >> ';' >> time[storeEndRangeTime(self._fareRule)] + >> ';' >> (airport_p)[storePOS(self._fareRule)] + >> ';' >> (channel_type_p)[storeChannel(self._fareRule)] + >> ';' >> (uint1_4_p)[storeAdvancePurchase(self._fareRule)] + >> ';' >> (alpha_cap_set_p)[storeSaturdayStay(self._fareRule)] + >> ';' >> (alpha_cap_set_p)[storeChangeFees(self._fareRule)] + >> ';' >> (alpha_cap_set_p)[storeNonRefundable(self._fareRule)] + >> ';' >> (uint1_4_p)[storeMinimumStay(self._fareRule)] + >> ';' >> (boost::spirit::classic::ureal_p)[storeFare(self._fareRule)] + ; + + fare_id = boost::spirit::classic::lexeme_d[ + (uint1_4_p)[storeFareId(self._fareRule)]] + ; + + date = boost::spirit::classic::lexeme_d[ + (year_p)[boost::spirit::classic::assign_a(self._fareRule._itYear)] + >> '-' + >> (month_p)[boost::spirit::classic::assign_a(self._fareRule._itMonth)] + >> '-' + >> (day_p)[boost::spirit::classic::assign_a(self._fareRule._itDay)]] + ; + + time = boost::spirit::classic::lexeme_d[ + (hours_p)[boost::spirit::classic::assign_a(self._fareRule._itHours)] + >> ':' + >> (minutes_p)[boost::spirit::classic::assign_a(self._fareRule._itMinutes)] + >> !(':' >> (seconds_p)[boost::spirit::classic::assign_a(self._fareRule._itSeconds)])] + ; + + segment = boost::spirit::classic::lexeme_d[ + (airline_code_p)[storeAirlineCode(self._fareRule)]] + >> ';' >> (alpha_cap_set_p)[storeClass(self._fareRule)] + ; + + //BOOST_SPIRIT_DEBUG_NODE (FareRuleParser); + BOOST_SPIRIT_DEBUG_NODE (fare_rule_list); + BOOST_SPIRIT_DEBUG_NODE (comments); + BOOST_SPIRIT_DEBUG_NODE (fare_rule); + BOOST_SPIRIT_DEBUG_NODE (fare_id); + BOOST_SPIRIT_DEBUG_NODE (fare_key); + BOOST_SPIRIT_DEBUG_NODE (segment); + BOOST_SPIRIT_DEBUG_NODE (fare_rule_end); + BOOST_SPIRIT_DEBUG_NODE (date); + BOOST_SPIRIT_DEBUG_NODE (time); + + } + + // ////////////////////////////////////////////////////////////////// + template<typename ScannerT> + boost::spirit::classic::rule<ScannerT> const& + FareRuleParser::definition<ScannerT>::start() const { + return fare_rule_list; + } + + } + + + ///////////////////////////////////////////////////////////////////////// + // + // Entry class for the file parser + // + ///////////////////////////////////////////////////////////////////////// + + // ////////////////////////////////////////////////////////////////////// + FareRuleFileParser:: + FareRuleFileParser (stdair::BomRoot& ioBomRoot, + const stdair::Filename_T& iFilename) + : _filename (iFilename), _bomRoot (ioBomRoot) { + init(); + } + + // ////////////////////////////////////////////////////////////////////// + void FareRuleFileParser::init() { + // Check that the file exists and is readable + const bool doesExistAndIsReadable = + stdair::BasFileMgr::doesExistAndIsReadable (_filename); + + if (doesExistAndIsReadable == false) { + STDAIR_LOG_ERROR ("The fare schedule file " << _filename + << " does not exist or can not be read."); + + throw FareInputFileNotFoundException ("The fare file " + _filename + " does not exist or can not be read"); + } + + // Open the file + _startIterator = iterator_t (_filename); + + // Check the filename exists and can be open + if (!_startIterator) { + STDAIR_LOG_ERROR ("The fare file " << _filename << " can not be open." + << std::endl); + + throw FareInputFileNotFoundException ("The file " + _filename + " does not exist or can not be read"); + } + + // Create an EOF iterator + _endIterator = _startIterator.make_end(); + } + + // ////////////////////////////////////////////////////////////////////// + bool FareRuleFileParser::generateFareRules () { + bool oResult = false; + + STDAIR_LOG_DEBUG ("Parsing fare input file: " << _filename); + + // Initialise the parser (grammar) with the helper/staging structure. + FareParserHelper::FareRuleParser lFPParser (_bomRoot, _fareRule); + + // Launch the parsing of the file and, thanks to the doEndFare + // call-back structure, the building of the whole BomRoot BOM + boost::spirit::classic::parse_info<iterator_t> info = + boost::spirit::classic::parse (_startIterator, _endIterator, lFPParser, + boost::spirit::classic::space_p); + + // Retrieves whether or not the parsing was successful + oResult = info.hit; + + const std::string hasBeenFullyReadStr = (info.full == true)?"":"not "; + if (oResult == true) { + STDAIR_LOG_DEBUG ("Parsing of fare input file: " << _filename + << " succeeded: read " << info.length + << " characters. The input file has " + << hasBeenFullyReadStr + << "been fully read. Stop point: " << info.stop); + + } else { + // TODO: decide whether to throw an exception + STDAIR_LOG_ERROR ("Parsing of fare input file: " << _filename + << " failed: read " << info.length + << " characters. The input file has " + << hasBeenFullyReadStr + << "been fully read. Stop point: " << info.stop); + } + return oResult; + } + +} Added: trunk/simfqt/simfqt/command/FareParserHelper.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareParserHelper.hpp (rev 0) +++ trunk/simfqt/simfqt/command/FareParserHelper.hpp 2010-11-02 16:01:27 UTC (rev 18) @@ -0,0 +1,328 @@ +#ifndef __SIMFQT_CMD_FAREPARSERHELPER_HPP +#define __SIMFQT_CMD_FAREPARSERHELPER_HPP + +// ////////////////////////////////////////////////////////////////////// +// Import section +// ////////////////////////////////////////////////////////////////////// +// STL +#include <string> +// #define BOOST_SPIRIT_DEBUG +// StdAir +#include <stdair/command/CmdAbstract.hpp> +// AirSched +#include <simfqt/SIMFQT_Types.hpp> +#include <simfqt/basic/BasParserTypes.hpp> +#include <simfqt/bom/FareRuleStruct.hpp> + +// Forward declarations +namespace stdair { + class BomRoot; +} + +namespace SIMFQT { + + namespace FareParserHelper { + + // /////////////////////////////////////////////////////////////////// + // Semantic actions + // //////////////////////////////////////////////////// + /////////////// + /** Generic Semantic Action (Actor / Functor) for the Fare Parser. */ + struct ParserSemanticAction { + /** Actor Constructor. */ + ParserSemanticAction (FareRuleStruct&); + /** Actor Context. */ + FareRuleStruct& _fareRule; + }; + + /** Store the parsed fare Id. */ + struct storeFareId : public ParserSemanticAction { + /** Actor Constructor. */ + storeFareId (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (unsigned int) const; + }; + + /** Store the parsed origin. */ + struct storeOrigin : public ParserSemanticAction { + /** Actor Constructor. */ + storeOrigin (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed destination. */ + struct storeDestination : public ParserSemanticAction { + /** Actor Constructor. */ + storeDestination (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed start of the date range. */ + struct storeDateRangeStart : public ParserSemanticAction { + /** Actor Constructor. */ + storeDateRangeStart (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed end of the date range. */ + struct storeDateRangeEnd : public ParserSemanticAction { + /** Actor Constructor. */ + storeDateRangeEnd (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed start range time. */ + struct storeStartRangeTime : public ParserSemanticAction { + /** Actor Constructor. */ + storeStartRangeTime (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t iStr, iterator_t iStrEnd) const; + }; + + /** Store the parsed end start range time. */ + struct storeEndRangeTime : public ParserSemanticAction { + /** Actor Constructor. */ + storeEndRangeTime (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed customer position. */ + struct storePOS : public ParserSemanticAction { + /** Actor Constructor. */ + storePOS (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the channel distribution. */ + struct storeChannel : public ParserSemanticAction { + /** Actor Constructor. */ + storeChannel (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed advance purchase days. */ + struct storeAdvancePurchase : public ParserSemanticAction { + /** Actor Constructor. */ + storeAdvancePurchase (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (unsigned int) const; + }; + + /** Store the parsed saturday night. */ + struct storeSaturdayStay : public ParserSemanticAction { + /** Actor Constructor. */ + storeSaturdayStay (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (char) const; + }; + + /** Store the parsed change fees. */ + struct storeChangeFees : public ParserSemanticAction { + /** Actor Constructor. */ + storeChangeFees (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (char) const; + }; + + /** Store the parsed refundable option */ + struct storeNonRefundable : public ParserSemanticAction { + /** Actor Constructor. */ + storeNonRefundable (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (char) const; + }; + + /** Store the parsed minimum stay. */ + struct storeMinimumStay : public ParserSemanticAction { + /** Actor Constructor. */ + storeMinimumStay (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (unsigned int) const; + }; + + /** Store the parsed fare value. */ + struct storeFare : public ParserSemanticAction { + /** Actor Constructor. */ + storeFare (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (double) const; + }; + + /** Store the parsed airline code. */ + struct storeAirlineCode : public ParserSemanticAction { + /** Actor Constructor. */ + storeAirlineCode (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + }; + + /** Store the parsed class. */ + struct storeClass : public ParserSemanticAction { + /** Actor Constructor. */ + storeClass (FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (char) const; + }; + + /** Mark the end of the fare-rule parsing. */ + struct doEndFare : public ParserSemanticAction { + /** Actor Constructor. */ + doEndFare (stdair::BomRoot&, FareRuleStruct&); + /** Actor Function (functor). */ + void operator() (iterator_t, iterator_t) const; + /** Actor Specific Context. */ + stdair::BomRoot& _bomRoot; + }; + + + ///////////////////////////////////////////////////////////////////////// + // + // (Boost Spirit) Grammar Definition + // + ///////////////////////////////////////////////////////////////////////// + /** + + // Fare: fareID; OriginCity; DestinationCity; DateRangeStart; + DateRangeEnd; DepartureTimeRangeStart; DepartureTimeRangeEnd; + POS; AdvancePurchase; SaturdayNight; ChangeFees; NonRefundable; + MinimumStay; Price; AirlineCode; Class; + + fareID + OriginCity (3-char airport code) + DestinationCity (3-char airport code) + DateRangeStart (yyyy-mm-dd) + DateRangeEnd (yyyy-mm-dd) + DepartureTimeRangeStart (hh:mm) + DepartureTimeRangeEnd (hh:mm) + POS (3-char position city) + Channel (D=direct, I=indirect, N=oNline, F=oFfline) + AdvancePurchase + SaturdayNight (T=True, F=False) + ChangeFees (T=True, F=False) + NonRefundable (T=True, F=False) + MinimumStay + Price + AirlineCode (2-char airline code) + Class (1-char class code) + + Grammar: + Demand ::= PrefDepDate ';' Origin ';' Destination ';' PassengerType + ';' DemandParams ';' PosDist ';' ChannelDist ';' TripDist + ';' StayDist ';' FfDist ';' PrefDepTimeDist + ';' minWTP ';' TimeValueDist ';' DtdDist + EndOfDemand + PrefDepDate ::= date + PassengerType ::= 'T' | 'F' + DemandParams ::= DemandMean ';' DemandStdDev + PosDist ::= PosPair (',' PosPair)* + PosPair ::= PosCode ':' PosShare + PosCode ::= AirportCode | "row" + PosShare ::= real + ChannelDist ::= ChannelPair (',' ChannelPair)* + ChannelPair ::= Channel_Code ':' ChannelShare + ChannelCode ::= "DF" | "DN" | "IF" | "IN" + ChannelShare ::= real + TripDist ::= TripPair (',' TripPair)* + TripPair ::= TripCode ':' TripShare + TripCode ::= "RO" | "RI" | "OW" + TripShare ::= real + StayDist ::= StayPair (',' StayPair)* + StayPair ::= [0;3]-digit-integer ':' stay_share + StayShare ::= real + FFDist ::= FF_Pair (',' FF_Pair)* + FFPair ::= FFCode ':' FFShare + FFCode ::= 'P' | 'G' | 'S' | 'M' | 'N' + FFShare ::= real + PrefDepTimeDist ::= PrefDepTi... [truncated message content] |
From: <den...@us...> - 2010-11-01 10:54:54
|
Revision: 17 http://simfqt.svn.sourceforge.net/simfqt/?rev=17&view=rev Author: denis_arnaud Date: 2010-11-01 10:54:47 +0000 (Mon, 01 Nov 2010) Log Message: ----------- [Dev] Fixed typo in the header protection definition. Modified Paths: -------------- trunk/simfqt/simfqt/command/FareQuoter.hpp Modified: trunk/simfqt/simfqt/command/FareQuoter.hpp =================================================================== --- trunk/simfqt/simfqt/command/FareQuoter.hpp 2010-11-01 10:03:05 UTC (rev 16) +++ trunk/simfqt/simfqt/command/FareQuoter.hpp 2010-11-01 10:54:47 UTC (rev 17) @@ -1,5 +1,5 @@ -#ifndef __SIMFQT_CMD_INDEXBUILDER_HPP -#define __SIMFQT_CMD_INDEXBUILDER_HPP +#ifndef __SIMFQT_CMD_FAREQUOTER_HPP +#define __SIMFQT_CMD_FAREQUOTER_HPP // ////////////////////////////////////////////////////////////////////// // Import section @@ -27,4 +27,4 @@ }; } -#endif // __SIMFQT_CMD_INDEXBUILDER_HPP +#endif // __SIMFQT_CMD_FAREQUOTER_HPP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-11-01 10:03:11
|
Revision: 16 http://simfqt.svn.sourceforge.net/simfqt/?rev=16&view=rev Author: denis_arnaud Date: 2010-11-01 10:03:05 +0000 (Mon, 01 Nov 2010) Log Message: ----------- [Packaging] The RPM specification file is no longer generated. Added Paths: ----------- trunk/simfqt/simfqt.spec Removed Paths: ------------- trunk/simfqt/simfqt.spec.in Property Changed: ---------------- trunk/simfqt/ Property changes on: trunk/simfqt ___________________________________________________________________ Modified: svn:ignore - autom4te.cache configure config.status config.log libtool aclocal.m4 Makefile.in Makefile INSTALL COPYING simfqt-config simfqt.spec simfqt.m4 simfqt.pc simfqt-html-doc-*.tar.* simfqt-*.tar.* + autom4te.cache configure config.status config.log libtool aclocal.m4 Makefile.in Makefile INSTALL COPYING simfqt-config simfqt.m4 simfqt.pc simfqt-html-doc-*.tar.* simfqt-*.tar.* Copied: trunk/simfqt/simfqt.spec (from rev 15, trunk/simfqt/simfqt.spec.in) =================================================================== --- trunk/simfqt/simfqt.spec (rev 0) +++ trunk/simfqt/simfqt.spec 2010-11-01 10:03:05 UTC (rev 16) @@ -0,0 +1,144 @@ +# +%define mydocs __tmp_docdir +# +Name: simfqt +Version: 99.99.99 +Release: 1%{?dist} + +Summary: C++ library providing a clean API for parsing travel-focused requests + +Group: System Environment/Libraries +License: LGPLv2 +URL: http://%{name}.sourceforge.net +Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: boost-devel >= 1.34 +BuildRequires: mysql-devel >= 5.0 +BuildRequires: cppunit-devel >= 1.10 +BuildRequires: soci-devel >= 3.0 +#Requires: + +%description +That project aims at providing a clean API, and the corresponding C++ +implementation, for parsing travel-focused requests (e.g., "washington +dc beijing monday a/r +aa -ua 1 week 2 adults 1 dog"). + +The C++ library uses Xapian (http://www.xapian.org) for the +Information Retrieval part, on freely available travel-related data +(e.g., country names and codes, city names and codes, airline names +and codes, etc.). + +The C++ library exposes a simple, clean and object-oriented, API. For +instance, the static Parse() method takes, as input, a string +containing the travel request, and yields, as output, the list of the +recognised terms as well as their corresponding types. As an example, +the travel request "washington dc beijing monday a/r +aa -ua 1 week 2 +adults 1 dog" would give the following list: + * Origin airport: Washington, DC, USA + * Destination airport: Beijing, China + * Date of travel: next Monday + * Date of return: 1 week after next Monday + * Preferred airline: American Airlines; + non-preferred airline: United Airlines + * Number of travellers: 2 adults and a dog + +The output can then be used by other systems, for instance to book the +corresponding travel or to visualise it on a map and calendar and to +share it with others. + +%package devel +Summary: Header files, libraries and development documentation for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig +Requires(post): info +Requires(preun): info + +%description devel +This package contains the header files, static libraries and +development documentation for %{name}. If you would like to develop +programs using %{name}, you will need to install %{name}-devel. + +%package doc +Summary: HTML documentation for the SIMFQT library +Group: Documentation +BuildArch: noarch +BuildRequires: doxygen, texlive-latex, texlive-dvips, ghostscript + +%description doc +This package contains the documentation in the HTML format of the SIMFQT +library. The documentation is the same as at the SIMFQT web page. + + +%prep +%setup -q +# find ./doc -type f -perm 755 -exec chmod 644 {} \; +# Fix some permissions and formats +rm -f INSTALL +chmod -x ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README +find . -type f -name '*.[hc]pp' -exec chmod 644 {} \; + + +%build +%configure --disable-static +make %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT +%find_lang %{name} +# remove unpackaged files from the buildroot +rm -f $RPM_BUILD_ROOT%{_includedir}/%{name}/config.h +rm -f $RPM_BUILD_ROOT%{_infodir}/dir +rm -f $RPM_BUILD_ROOT%{_libdir}/lib%{name}.la +# chmod 644 doc/html/installdox doc/html/*.png doc/html/*.ico +rm -rf %{mydocs} && mkdir -p %{mydocs} +mv $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html %{mydocs} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%post devel +/sbin/install-info %{_infodir}/%{name}-ref.info.* %{_infodir}/dir || : + +%preun devel +if [ "$1" = 0 ]; then + /sbin/install-info --delete %{_infodir}/%{name}-ref.info.* %{_infodir}/dir || : +fi + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING NEWS README +%{_bindir}/%{name}_indexer +%{_bindir}/%{name}_searcher +%{_libdir}/lib*.so.* +%{_mandir}/man3/%{name}.3.* + +%files devel +%defattr(-,root,root,-) +%{_includedir}/%{name} +%{_bindir}/%{name}-config +%{_libdir}/lib%{name}.so +%{_libdir}/pkgconfig/%{name}.pc +%{_datadir}/aclocal/%{name}.m4 +%{_infodir}/%{name}-ref.info.* +%{_mandir}/man1/%{name}-config.1.* + +%files doc +%defattr(-,root,root,-) +%doc %{mydocs}/html +%doc AUTHORS ChangeLog COPYING NEWS README + + +%changelog +* Sun Mar 29 2009 Denis Arnaud <den...@m4...> 0.3.0-1 +- Now relies on the new SOCI RPM + +* Sun Mar 22 2009 Denis Arnaud <den...@m4...> 0.2.0-1 +- RPM release for Fedora 10 + Deleted: trunk/simfqt/simfqt.spec.in =================================================================== --- trunk/simfqt/simfqt.spec.in 2010-10-13 13:31:19 UTC (rev 15) +++ trunk/simfqt/simfqt.spec.in 2010-11-01 10:03:05 UTC (rev 16) @@ -1,147 +0,0 @@ -# -%define mydocs __tmp_docdir -# -Name: @PACKAGE@ -Version: @VERSION@ -Release: @RPM_RELEASE@%{?dist} - -Summary: C++ library providing a clean API for parsing travel-focused requests - -Group: System Environment/Libraries -License: LGPLv2 -URL: http://%{name}.sourceforge.net -Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: gsl-devel >= 1.8 -BuildRequires: boost-devel >= 1.34 -BuildRequires: mysql-devel >= 5.0 -BuildRequires: mysql++-devel >= 3.0 -BuildRequires: cppunit-devel >= 1.10 -BuildRequires: xapian-core-devel >= 1.0 -BuildRequires: soci-devel >= 3.0 -#Requires: - -%description -That project aims at providing a clean API, and the corresponding C++ -implementation, for parsing travel-focused requests (e.g., "washington -dc beijing monday a/r +aa -ua 1 week 2 adults 1 dog"). - -The C++ library uses Xapian (http://www.xapian.org) for the -Information Retrieval part, on freely available travel-related data -(e.g., country names and codes, city names and codes, airline names -and codes, etc.). - -The C++ library exposes a simple, clean and object-oriented, API. For -instance, the static Parse() method takes, as input, a string -containing the travel request, and yields, as output, the list of the -recognised terms as well as their corresponding types. As an example, -the travel request "washington dc beijing monday a/r +aa -ua 1 week 2 -adults 1 dog" would give the following list: - * Origin airport: Washington, DC, USA - * Destination airport: Beijing, China - * Date of travel: next Monday - * Date of return: 1 week after next Monday - * Preferred airline: American Airlines; - non-preferred airline: United Airlines - * Number of travellers: 2 adults and a dog - -The output can then be used by other systems, for instance to book the -corresponding travel or to visualise it on a map and calendar and to -share it with others. - -%package devel -Summary: Header files, libraries and development documentation for %{name} -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} -Requires: pkgconfig -Requires(post): info -Requires(preun): info - -%description devel -This package contains the header files, static libraries and -development documentation for %{name}. If you would like to develop -programs using %{name}, you will need to install %{name}-devel. - -%package doc -Summary: HTML documentation for the @PACKAGE_NAME@ library -Group: Documentation -BuildArch: noarch -BuildRequires: doxygen, texlive-latex, texlive-dvips, ghostscript - -%description doc -This package contains the documentation in the HTML format of the @PACKAGE_NAME@ -library. The documentation is the same as at the @PACKAGE_NAME@ web page. - - -%prep -%setup -q -# find ./doc -type f -perm 755 -exec chmod 644 {} \; -# Fix some permissions and formats -rm -f INSTALL -chmod -x ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README -find . -type f -name '*.[hc]pp' -exec chmod 644 {} \; - - -%build -%configure --disable-static -make %{?_smp_mflags} - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT -%find_lang %{name} -# remove unpackaged files from the buildroot -rm -f $RPM_BUILD_ROOT%{_includedir}/%{name}/config.h -rm -f $RPM_BUILD_ROOT%{_infodir}/dir -rm -f $RPM_BUILD_ROOT%{_libdir}/lib%{name}.la -# chmod 644 doc/html/installdox doc/html/*.png doc/html/*.ico -rm -rf %{mydocs} && mkdir -p %{mydocs} -mv $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html %{mydocs} - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%post devel -/sbin/install-info %{_infodir}/%{name}-ref.info.* %{_infodir}/dir || : - -%preun devel -if [ "$1" = 0 ]; then - /sbin/install-info --delete %{_infodir}/%{name}-ref.info.* %{_infodir}/dir || : -fi - -%files -f %{name}.lang -%defattr(-,root,root,-) -%doc AUTHORS ChangeLog COPYING NEWS README -%{_bindir}/%{name}_indexer -%{_bindir}/%{name}_searcher -%{_libdir}/lib*.so.* -%{_mandir}/man3/%{name}.3.* - -%files devel -%defattr(-,root,root,-) -%{_includedir}/%{name} -%{_bindir}/%{name}-config -%{_libdir}/lib%{name}.so -%{_libdir}/pkgconfig/%{name}.pc -%{_datadir}/aclocal/%{name}.m4 -%{_infodir}/%{name}-ref.info.* -%{_mandir}/man1/%{name}-config.1.* - -%files doc -%defattr(-,root,root,-) -%doc %{mydocs}/html -%doc AUTHORS ChangeLog COPYING NEWS README - - -%changelog -* Sun Mar 29 2009 Denis Arnaud <den...@m4...> 0.3.0-1 -- Now relies on the new SOCI RPM - -* Sun Mar 22 2009 Denis Arnaud <den...@m4...> 0.2.0-1 -- RPM release for Fedora 10 - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2010-10-13 13:31:25
|
Revision: 15 http://simfqt.svn.sourceforge.net/simfqt/?rev=15&view=rev Author: quannaus Date: 2010-10-13 13:31:19 +0000 (Wed, 13 Oct 2010) Log Message: ----------- [dev] Added input file. Modified Paths: -------------- trunk/simfqt/simfqt/SIMFQT_Service.hpp trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.cpp trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.hpp trunk/simfqt/simfqt/service/SIMFQT_Service.cpp trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.cpp trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp Modified: trunk/simfqt/simfqt/SIMFQT_Service.hpp =================================================================== --- trunk/simfqt/simfqt/SIMFQT_Service.hpp 2010-09-07 09:57:32 UTC (rev 14) +++ trunk/simfqt/simfqt/SIMFQT_Service.hpp 2010-10-13 13:31:19 UTC (rev 15) @@ -6,10 +6,17 @@ // ////////////////////////////////////////////////////////////////////// // StdAir #include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/BasLogParams.hpp> // SimFQT #include <simfqt/SIMFQT_Types.hpp> +// Forward declarations. +namespace stdair { + class STDAIR_Service; + struct BasLogParams; + struct BasDBParams; +} + + namespace SIMFQT { // Forward declaration @@ -24,15 +31,30 @@ Price_T priceQuote (const AirlineCode_T&, const PartySize_T&); - // ////////// Constructors and destructors ////////// + // ////////////////// Constructors and Destructors ////////////////// /** Constructor. <br>The init() method is called; see the corresponding documentation for more details. + <br>A reference on an output stream is given, so that log + outputs can be directed onto that stream. + <br>Moreover, database connection parameters are given, so that a + session can be created on the corresponding database. + @param const stdair::BasLogParams& Parameters for the output log stream. + @param const stdair::BasDBParams& Parameters for the database access. + @param const stdair::Filename_T& Filename of the input fare file. */ + SIMFQT_Service (const stdair::BasLogParams&, const stdair::BasDBParams&, + const stdair::Filename_T& iFareInputFilename); + + /** Constructor. + <br>The init() method is called; see the corresponding documentation + for more details. <br>Moreover, a reference on an output stream is given, so that log outputs can be directed onto that stream. @param const stdair::BasLogParams& Parameters for the output log stream. - @param FareQuoteID_T& ID of the Fare Quote system. */ - SIMFQT_Service (const stdair::BasLogParams&, const FareQuoteID_T&); + @param const stdair::Date_T& Date for the beginning of analysis. + @param const stdair::Filename_T& Filename of the input fare file. */ + SIMFQT_Service (const stdair::BasLogParams&, + const stdair::Filename_T& iFareInputFilename); /** Constructor. <br>The init() method is called; see the corresponding documentation @@ -40,11 +62,13 @@ <br>Moreover, as no reference on any output stream is given, it is assumed that the StdAir log service has already been initialised with the proper log output stream by some other - methods in the calling chain (for instance, when the AIRINV_Service + methods in the calling chain (for instance, when the SIMFQT_Service is itself being initialised by another library service such as SIMCRS_Service). - @param FareQuoteID_T& ID of the Fare Quote system. */ - SIMFQT_Service (const FareQuoteID_T&); + @param const stdair::Date_T& Date for the beginning of analysis. + @param const stdair::Filename_T& Filename of the input fare file. */ + SIMFQT_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr, + const stdair::Filename_T& iFareInputFilename); /** Destructor. */ ~SIMFQT_Service(); @@ -57,12 +81,31 @@ /** Default copy constructor. */ SIMFQT_Service (const SIMFQT_Service&); - /** Initialise the log. */ - void logInit (const stdair::BasLogParams&); + /** Initialise the (SIMFQT) service context (i.e., the + SIMFQT_ServiceContext object). */ + void initServiceContext (); + + /** Initialise the STDAIR service (including the log service). + <br>A reference on the root of the BOM tree, namely the BomRoot object, + is stored within the service context for later use. + @param const stdair::BasLogParams& Parameters for the output log stream. + @param const stdair::BasDBParams& Parameters for the database access. */ + void initStdAirService (const stdair::BasLogParams&, + const stdair::BasDBParams&); + + /** Initialise the STDAIR service (including the log service). + <br>A reference on the root of the BOM tree, namely the BomRoot object, + is stored within the service context for later use. + @param const stdair::BasLogParams& Parameters for the output log + stream. */ + void initStdAirService (const stdair::BasLogParams&); + /** Initialise. - @param const FareQuoteID_T& ID of the owner of the FareQuote system. */ - void init (const FareQuoteID_T&); + <br>The CSV file, describing the airline fares for the + simulator, is parsed and the inventories are generated accordingly. + @param const stdair::Filename_T& Filename of the input fare file. */ + void init (const stdair::Filename_T& iFareInputFilename); /** Finalise. */ void finalise (); Modified: trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.cpp =================================================================== --- trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.cpp 2010-09-07 09:57:32 UTC (rev 14) +++ trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.cpp 2010-10-13 13:31:19 UTC (rev 15) @@ -30,12 +30,11 @@ } // ////////////////////////////////////////////////////////////////////// - SIMFQT_ServiceContext& FacSimfqtServiceContext:: - create (const std::string& iTravelDatabaseName) { + SIMFQT_ServiceContext& FacSimfqtServiceContext::create () { SIMFQT_ServiceContext* aSIMFQT_ServiceContext_ptr = NULL; aSIMFQT_ServiceContext_ptr = - new SIMFQT_ServiceContext (iTravelDatabaseName); + new SIMFQT_ServiceContext (); assert (aSIMFQT_ServiceContext_ptr != NULL); // The new object is added to the Bom pool Modified: trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.hpp =================================================================== --- trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.hpp 2010-09-07 09:57:32 UTC (rev 14) +++ trunk/simfqt/simfqt/factory/FacSimfqtServiceContext.hpp 2010-10-13 13:31:19 UTC (rev 15) @@ -32,7 +32,7 @@ /** Create a new SIMFQT_ServiceContext object. <br>This new object is added to the list of instantiated objects. @return SIMFQT_ServiceContext& The newly created object. */ - SIMFQT_ServiceContext& create (const std::string& iTravelDatabaseName); + SIMFQT_ServiceContext& create (); protected: Modified: trunk/simfqt/simfqt/service/SIMFQT_Service.cpp =================================================================== --- trunk/simfqt/simfqt/service/SIMFQT_Service.cpp 2010-09-07 09:57:32 UTC (rev 14) +++ trunk/simfqt/simfqt/service/SIMFQT_Service.cpp 2010-10-13 13:31:19 UTC (rev 15) @@ -3,10 +3,14 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <cassert> +// Boost +#include <boost/make_shared.hpp> // StdAir #include <stdair/basic/BasChronometer.hpp> -#include <stdair/bom/BomManager.hpp> // for display() +#include <stdair/basic/BasFileMgr.hpp> +#include <stdair/bom/BomManager.hpp> #include <stdair/service/Logger.hpp> +#include <stdair/STDAIR_Service.hpp> // Simfqt #include <simfqt/basic/BasConst_SIMFQT_Service.hpp> #include <simfqt/command/FareQuoter.hpp> @@ -27,50 +31,147 @@ assert (false); } - // ////////////////////////////////////////////////////////////////////// - SIMFQT_Service::SIMFQT_Service (const FareQuoteID_T& iFareQuoteID) + // //////////////////////////////////////////////////////////////////// + SIMFQT_Service:: + SIMFQT_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr, + const stdair::Filename_T& iFareInputFilename) : _simfqtServiceContext (NULL) { + // Initialise the service context + initServiceContext (); + + // Retrieve the Simfqt service context + assert (_simfqtServiceContext != NULL); + SIMFQT_ServiceContext& lSIMFQT_ServiceContext = + *_simfqtServiceContext; + + // Store the STDAIR service object within the (SIMFQT) service context + lSIMFQT_ServiceContext.setSTDAIR_Service (ioSTDAIR_ServicePtr); + // Initialise the context - init (iFareQuoteID); + init (iFareInputFilename); } - // ////////////////////////////////////////////////////////////////////// - SIMFQT_Service::SIMFQT_Service (const stdair::BasLogParams& iLogParams, - const FareQuoteID_T& iFareQuoteID) + // //////////////////////////////////////////////////////////////////// + SIMFQT_Service:: + SIMFQT_Service (const stdair::BasLogParams& iLogParams, + const stdair::BasDBParams& iDBParams, + const stdair::Filename_T& iFareInputFilename) : _simfqtServiceContext (NULL) { - // Set the log file - logInit (iLogParams); + // Initialise the service context + initServiceContext (); + + // Initialise the STDAIR service handler + initStdAirService (iLogParams, iDBParams); + + // Initialise the (remaining of the) context + init (iFareInputFilename); + } + // //////////////////////////////////////////////////////////////////// + SIMFQT_Service:: + SIMFQT_Service (const stdair::BasLogParams& iLogParams, + const stdair::Filename_T& iFareInputFilename) + : _simfqtServiceContext (NULL) { + + // Initialise the service context + initServiceContext (); + + // Initialise the STDAIR service handler + initStdAirService (iLogParams); + // Initialise the (remaining of the) context - init (iFareQuoteID); + init (iFareInputFilename); } + // ////////////////////////////////////////////////////////////////////// SIMFQT_Service::~SIMFQT_Service () { // Delete/Clean all the objects from memory finalise(); } - + // ////////////////////////////////////////////////////////////////////// - void SIMFQT_Service::logInit (const stdair::BasLogParams& iLogParams) { - stdair::Logger::init (iLogParams); + void SIMFQT_Service::finalise () { + assert (_simfqtServiceContext != NULL); } // ////////////////////////////////////////////////////////////////////// - void SIMFQT_Service::init (const FareQuoteID_T& iFareQuoteID) { - // Initialise the context + void SIMFQT_Service::initServiceContext () { + // Initialise the service context SIMFQT_ServiceContext& lSIMFQT_ServiceContext = - FacSimfqtServiceContext::instance().create (iFareQuoteID); + FacSimfqtServiceContext::instance().create (); _simfqtServiceContext = &lSIMFQT_ServiceContext; } + + // ////////////////////////////////////////////////////////////////////// + void SIMFQT_Service:: + initStdAirService (const stdair::BasLogParams& iLogParams, + const stdair::BasDBParams& iDBParams) { + + // Retrieve the Simfqt service context + assert (_simfqtServiceContext != NULL); + SIMFQT_ServiceContext& lSIMFQT_ServiceContext = + *_simfqtServiceContext; + + // Initialise the STDAIR service handler + // Note that the track on the object memory is kept thanks to the Boost + // Smart Pointers component. + stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = + boost::make_shared<stdair::STDAIR_Service> (iLogParams, iDBParams); + + // Store the STDAIR service object within the (SIMFQT) service context + lSIMFQT_ServiceContext.setSTDAIR_Service (lSTDAIR_Service_ptr); + } // ////////////////////////////////////////////////////////////////////// - void SIMFQT_Service::finalise () { + void SIMFQT_Service:: + initStdAirService (const stdair::BasLogParams& iLogParams) { + + // Retrieve the Simfqt service context assert (_simfqtServiceContext != NULL); + SIMFQT_ServiceContext& lSIMFQT_ServiceContext = + *_simfqtServiceContext; + + // Initialise the STDAIR service handler + // Note that the track on the object memory is kept thanks to the Boost + // Smart Pointers component. + stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = + boost::make_shared<stdair::STDAIR_Service> (iLogParams); + + // Store the STDAIR service object within the (SIMFQT) service context + lSIMFQT_ServiceContext.setSTDAIR_Service (lSTDAIR_Service_ptr); } + + // //////////////////////////////////////////////////////////////////// + void SIMFQT_Service:: + init (const stdair::Filename_T& iFareInputFilename) { + // Check that the file path given as input corresponds to an actual file + const bool doesExistAndIsReadable = + stdair::BasFileMgr::doesExistAndIsReadable (iFareInputFilename); + if (doesExistAndIsReadable == false) { + STDAIR_LOG_ERROR ("The fare input file, '" << iFareInputFilename + << "', can not be retrieved on the file-system"); + throw stdair::FileNotFoundException(); + } + + // Retrieve the Simfqt service context + assert (_simfqtServiceContext != NULL); + SIMFQT_ServiceContext& lSIMFQT_ServiceContext = + *_simfqtServiceContext; + + // Retrieve the StdAir service context + stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = + lSIMFQT_ServiceContext.getSTDAIR_Service(); + assert (lSTDAIR_Service_ptr != NULL); + + // Get the root of the BOM tree, on which all of the other BOM objects + // will be attached + stdair::BomRoot& lBomRoot = lSTDAIR_Service_ptr->getBomRoot(); + } + // ////////////////////////////////////////////////////////////////////// Price_T SIMFQT_Service::priceQuote (const AirlineCode_T& iAirlineCode, const PartySize_T& iPartySize) { @@ -84,19 +185,15 @@ try { - // Retrieve the Fare Quote system ID - const FareQuoteID_T& lFareQuoteID = - lSIMFQT_ServiceContext.getFareQuoteID(); - // Delegate the price quotation to the dedicated command stdair::BasChronometer lPriceQuotingChronometer; lPriceQuotingChronometer.start(); - oPrice = FareQuoter::priceQuote (lFareQuoteID, iAirlineCode, iPartySize); - const double lPriceQuotingMeasure = lPriceQuotingChronometer.elapsed(); + // oPrice = FareQuoter::priceQuote (iAirlineCode, iPartySize); + // const double lPriceQuotingMeasure = lPriceQuotingChronometer.elapsed(); - // DEBUG - STDAIR_LOG_DEBUG ("Price quoting: " << lPriceQuotingMeasure << " - " - << lSIMFQT_ServiceContext.display()); + // // DEBUG + // STDAIR_LOG_DEBUG ("Price quoting: " << lPriceQuotingMeasure << " - " + // << lSIMFQT_ServiceContext.display()); } catch (const std::exception& error) { STDAIR_LOG_ERROR ("Exception: " << error.what()); Modified: trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.cpp =================================================================== --- trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.cpp 2010-09-07 09:57:32 UTC (rev 14) +++ trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.cpp 2010-10-13 13:31:19 UTC (rev 15) @@ -10,16 +10,15 @@ #include <simfqt/service/SIMFQT_ServiceContext.hpp> namespace SIMFQT { - + // ////////////////////////////////////////////////////////////////////// - SIMFQT_ServiceContext::SIMFQT_ServiceContext () - : _fareQuoteID (DEFAULT_FARE_QUOTER_ID) { + SIMFQT_ServiceContext:: + SIMFQT_ServiceContext (const SIMFQT_ServiceContext&) { + assert (false); } // ////////////////////////////////////////////////////////////////////// - SIMFQT_ServiceContext:: - SIMFQT_ServiceContext (const FareQuoteID_T& iFareQuoteID) - : _fareQuoteID (iFareQuoteID) { + SIMFQT_ServiceContext::SIMFQT_ServiceContext () { } // ////////////////////////////////////////////////////////////////////// @@ -29,9 +28,7 @@ // ////////////////////////////////////////////////////////////////////// const std::string SIMFQT_ServiceContext::shortDisplay() const { std::ostringstream oStr; - oStr << "SIMFQT_ServiceContext: " << std::endl - << "Fare Quote system ID: " << _fareQuoteID - << std::endl; + oStr << "SIMFQT_ServiceContext: " << std::endl; return oStr.str(); } Modified: trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp =================================================================== --- trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp 2010-09-07 09:57:32 UTC (rev 14) +++ trunk/simfqt/simfqt/service/SIMFQT_ServiceContext.hpp 2010-10-13 13:31:19 UTC (rev 15) @@ -6,6 +6,8 @@ // ////////////////////////////////////////////////////////////////////// // STL #include <string> +// STDAIR +#include <stdair/STDAIR_Types.hpp> // Simfqt #include <simfqt/SIMFQT_Types.hpp> #include <simfqt/service/ServiceAbstract.hpp> @@ -17,26 +19,23 @@ friend class FacSimfqtServiceContext; public: // ///////// Getters ////////// - /** Get the Fare Quote system ID. */ - const FareQuoteID_T& getFareQuoteID () const { - return _fareQuoteID; + /** Get the pointer on the STDAIR service handler. */ + stdair::STDAIR_ServicePtr_T getSTDAIR_Service () const { + return _stdairService; } + + // ///////////////// Setters /////////////////// + /** Set the pointer on the STDAIR service handler. */ + void setSTDAIR_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr) { + _stdairService = ioSTDAIR_ServicePtr; + } - - // ///////// Setters ////////// - /** Set the Fare Quote system ID. */ - void setAirlineCode (const FareQuoteID_T& iFareQuoteID) { - _fareQuoteID = iFareQuoteID; - } - - // ///////// Display Methods ////////// /** Display the short SIMFQT_ServiceContext content. */ const std::string shortDisplay() const; /** Display the full SIMFQT_ServiceContext content. */ const std::string display() const; - private: // /////// Construction / initialisation //////// @@ -50,8 +49,8 @@ private: // //////////// Attributes ////////////////// - /** Fare Quote system ID. */ - FareQuoteID_T _fareQuoteID; + /** Standard Airline (StdAir) Service Handler. */ + stdair::STDAIR_ServicePtr_T _stdairService; }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-09-07 09:57:45
|
Revision: 14 http://simfqt.svn.sourceforge.net/simfqt/?rev=14&view=rev Author: denis_arnaud Date: 2010-09-07 09:57:32 +0000 (Tue, 07 Sep 2010) Log Message: ----------- [Build] The StdAir and ExtraCC projects are no longer Subversion external references. Modified Paths: -------------- trunk/simfqt/Makefile.am trunk/simfqt/configure.ac trunk/simfqt/simfqt/Makefile.am trunk/simfqt/simfqt/basic/Makefile.am trunk/simfqt/simfqt/basic/sources.mk trunk/simfqt/simfqt/batches/Makefile.am trunk/simfqt/simfqt/bom/Makefile.am trunk/simfqt/simfqt/bom/sources.mk trunk/simfqt/simfqt/command/Makefile.am trunk/simfqt/simfqt/command/sources.mk trunk/simfqt/simfqt/core/Makefile.am trunk/simfqt/simfqt/core/sources.mk trunk/simfqt/simfqt/factory/Makefile.am trunk/simfqt/simfqt/factory/sources.mk trunk/simfqt/simfqt/service/Makefile.am trunk/simfqt/simfqt/service/sources.mk trunk/simfqt/test/Makefile.am trunk/simfqt/test/simfqt/Makefile.am Property Changed: ---------------- trunk/simfqt/ trunk/simfqt/test/ Property changes on: trunk/simfqt ___________________________________________________________________ Modified: svn:externals - config https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair extracppunit https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit + config https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config Modified: trunk/simfqt/Makefile.am =================================================================== --- trunk/simfqt/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -21,10 +21,16 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure \ config-h.in sic/stamp-h.in autogen.sh bootstrap -EXTRA_DIST = @PACKAGE@.spec @PACKAGE@.m4 @PACKAGE@.pc Makefile.common +# Note 1: the RPM specification file (@PACKAGE@.spec) must not be distributed +# with the rest of the source code. The tar-ball will be used by the packaging +# process, from an external RPM specification file: duplicating it in the +# tar-ball may only confuse things. +# Note 2: Both @PACKAGE@.m4 and @PACKAGE@.pc must not be distributed, as they +# will be generated by the configure script. +EXTRA_DIST = # Build in these directories: -SUBDIRS = stdair @PACKAGE@ extracppunit $(TEST_DIR) +SUBDIRS = simfqt $(TEST_DIR) # Configuration helpers Modified: trunk/simfqt/configure.ac =================================================================== --- trunk/simfqt/configure.ac 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/configure.ac 2010-09-07 09:57:32 UTC (rev 14) @@ -10,10 +10,6 @@ AM_PATH_CPPUNIT(1.10) AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) -# RPM release number -RPM_RELEASE="1" -AC_SUBST(RPM_RELEASE) - # Shared library versioning GENERIC_LIBRARY_VERSION="99:99:99" # | | | @@ -105,14 +101,10 @@ # ----------------------------------------------------------------------------- # Support for ExtraCC (Extra-CruiseControl): http://sf.net/projects/extracc # ----------------------------------------------------------------------------- -# Note: the ExtraCC is now imported as a Subversion external reference, -# thus directly accessible within the extracppunit directory. -# When that library will be widely avaible on Linux distributions, -# the external reference can be removed and the following line uncommented. -#AM_PATH_EXTRACC -#AC_SUBST(EXTRACC_VERSION) -#AC_SUBST(EXTRACC_CFLAGS) -#AC_SUBST(EXTRACC_LIBS) +AM_PATH_EXTRACC +AC_SUBST(EXTRACC_VERSION) +AC_SUBST(EXTRACC_CFLAGS) +AC_SUBST(EXTRACC_LIBS) # ----------------------------------------------------------- # Python: http://www.python.org @@ -172,7 +164,15 @@ AC_SUBST(SOCI_CFLAGS) AC_SUBST(SOCI_LIBS) +# ----------------------------------------------------------------------------- +# Support for StdAir (): http://sf.net/projects/stdair +# ----------------------------------------------------------------------------- +AM_PATH_STDAIR +AC_SUBST(STDAIR_VERSION) +AC_SUBST(STDAIR_CFLAGS) +AC_SUBST(STDAIR_LIBS) + # ------------------------------------------------------------------- # Support for documentation # ------------------------------------------------------------------- @@ -244,18 +244,7 @@ Makefile simfqt-config simfqt.pc - simfqt.spec simfqt.m4 - stdair/Makefile - stdair/basic/Makefile - stdair/bom/Makefile - stdair/dbadaptor/Makefile - stdair/factory/Makefile - stdair/command/Makefile - stdair/config/Makefile - stdair/service/Makefile - stdair/core/Makefile - stdair/batches/Makefile simfqt/Makefile simfqt/basic/Makefile simfqt/bom/Makefile @@ -265,10 +254,8 @@ simfqt/config/Makefile simfqt/core/Makefile simfqt/batches/Makefile - extracppunit/Makefile test/Makefile test/samples/Makefile - test/stdair/Makefile test/simfqt/Makefile ) AC_OUTPUT @@ -343,6 +330,11 @@ o SOCI_CFLAGS ..... : ${SOCI_CFLAGS} o SOCI_LIBS ....... : ${SOCI_LIBS} + - StdAir ............ : + o STDAIR_VERSION .. : ${STDAIR_VERSION} + o STDAIR_CFLAGS ... : ${STDAIR_CFLAGS} + o STDAIR_LIBS ..... : ${STDAIR_LIBS} + - ExtraCC ........... : o EXTRACC_VERSION . : ${EXTRACC_VERSION} o EXTRACC_CFLAGS .. : ${EXTRACC_CFLAGS} Modified: trunk/simfqt/simfqt/Makefile.am =================================================================== --- trunk/simfqt/simfqt/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -12,5 +12,5 @@ # Header files -nobase_pkginclude_HEADERS = $(service_h_sources) +nobase_pkginclude_HEADERS = $(simfqt_service_h_sources) #nobase_nodist_pkginclude_HEADERS = $(top_builddir)/@PACKAGE@/config.h Modified: trunk/simfqt/simfqt/basic/Makefile.am =================================================================== --- trunk/simfqt/simfqt/basic/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/basic/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -1,11 +1,14 @@ -## basic sub-directory +## simfqt/basic sub-directory include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk -noinst_LTLIBRARIES= libbas.la +# +noinst_LTLIBRARIES = libsimfqtbas.la -libbas_la_SOURCES= $(bas_h_sources) $(bas_cc_sources) -libbas_la_CXXFLAGS = +libsimfqtbas_la_SOURCES = $(simfqt_bas_h_sources) $(simfqt_bas_cc_sources) +libsimfqtbas_la_CXXFLAGS = $(STDAIR_CFLAGS) +libsimfqtbas_la_LDFLAGS = +# #pkgincludedir = $(includedir)/@PACKAGE@/basic -#pkginclude_HEADERS = $(bas_h_sources) +#pkginclude_HEADERS = $(simfqt_bas_h_sources) Modified: trunk/simfqt/simfqt/basic/sources.mk =================================================================== --- trunk/simfqt/simfqt/basic/sources.mk 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/basic/sources.mk 2010-09-07 09:57:32 UTC (rev 14) @@ -1,3 +1,5 @@ -bas_h_sources = $(top_srcdir)/simfqt/basic/BasConst_General.hpp \ - $(top_srcdir)/simfqt/basic/BasConst_SIMFQT_Service.hpp -bas_cc_sources = $(top_srcdir)/simfqt/basic/BasConst.cpp +simfqt_bas_h_sources = \ + $(top_srcdir)/simfqt/basic/BasConst_General.hpp \ + $(top_srcdir)/simfqt/basic/BasConst_SIMFQT_Service.hpp +simfqt_bas_cc_sources = \ + $(top_srcdir)/simfqt/basic/BasConst.cpp Modified: trunk/simfqt/simfqt/batches/Makefile.am =================================================================== --- trunk/simfqt/simfqt/batches/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/batches/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -10,6 +10,6 @@ bin_PROGRAMS = #simfqt_SOURCES = $(batches_h_sources) $(batches_cc_sources) -#simfqt_CXXFLAGS = $(BOOST_CFLAGS) +#simfqt_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS) #simfqt_LDADD = -#simfqt_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(top_builddir)/simfqt/core/libsimfqt.la +#simfqt_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(STDAIR_LIBS) $(top_builddir)/simfqt/core/libsimfqt.la Modified: trunk/simfqt/simfqt/bom/Makefile.am =================================================================== --- trunk/simfqt/simfqt/bom/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/bom/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -1,12 +1,14 @@ -## bom sub-directory +## simfqt/bom sub-directory include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk -noinst_LTLIBRARIES= libbom.la +# +noinst_LTLIBRARIES = libsimfqtbom.la -libbom_la_SOURCES= $(bom_h_sources) $(bom_cc_sources) -libbom_la_CXXFLAGS = -libbom_la_LDFLAGS = +libsimfqtbom_la_SOURCES = $(simfqt_bom_h_sources) $(simfqt_bom_cc_sources) +libsimfqtbom_la_CXXFLAGS = +libsimfqtbom_la_LDFLAGS = +# #pkgincludedir = $(includedir)/@PACKAGE@/bom -#pkginclude_HEADERS = $(bom_h_sources) +#pkginclude_HEADERS = $(simfqt_bom_h_sources) Modified: trunk/simfqt/simfqt/bom/sources.mk =================================================================== --- trunk/simfqt/simfqt/bom/sources.mk 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/bom/sources.mk 2010-09-07 09:57:32 UTC (rev 14) @@ -1,2 +1,4 @@ -bom_h_sources = $(top_srcdir)/simfqt/bom/BomAbstract.hpp -bom_cc_sources = $(top_srcdir)/simfqt/bom/BomAbstract.cpp +simfqt_bom_h_sources = \ + $(top_srcdir)/simfqt/bom/BomAbstract.hpp +simfqt_bom_cc_sources = \ + $(top_srcdir)/simfqt/bom/BomAbstract.cpp Modified: trunk/simfqt/simfqt/command/Makefile.am =================================================================== --- trunk/simfqt/simfqt/command/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/command/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -1,13 +1,15 @@ -## command sub-directory +## simfqt/command sub-directory include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk -noinst_LTLIBRARIES= libcmd.la +# +noinst_LTLIBRARIES = libsimfqtcmd.la -libcmd_la_SOURCES= $(cmd_h_sources) $(cmd_cc_sources) -libcmd_la_CXXFLAGS = $(BOOST_CFLAGS) -libcmd_la_LIBADD = -libcmd_la_LDFLAGS = $(BOOST_LIBS) +libsimfqtcmd_la_SOURCES= $(simfqt_cmd_h_sources) $(simfqt_cmd_cc_sources) +libsimfqtcmd_la_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS) +libsimfqtcmd_la_LIBADD = +libsimfqtcmd_la_LDFLAGS = +# #pkgincludedir = $(includedir)/@PACKAGE@/command -#pkginclude_HEADERS = $(cmd_h_sources) +#pkginclude_HEADERS = $(simfqt_cmd_h_sources) Modified: trunk/simfqt/simfqt/command/sources.mk =================================================================== --- trunk/simfqt/simfqt/command/sources.mk 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/command/sources.mk 2010-09-07 09:57:32 UTC (rev 14) @@ -1,4 +1,4 @@ -cmd_h_sources = \ - $(top_srcdir)/simfqt/command/FareQuoter.hpp -cmd_cc_sources = \ - $(top_srcdir)/simfqt/command/FareQuoter.cpp +simfqt_cmd_h_sources = \ + $(top_srcdir)/simfqt/command/FareQuoter.hpp +simfqt_cmd_cc_sources = \ + $(top_srcdir)/simfqt/command/FareQuoter.cpp Modified: trunk/simfqt/simfqt/core/Makefile.am =================================================================== --- trunk/simfqt/simfqt/core/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/core/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -12,19 +12,17 @@ # Library lib_LTLIBRARIES = libsimfqt.la -libsimfqt_la_SOURCES = $(service_h_sources) $(service_cc_sources) +libsimfqt_la_SOURCES = $(simfqt_service_h_sources) $(simfqt_service_cc_sources) libsimfqt_la_LIBADD = \ - $(top_builddir)/simfqt/basic/libbas.la \ - $(top_builddir)/simfqt/bom/libbom.la \ - $(top_builddir)/simfqt/factory/libfac.la \ - $(top_builddir)/simfqt/command/libcmd.la \ - $(top_builddir)/simfqt/service/libsvc.la + $(top_builddir)/simfqt/basic/libsimfqtbas.la \ + $(top_builddir)/simfqt/bom/libsimfqtbom.la \ + $(top_builddir)/simfqt/factory/libsimfqtfac.la \ + $(top_builddir)/simfqt/command/libsimfqtcmd.la \ + $(top_builddir)/simfqt/service/libsimfqtsvc.la libsimfqt_la_LDFLAGS = \ - $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \ - $(top_builddir)/stdair/core/libstdair.la \ + $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(STDAIR_LIBS) \ -version-info $(GENERIC_LIBRARY_VERSION) # Header files -#pkginclude_HEADERS = $(service_h_sources) +#pkginclude_HEADERS = $(simfqt_service_h_sources) #nobase_nodist_pkginclude_HEADERS = $(top_builddir)/simfqt/config.h - Modified: trunk/simfqt/simfqt/core/sources.mk =================================================================== --- trunk/simfqt/simfqt/core/sources.mk 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/core/sources.mk 2010-09-07 09:57:32 UTC (rev 14) @@ -1,4 +1,4 @@ -service_h_sources = \ - $(top_srcdir)/simfqt/SIMFQT_Types.hpp \ - $(top_srcdir)/simfqt/SIMFQT_Service.hpp -service_cc_sources = +simfqt_service_h_sources = \ + $(top_srcdir)/simfqt/SIMFQT_Types.hpp \ + $(top_srcdir)/simfqt/SIMFQT_Service.hpp +simfqt_service_cc_sources = Modified: trunk/simfqt/simfqt/factory/Makefile.am =================================================================== --- trunk/simfqt/simfqt/factory/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/factory/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -1,11 +1,14 @@ -## factory sub-directory +## simfqt/factory sub-directory include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk -noinst_LTLIBRARIES= libfac.la +# +noinst_LTLIBRARIES = libsimfqtfac.la -libfac_la_SOURCES= $(fac_h_sources) $(fac_cc_sources) -libfac_la_CXXFLAGS = +libsimfqtfac_la_SOURCES= $(simfqt_fac_h_sources) $(simfqt_fac_cc_sources) +libsimfqtfac_la_CXXFLAGS = $(STDAIR_CFLAGS) +libsimfqtfac_la_LDFLAGS = +# #pkgincludedir = $(includedir)/@PACKAGE@/factory -#pkginclude_HEADERS = $(fac_h_sources) +#pkginclude_HEADERS = $(simfqt_fac_h_sources) Modified: trunk/simfqt/simfqt/factory/sources.mk =================================================================== --- trunk/simfqt/simfqt/factory/sources.mk 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/factory/sources.mk 2010-09-07 09:57:32 UTC (rev 14) @@ -1,10 +1,10 @@ -fac_h_sources = \ - $(top_srcdir)/simfqt/factory/FacBomAbstract.hpp \ - $(top_srcdir)/simfqt/factory/FacServiceAbstract.hpp \ - $(top_srcdir)/simfqt/factory/FacSupervisor.hpp \ - $(top_srcdir)/simfqt/factory/FacSimfqtServiceContext.hpp -fac_cc_sources = \ - $(top_srcdir)/simfqt/factory/FacBomAbstract.cpp \ - $(top_srcdir)/simfqt/factory/FacServiceAbstract.cpp \ - $(top_srcdir)/simfqt/factory/FacSupervisor.cpp \ - $(top_srcdir)/simfqt/factory/FacSimfqtServiceContext.cpp +simfqt_fac_h_sources = \ + $(top_srcdir)/simfqt/factory/FacBomAbstract.hpp \ + $(top_srcdir)/simfqt/factory/FacServiceAbstract.hpp \ + $(top_srcdir)/simfqt/factory/FacSupervisor.hpp \ + $(top_srcdir)/simfqt/factory/FacSimfqtServiceContext.hpp +simfqt_fac_cc_sources = \ + $(top_srcdir)/simfqt/factory/FacBomAbstract.cpp \ + $(top_srcdir)/simfqt/factory/FacServiceAbstract.cpp \ + $(top_srcdir)/simfqt/factory/FacSupervisor.cpp \ + $(top_srcdir)/simfqt/factory/FacSimfqtServiceContext.cpp Modified: trunk/simfqt/simfqt/service/Makefile.am =================================================================== --- trunk/simfqt/simfqt/service/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/service/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -1,11 +1,14 @@ -## command sub-directory +## simfqt/service sub-directory include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk -noinst_LTLIBRARIES= libsvc.la +# +noinst_LTLIBRARIES = libsimfqtsvc.la -libsvc_la_SOURCES= $(svc_h_sources) $(svc_cc_sources) -libsvc_la_CXXFLAGS = $(BOOST_CFLAGS) +libsimfqtsvc_la_SOURCES= $(simfqt_svc_h_sources) $(simfqt_svc_cc_sources) +libsimfqtsvc_la_CXXFLAGS = $(BOOST_CFLAGS) $(STDAIR_CFLAGS) +libsimfqtsvc_la_LDFLAGS = +# #pkgincludedir = $(includedir)/@PACKAGE@/service -#pkginclude_HEADERS = $(svc_h_sources) +#pkginclude_HEADERS = $(simfqt_svc_h_sources) Modified: trunk/simfqt/simfqt/service/sources.mk =================================================================== --- trunk/simfqt/simfqt/service/sources.mk 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/simfqt/service/sources.mk 2010-09-07 09:57:32 UTC (rev 14) @@ -1,5 +1,7 @@ -svc_h_sources = $(top_srcdir)/simfqt/service/ServiceAbstract.hpp \ - $(top_srcdir)/simfqt/service/SIMFQT_ServiceContext.hpp -svc_cc_sources = $(top_srcdir)/simfqt/service/ServiceAbstract.cpp \ - $(top_srcdir)/simfqt/service/SIMFQT_ServiceContext.cpp \ - $(top_srcdir)/simfqt/service/SIMFQT_Service.cpp +simfqt_svc_h_sources = \ + $(top_srcdir)/simfqt/service/ServiceAbstract.hpp \ + $(top_srcdir)/simfqt/service/SIMFQT_ServiceContext.hpp +simfqt_svc_cc_sources = \ + $(top_srcdir)/simfqt/service/ServiceAbstract.cpp \ + $(top_srcdir)/simfqt/service/SIMFQT_ServiceContext.cpp \ + $(top_srcdir)/simfqt/service/SIMFQT_Service.cpp Property changes on: trunk/simfqt/test ___________________________________________________________________ Modified: svn:externals - samples https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/samples stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/stdair + samples https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/samples Modified: trunk/simfqt/test/Makefile.am =================================================================== --- trunk/simfqt/test/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/test/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -1,10 +1,10 @@ -## test sub-directory +## test sub-directory of the SimFQT project include $(top_srcdir)/Makefile.common MAINTAINERCLEANFILES = Makefile.in ## -SUBDIRS = samples stdair simfqt +SUBDIRS = samples simfqt EXTRA_DIST = @@ -12,4 +12,3 @@ check_PROGRAMS = TESTS = $(check_PROGRAMS) XFAIL_TESTS = # - Modified: trunk/simfqt/test/simfqt/Makefile.am =================================================================== --- trunk/simfqt/test/simfqt/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) +++ trunk/simfqt/test/simfqt/Makefile.am 2010-09-07 09:57:32 UTC (rev 14) @@ -14,11 +14,8 @@ XFAIL_TESTS = # FQTTestSuite_SOURCES = FQTTestSuite.hpp FQTTestSuite.cpp -FQTTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) +FQTTestSuite_CXXFLAGS = $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) \ + $(EXTRACC_CFLAGS) $(STDAIR_CFLAGS) FQTTestSuite_LDADD = -FQTTestSuite_LDFLAGS = \ - $(BOOST_LIBS) $(CPPUNIT_LIBS) \ - $(top_builddir)/extracppunit/libextracppunit.la \ - $(top_builddir)/stdair/core/libstdair.la \ - $(top_builddir)/simfqt/core/libsimfqt.la - +FQTTestSuite_LDFLAGS = $(CPPUNIT_LIBS) $(EXTRACC_LIBS) $(STDAIR_LIBS) \ + $(top_builddir)/simfqt/core/libsimfqt.la This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-08-20 10:48:39
|
Revision: 13 http://simfqt.svn.sourceforge.net/simfqt/?rev=13&view=rev Author: denis_arnaud Date: 2010-08-20 10:48:33 +0000 (Fri, 20 Aug 2010) Log Message: ----------- [Build] Added a missing tab in the Makefile. Modified Paths: -------------- trunk/simfqt/Makefile.am Modified: trunk/simfqt/Makefile.am =================================================================== --- trunk/simfqt/Makefile.am 2010-06-13 20:24:43 UTC (rev 12) +++ trunk/simfqt/Makefile.am 2010-08-20 10:48:33 UTC (rev 13) @@ -50,7 +50,7 @@ snapshot-src: - $(MAKE) dist distdir=@PACKAGE_TARNAME@-`date +"%Y%m%d"` + $(MAKE) dist distdir=@PACKAGE_TARNAME@-`date +"%Y%m%d"` snapshot-html: $(MAKE) -C doc dist-html html_tarname=@PACKAGE_TARNAME@-html-doc-`date +"%Y%m%d"` @@ -71,3 +71,4 @@ upload-gui: dist-gui @UPLOAD_COMMAND@ @PACKAGE_TARNAME@-gui-@VERSION@.tar.gz \ @PACKAGE_TARNAME@-gui-@VERSION@.tar.bz2 + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-06-13 20:24:49
|
Revision: 12 http://simfqt.svn.sourceforge.net/simfqt/?rev=12&view=rev Author: denis_arnaud Date: 2010-06-13 20:24:43 +0000 (Sun, 13 Jun 2010) Log Message: ----------- [Test] Updated the dependency for the new ExtraCPPUnit library name. Modified Paths: -------------- trunk/simfqt/configure.ac trunk/simfqt/test/simfqt/Makefile.am Modified: trunk/simfqt/configure.ac =================================================================== --- trunk/simfqt/configure.ac 2010-04-06 14:46:49 UTC (rev 11) +++ trunk/simfqt/configure.ac 2010-06-13 20:24:43 UTC (rev 12) @@ -102,6 +102,17 @@ CXXFLAGS="-g -Wall" fi +# ----------------------------------------------------------------------------- +# Support for ExtraCC (Extra-CruiseControl): http://sf.net/projects/extracc +# ----------------------------------------------------------------------------- +# Note: the ExtraCC is now imported as a Subversion external reference, +# thus directly accessible within the extracppunit directory. +# When that library will be widely avaible on Linux distributions, +# the external reference can be removed and the following line uncommented. +#AM_PATH_EXTRACC +#AC_SUBST(EXTRACC_VERSION) +#AC_SUBST(EXTRACC_CFLAGS) +#AC_SUBST(EXTRACC_LIBS) # ----------------------------------------------------------- # Python: http://www.python.org @@ -332,6 +343,11 @@ o SOCI_CFLAGS ..... : ${SOCI_CFLAGS} o SOCI_LIBS ....... : ${SOCI_LIBS} + - ExtraCC ........... : + o EXTRACC_VERSION . : ${EXTRACC_VERSION} + o EXTRACC_CFLAGS .. : ${EXTRACC_CFLAGS} + o EXTRACC_LIBS .... : ${EXTRACC_LIBS} + - CPPUNIT ........... : o CPPUNIT_VERSION . : ${CPPUNIT_VERSION} o CPPUNIT_CFLAGS .. : ${CPPUNIT_CFLAGS} Modified: trunk/simfqt/test/simfqt/Makefile.am =================================================================== --- trunk/simfqt/test/simfqt/Makefile.am 2010-04-06 14:46:49 UTC (rev 11) +++ trunk/simfqt/test/simfqt/Makefile.am 2010-06-13 20:24:43 UTC (rev 12) @@ -18,6 +18,7 @@ FQTTestSuite_LDADD = FQTTestSuite_LDFLAGS = \ $(BOOST_LIBS) $(CPPUNIT_LIBS) \ - $(top_builddir)/extracppunit/libextracc-extracppunit.la \ + $(top_builddir)/extracppunit/libextracppunit.la \ $(top_builddir)/stdair/core/libstdair.la \ $(top_builddir)/simfqt/core/libsimfqt.la + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-04-06 14:46:55
|
Revision: 11 http://simfqt.svn.sourceforge.net/simfqt/?rev=11&view=rev Author: denis_arnaud Date: 2010-04-06 14:46:49 +0000 (Tue, 06 Apr 2010) Log Message: ----------- [Conf] Added the StdAir batch layer. Modified Paths: -------------- trunk/simfqt/configure.ac Modified: trunk/simfqt/configure.ac =================================================================== --- trunk/simfqt/configure.ac 2010-03-24 13:10:46 UTC (rev 10) +++ trunk/simfqt/configure.ac 2010-04-06 14:46:49 UTC (rev 11) @@ -244,6 +244,7 @@ stdair/config/Makefile stdair/service/Makefile stdair/core/Makefile + stdair/batches/Makefile simfqt/Makefile simfqt/basic/Makefile simfqt/bom/Makefile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-03-24 13:10:52
|
Revision: 10 http://simfqt.svn.sourceforge.net/simfqt/?rev=10&view=rev Author: denis_arnaud Date: 2010-03-24 13:10:46 +0000 (Wed, 24 Mar 2010) Log Message: ----------- [Test] Migrated the test to CPPUnit framework. Modified Paths: -------------- trunk/simfqt/test/simfqt/Makefile.am Added Paths: ----------- trunk/simfqt/test/simfqt/FQTTestSuite.cpp trunk/simfqt/test/simfqt/FQTTestSuite.hpp Removed Paths: ------------- trunk/simfqt/test/simfqt/priceQuote.cpp Property Changed: ---------------- trunk/simfqt/test/simfqt/ Property changes on: trunk/simfqt/test/simfqt ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile priceQuote priceQuote.log + .deps .libs Makefile.in Makefile FQTTestSuite FQTTestSuite.log FQTTestSuite_results.xml Added: trunk/simfqt/test/simfqt/FQTTestSuite.cpp =================================================================== --- trunk/simfqt/test/simfqt/FQTTestSuite.cpp (rev 0) +++ trunk/simfqt/test/simfqt/FQTTestSuite.cpp 2010-03-24 13:10:46 UTC (rev 10) @@ -0,0 +1,78 @@ +// STL +#include <sstream> +#include <fstream> +#include <string> +// CPPUNIT +#include <extracppunit/CppUnitCore.hpp> +// StdAir +#include <stdair/basic/BasLogParams.hpp> +#include <stdair/basic/BasDBParams.hpp> +// SimFQT +#include <simfqt/SIMFQT_Service.hpp> +// SimFQT Test Suite +#include <test/simfqt/FQTTestSuite.hpp> + +// ////////////////////////////////////////////////////////////////////// +// Test is based on ... +// ////////////////////////////////////////////////////////////////////// + +// ////////////////////////////////////////////////////////////////////// +void FQTTestSuite::simpleFQTHelper() { + + try { + + // Airline code + std::string lAirlineCode ("SV"); + + // Number of passengers in the travelling group + SIMFQT::PartySize_T lPartySize = 5; + + // Output log File + std::string lLogFilename ("FQTTestSuite.log"); + + // Set the log parameters + std::ofstream logOutputFile; + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + // Initialise the list of classes/buckets + const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); + SIMFQT::SIMFQT_Service simfqtService (lLogParams, lAirlineCode); + + // Perform a price quotation + simfqtService.priceQuote (lAirlineCode, lPartySize); + + } catch (const SIMFQT::RootException& otexp) { + std::cerr << "Standard exception: " << otexp.what() << std::endl; + return; + + } catch (const std::exception& stde) { + std::cerr << "Standard exception: " << stde.what() << std::endl; + return; + + } catch (...) { + return; + } + +} + +// ////////////////////////////////////////////////////////////////////// +void FQTTestSuite::simpleFQT () { + // TODO: Check that the fqt goes as expected + CPPUNIT_ASSERT_NO_THROW ( simpleFQTHelper();); +} + +// ////////////////////////////////////////////////////////////////////// +// void FQTTestSuite::errorCase () { +// CPPUNIT_ASSERT (false); +// } + +// ////////////////////////////////////////////////////////////////////// +FQTTestSuite::FQTTestSuite () { + _describeKey << "Running test on FQT"; +} + +// /////////////// M A I N ///////////////// +CPPUNIT_MAIN() + Added: trunk/simfqt/test/simfqt/FQTTestSuite.hpp =================================================================== --- trunk/simfqt/test/simfqt/FQTTestSuite.hpp (rev 0) +++ trunk/simfqt/test/simfqt/FQTTestSuite.hpp 2010-03-24 13:10:46 UTC (rev 10) @@ -0,0 +1,31 @@ +// STL +#include <iosfwd> +// CPPUNIT +#include <cppunit/extensions/HelperMacros.h> + +/** Utility class for CPPUnit-based testing. */ +class FQTTestSuite : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE (FQTTestSuite); + CPPUNIT_TEST (simpleFQT); + // CPPUNIT_TEST (errorCase); + CPPUNIT_TEST_SUITE_END (); +public: + + /** Test a simple fare quote functionality. */ + void simpleFQT(); + + /** Test some error detection functionalities. */ + // void errorCase (); + + /** Constructor. */ + FQTTestSuite (); + +private: + /** Test a simple fare quote functionality. */ + void simpleFQTHelper(); + +protected: + std::stringstream _describeKey; +}; + +CPPUNIT_TEST_SUITE_REGISTRATION (FQTTestSuite); Modified: trunk/simfqt/test/simfqt/Makefile.am =================================================================== --- trunk/simfqt/test/simfqt/Makefile.am 2010-03-15 10:26:39 UTC (rev 9) +++ trunk/simfqt/test/simfqt/Makefile.am 2010-03-24 13:10:46 UTC (rev 10) @@ -9,22 +9,15 @@ EXTRA_DIST = ## -check_PROGRAMS = priceQuote +check_PROGRAMS = FQTTestSuite TESTS = $(check_PROGRAMS) XFAIL_TESTS = # -#InventoryTestSuite_SOURCES = InventoryTestSuite.hpp \ - InventoryTestSuite.cpp -#InventoryTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) -#InventoryTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la -#InventoryTestSuite_LDFLAGS = \ -# $(BOOST_LIBS) $(CPPUNIT_LIBS) \ -# $(top_builddir)/stdair/core/libstdair.la \ -# $(top_builddir)/simfqt/libsimfqt.la - -priceQuote_SOURCES = priceQuote.cpp -priceQuote_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) -priceQuote_LDADD = -priceQuote_LDFLAGS = $(BOOST_LIBS) \ +FQTTestSuite_SOURCES = FQTTestSuite.hpp FQTTestSuite.cpp +FQTTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) +FQTTestSuite_LDADD = +FQTTestSuite_LDFLAGS = \ + $(BOOST_LIBS) $(CPPUNIT_LIBS) \ + $(top_builddir)/extracppunit/libextracc-extracppunit.la \ $(top_builddir)/stdair/core/libstdair.la \ $(top_builddir)/simfqt/core/libsimfqt.la Deleted: trunk/simfqt/test/simfqt/priceQuote.cpp =================================================================== --- trunk/simfqt/test/simfqt/priceQuote.cpp 2010-03-15 10:26:39 UTC (rev 9) +++ trunk/simfqt/test/simfqt/priceQuote.cpp 2010-03-24 13:10:46 UTC (rev 10) @@ -1,47 +0,0 @@ -// STL -#include <cassert> -#include <iostream> -#include <sstream> -#include <fstream> -#include <string> -// SIMFQT -#include <simfqt/SIMFQT_Service.hpp> -#include <simfqt/config/simfqt-paths.hpp> - -// ///////// M A I N //////////// -int main (int argc, char* argv[]) { - - try { - - // Airline code - std::string lAirlineCode ("LH"); - - // Number of passengers in the travelling group - SIMFQT::PartySize_T lPartySize = 5; - - // Output log File - std::string lLogFilename ("priceQuote.log"); - - // Set the log parameters - std::ofstream logOutputFile; - // Open and clean the log outputfile - logOutputFile.open (lLogFilename.c_str()); - logOutputFile.clear(); - - // Initialise the list of classes/buckets - const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile); - SIMFQT::SIMFQT_Service simfqtService (lLogParams, lAirlineCode); - - // Perform a price quotation - simfqtService.priceQuote (lAirlineCode, lPartySize); - - } catch (const std::exception& stde) { - std::cerr << "Standard exception: " << stde.what() << std::endl; - return -1; - - } catch (...) { - return -1; - } - - return 0; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-03-15 10:26:45
|
Revision: 9 http://simfqt.svn.sourceforge.net/simfqt/?rev=9&view=rev Author: denis_arnaud Date: 2010-03-15 10:26:39 +0000 (Mon, 15 Mar 2010) Log Message: ----------- [Test] Added the dependency on the StdAir library. Modified Paths: -------------- trunk/simfqt/test/simfqt/Makefile.am Modified: trunk/simfqt/test/simfqt/Makefile.am =================================================================== --- trunk/simfqt/test/simfqt/Makefile.am 2010-02-07 19:57:05 UTC (rev 8) +++ trunk/simfqt/test/simfqt/Makefile.am 2010-03-15 10:26:39 UTC (rev 9) @@ -19,10 +19,12 @@ #InventoryTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la #InventoryTestSuite_LDFLAGS = \ # $(BOOST_LIBS) $(CPPUNIT_LIBS) \ +# $(top_builddir)/stdair/core/libstdair.la \ # $(top_builddir)/simfqt/libsimfqt.la priceQuote_SOURCES = priceQuote.cpp priceQuote_CXXFLAGS= $(CPPUNIT_CFLAGS) $(BOOST_CFLAGS) priceQuote_LDADD = priceQuote_LDFLAGS = $(BOOST_LIBS) \ + $(top_builddir)/stdair/core/libstdair.la \ $(top_builddir)/simfqt/core/libsimfqt.la This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-02-07 19:57:11
|
Revision: 8 http://simfqt.svn.sourceforge.net/simfqt/?rev=8&view=rev Author: denis_arnaud Date: 2010-02-07 19:57:05 +0000 (Sun, 07 Feb 2010) Log Message: ----------- [StdAir] Added the command layer for StdAir. Modified Paths: -------------- trunk/simfqt/configure.ac Modified: trunk/simfqt/configure.ac =================================================================== --- trunk/simfqt/configure.ac 2010-02-07 02:55:55 UTC (rev 7) +++ trunk/simfqt/configure.ac 2010-02-07 19:57:05 UTC (rev 8) @@ -240,6 +240,7 @@ stdair/bom/Makefile stdair/dbadaptor/Makefile stdair/factory/Makefile + stdair/command/Makefile stdair/config/Makefile stdair/service/Makefile stdair/core/Makefile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2010-02-07 02:56:01
|
Revision: 7 http://simfqt.svn.sourceforge.net/simfqt/?rev=7&view=rev Author: denis_arnaud Date: 2010-02-07 02:55:55 +0000 (Sun, 07 Feb 2010) Log Message: ----------- [DB] Added support for database administration, as well as a sample table (for airline description). Modified Paths: -------------- trunk/simfqt/configure.ac Modified: trunk/simfqt/configure.ac =================================================================== --- trunk/simfqt/configure.ac 2010-01-21 23:32:47 UTC (rev 6) +++ trunk/simfqt/configure.ac 2010-02-07 02:55:55 UTC (rev 7) @@ -104,15 +104,6 @@ # ----------------------------------------------------------- -# Python -# ----------------------------------------------------------- -PGAC_CHECK_PYTHON_EMBED_SETUP -AC_SUBST(PYTHON_VERSION) -AC_SUBST(PYTHON_LIBS) -AC_SUBST(PYTHON_CFLAGS) -AC_SUBST(PYTHON_ADD_LIBS) - -# ----------------------------------------------------------- # Python: http://www.python.org # ----------------------------------------------------------- PGAC_CHECK_PYTHON_EMBED_SETUP @@ -125,18 +116,18 @@ # MPICH2: http://www.mcs.anl.gov/research/projects/mpich2 # Note: Boost.MPI depends on MPICH2, rather than on OpenMPI # ----------------------------------------------------------- -AX_MPICH2 -AC_SUBST(MPICH2_VERSION) -AC_SUBST(MPICH2_CFLAGS) -AC_SUBST(MPICH2_LIBS) +#AX_MPICH2 +#AC_SUBST(MPICH2_VERSION) +#AC_SUBST(MPICH2_CFLAGS) +#AC_SUBST(MPICH2_LIBS) # ----------------------------------------------------------- # OpenMPI: http://www.open-mpi.org # ----------------------------------------------------------- -#AX_OPENMPI -#AC_SUBST(OPENMPI_VERSION) -#AC_SUBST(OPENMPI_CFLAGS) -#AC_SUBST(OPENMPI_LIBS) +AX_OPENMPI +AC_SUBST(OPENMPI_VERSION) +AC_SUBST(OPENMPI_CFLAGS) +AC_SUBST(OPENMPI_LIBS) # --------------------------------------------------------------- # Boost (STL Extensions): http://www.boost.org @@ -247,6 +238,7 @@ stdair/Makefile stdair/basic/Makefile stdair/bom/Makefile + stdair/dbadaptor/Makefile stdair/factory/Makefile stdair/config/Makefile stdair/service/Makefile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |