$treeview $search $mathjax
AirInv Logo  1.00.1
$projectbrief
$projectbrief
$searchbox

FRAT5ParserHelper.hpp

Go to the documentation of this file.
00001 #ifndef __AIRINV_CMD_FRAT5PARSERHELPER_HPP
00002 #define __AIRINV_CMD_FRAT5PARSERHELPER_HPP
00003 
00004 // //////////////////////////////////////////////////////////////////////
00005 // Import section
00006 // //////////////////////////////////////////////////////////////////////
00007 // STL
00008 #include <string>
00009 // StdAir
00010 #include <stdair/command/CmdAbstract.hpp>
00011 // Airinv
00012 #include <airinv/AIRINV_Types.hpp>
00013 #include <airinv/basic/BasParserTypes.hpp>
00014 #include <airinv/bom/FRAT5Struct.hpp>
00015 
00016 // Forward declarations
00017 namespace stdair {
00018   class BomRoot;
00019 }
00020 
00021 namespace AIRINV {
00022 
00023   namespace FRAT5ParserHelper {
00024     
00025     // ///////////////////////////////////////////////////////////////////
00026     //  Semantic actions
00027     // ///////////////////////////////////////////////////////////////////
00029     struct ParserSemanticAction {
00031       ParserSemanticAction (FRAT5Struct&);
00033       FRAT5Struct& _frat5;
00034     };
00035       
00037     struct storeCurveKey : public ParserSemanticAction {
00039       storeCurveKey (FRAT5Struct&);
00041       void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00042     };
00043   
00045     struct storeDTD : public ParserSemanticAction {
00047       storeDTD (FRAT5Struct&);
00049       void operator() (int iDTD) const;
00050     };
00051   
00053     struct storeFRAT5Value : public ParserSemanticAction {
00055       storeFRAT5Value (FRAT5Struct&);
00057       void operator() (double iReal) const;
00058     };
00059       
00061     struct doEndCurve : public ParserSemanticAction {
00063       doEndCurve (stdair::BomRoot&, FRAT5Struct&);
00065       void operator() (iterator_t iStr, iterator_t iStrEnd) const;
00067       stdair::BomRoot& _bomRoot;
00068     };
00069 
00071     //
00072     //  (Boost Spirit) Grammar Definition
00073     //
00075 
00089     struct FRAT5Parser : 
00090       public boost::spirit::classic::grammar<FRAT5Parser> {
00091 
00092       FRAT5Parser (stdair::BomRoot&, FRAT5Struct&);
00093 
00094       template <typename ScannerT>
00095       struct definition {
00096         definition (FRAT5Parser const& self);
00097 
00098         // Instantiation of rules
00099         boost::spirit::classic::rule<ScannerT> curve_list,
00100           not_to_be_parsed, curve, key, map, value_pair, curve_end;
00101 
00103         boost::spirit::classic::rule<ScannerT> const& start() const;
00104       };
00105 
00106       // Parser Context
00107       stdair::BomRoot& _bomRoot;
00108       FRAT5Struct& _frat5;
00109     };
00110   }
00111 
00116 
00117   //
00118   //  Entry class for the file parser
00119   //
00121 
00126   class FRAT5FileParser : public stdair::CmdAbstract {
00127   public:
00129     FRAT5FileParser (stdair::BomRoot& ioBomRoot,
00130                      const stdair::Filename_T& iFilename);
00131 
00133     bool generateFRAT5Curves ();
00134       
00135   private:
00137     void init();
00138       
00139   private:
00140     // Attributes
00142     stdair::Filename_T _filename;
00143 
00145     iterator_t _startIterator;
00146       
00148     iterator_t _endIterator;
00149       
00151     stdair::BomRoot& _bomRoot;
00152 
00154     FRAT5Struct _frat5;
00155   };
00156     
00157 }
00158 #endif // __AIRINV_CMD_FRAT5PARSERHELPER_HPP