AirRAC Logo  0.2.3
C++ Simulated Revenue Accounting (RAC) System Library
YieldParserHelper.hpp
Go to the documentation of this file.
00001 #ifndef __AIRRAC_CMD_YIELDPARSERHELPER_HPP
00002 #define __AIRRAC_CMD_YIELDPARSERHELPER_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <string>
00009 // Boost
00010 #include <boost/spirit/include/qi.hpp>
00011 // StdAir
00012 #include <stdair/command/CmdAbstract.hpp>
00013 // Airrac
00014 #include <airrac/AIRRAC_Types.hpp>
00015 #include <airrac/bom/YieldRuleStruct.hpp>
00016 
00017 // Forward declarations
00018 namespace stdair {
00019   class BomRoot;
00020 }
00021 
00022 namespace AIRRAC {
00023 
00024   namespace YieldParserHelper {
00025 
00026     // ///////////////////////////////////////////////////////////////////
00027     //  Semantic actions
00028     // ///////////////////////////////////////////////////////////////////
00030     struct ParserSemanticAction {
00032       ParserSemanticAction (YieldRuleStruct&);
00034       YieldRuleStruct& _yieldRule;
00035     };
00036 
00038     struct storeYieldId : public ParserSemanticAction {
00040       storeYieldId (YieldRuleStruct&);
00042       void operator() (unsigned int,
00043                        boost::spirit::qi::unused_type,
00044                        boost::spirit::qi::unused_type) const;
00045     };
00046 
00048     struct storeOrigin : public ParserSemanticAction {
00050       storeOrigin (YieldRuleStruct&);
00052       void operator() (std::vector<char>,
00053                        boost::spirit::qi::unused_type,
00054                        boost::spirit::qi::unused_type) const;
00055     };
00056 
00058     struct storeDestination : public ParserSemanticAction {
00060       storeDestination (YieldRuleStruct&);
00062       void operator() (std::vector<char>,
00063                        boost::spirit::qi::unused_type,
00064                        boost::spirit::qi::unused_type) const;
00065     };   
00066 
00068     struct storeTripType : public ParserSemanticAction {
00070       storeTripType (YieldRuleStruct&);
00072       void operator() (std::vector<char>,
00073                        boost::spirit::qi::unused_type,
00074                        boost::spirit::qi::unused_type) const;
00075     };
00076 
00078     struct storeDateRangeStart : public ParserSemanticAction {
00080       storeDateRangeStart (YieldRuleStruct&);
00082       void operator() (boost::spirit::qi::unused_type,
00083                        boost::spirit::qi::unused_type,
00084                        boost::spirit::qi::unused_type) const;
00085     };
00086 
00088     struct storeDateRangeEnd : public ParserSemanticAction {
00090       storeDateRangeEnd (YieldRuleStruct&);
00092       void operator() (boost::spirit::qi::unused_type,
00093                        boost::spirit::qi::unused_type,
00094                        boost::spirit::qi::unused_type) const;
00095     };
00096 
00098     struct storeStartRangeTime : public ParserSemanticAction {
00100       storeStartRangeTime (YieldRuleStruct&);
00102       void operator() (boost::spirit::qi::unused_type,
00103                        boost::spirit::qi::unused_type,
00104                        boost::spirit::qi::unused_type) const;
00105     };
00106 
00108     struct storeEndRangeTime : public ParserSemanticAction {
00110       storeEndRangeTime (YieldRuleStruct&);
00112       void operator() (boost::spirit::qi::unused_type,
00113                        boost::spirit::qi::unused_type,
00114                        boost::spirit::qi::unused_type) const;
00115     };
00116 
00118     struct storePOS : public ParserSemanticAction {
00120       storePOS (YieldRuleStruct&);
00122       void operator() (std::vector<char>,
00123                        boost::spirit::qi::unused_type,
00124                        boost::spirit::qi::unused_type) const;
00125     };
00126 
00128     struct storeCabinCode : public ParserSemanticAction {
00130       storeCabinCode  (YieldRuleStruct&);
00132       void operator() (char,
00133                        boost::spirit::qi::unused_type,
00134                        boost::spirit::qi::unused_type) const;
00135     };
00136 
00138     struct storeChannel : public ParserSemanticAction {
00140       storeChannel (YieldRuleStruct&);
00142       void operator() (std::vector<char>,
00143                        boost::spirit::qi::unused_type,
00144                        boost::spirit::qi::unused_type) const;
00145     };
00146 
00148     struct storeYield : public ParserSemanticAction {
00150       storeYield (YieldRuleStruct&);
00152       void operator() (double,
00153                        boost::spirit::qi::unused_type,
00154                        boost::spirit::qi::unused_type) const; 
00155     };
00156     
00158     struct storeAirlineCode : public ParserSemanticAction {
00160       storeAirlineCode (YieldRuleStruct&);
00162       void operator() (std::vector<char>,
00163                        boost::spirit::qi::unused_type,
00164                        boost::spirit::qi::unused_type) const;
00165     };
00166 
00168     struct storeClass : public ParserSemanticAction {
00170       storeClass (YieldRuleStruct&);
00172       void operator() (std::vector<char>,
00173                        boost::spirit::qi::unused_type,
00174                        boost::spirit::qi::unused_type) const; 
00175     };
00176     
00178     struct doEndYield : public ParserSemanticAction {
00180       doEndYield (stdair::BomRoot&, YieldRuleStruct&);
00182       void operator() (boost::spirit::qi::unused_type,
00183                        boost::spirit::qi::unused_type,
00184                        boost::spirit::qi::unused_type) const;
00186       stdair::BomRoot& _bomRoot;
00187     };
00188 
00189   }
00190   
00192   //
00193   //  Entry class for the file parser
00194   //
00196 
00202   class YieldFileParser : public stdair::CmdAbstract {
00203   public:
00205     YieldFileParser (stdair::BomRoot&,
00206                      const stdair::Filename_T& iYieldInputFilename);
00207 
00209     void generateYieldStore ();
00210       
00211   private:
00213     void init();
00214       
00215   private:
00216 
00217     // Attributes
00219     stdair::Filename_T _filename;
00220       
00222     stdair::BomRoot& _bomRoot;
00223 
00225     YieldRuleStruct _yieldRule;
00226   };
00227   
00228 }
00229 #endif // __AIRRAC_CMD_YIELDPARSERHELPER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines