8 #include <stdair/stdair_exceptions.hpp>
9 #include <stdair/stdair_types.hpp>
10 #include <stdair/bom/BomRoot.hpp>
11 #include <stdair/service/Logger.hpp>
16 namespace bsc = boost::spirit::classic;
20 namespace FRAT5ParserHelper {
40 const std::string lKey (iStr, iStrEnd);
63 const bool hasInsertBeenSuccessfull =
67 if (hasInsertBeenSuccessfull ==
false) {
68 std::ostringstream oStr;
70 <<
"') has probably been given twice";
71 STDAIR_LOG_ERROR (oStr.str());
72 throw stdair::KeyDuplicationException (oStr.str());
83 _bomRoot (ioBomRoot) {
117 : _bomRoot (ioBomRoot),
122 template<
typename ScannerT>
126 curve_list = *( not_to_be_parsed | curve )
130 bsc::lexeme_d[ bsc::comment_p(
"//") | bsc::comment_p(
"/*",
"*/")
134 curve = key >>
';' >> map
135 >> curve_end[
doEndCurve(
self._bomRoot,
self._frat5)]
138 curve_end = bsc::ch_p(
';')
146 value_pair >> *(
';' >> value_pair)
149 value_pair = bsc::uint_p[
storeDTD(
self._frat5)]
154 BOOST_SPIRIT_DEBUG_NODE (curve_list);
155 BOOST_SPIRIT_DEBUG_NODE (not_to_be_parsed);
156 BOOST_SPIRIT_DEBUG_NODE (key);
157 BOOST_SPIRIT_DEBUG_NODE (map);
158 BOOST_SPIRIT_DEBUG_NODE (value_pair);
162 template<
typename ScannerT>
163 bsc::rule<ScannerT>
const&
179 const stdair::Filename_T& iFilename)
180 : _filename (iFilename), _bomRoot (ioBomRoot) {
185 void FRAT5FileParser::init() {
190 if (!_startIterator) {
191 std::ostringstream oMessage;
192 oMessage <<
"The file " << _filename <<
" can not be open." << std::endl;
193 STDAIR_LOG_ERROR (oMessage.str());
198 _endIterator = _startIterator.make_end();
203 bool oResult =
false;
205 STDAIR_LOG_DEBUG (
"Parsing FRAT5 input file: " << _filename);
213 bsc::parse_info<iterator_t> info = bsc::parse (_startIterator, _endIterator,
215 bsc::space_p - bsc::eol_p);
220 const bool isFull = info.full;
222 const std::string hasBeenFullyReadStr = (isFull ==
true)?
"":
"not ";
223 if (oResult ==
true && isFull ==
true) {
224 STDAIR_LOG_DEBUG (
"Parsing of FRAT5 input file: " << _filename
225 <<
" succeeded: read " << info.length
226 <<
" characters. The input file has "
227 << hasBeenFullyReadStr
228 <<
"been fully read. Stop point: " << info.stop);
231 STDAIR_LOG_ERROR (
"Parsing of FRAT5 input file: " << _filename
232 <<
" failed: read " << info.length
233 <<
" characters. The input file has "
234 << hasBeenFullyReadStr
235 <<
"been fully read. Stop point: " << info.stop);
237 + _filename +
" failed.");
repeat_p_t key_p(chset_t("0-9A-Z").derived(), 1, 10)
definition(FRAT5Parser const &self)
storeFRAT5Value(FRAT5Struct &)
storeCurveKey(FRAT5Struct &)
boost::spirit::classic::impl::loop_traits< chset_t, unsigned int, unsigned int >::type repeat_p_t
void operator()(iterator_t iStr, iterator_t iStrEnd) const
FRAT5Parser(stdair::BomRoot &, FRAT5Struct &)
ParserSemanticAction(FRAT5Struct &)
boost::spirit::classic::chset< char_t > chset_t
boost::spirit::classic::rule< ScannerT > const & start() const
stdair::BomRoot & _bomRoot
bool generateFRAT5Curves()
void operator()(double iReal) const
stdair::FRAT5Curve_T _curve
std::map< const stdair::DTD_T, double > FRAT5Curve_T
boost::spirit::classic::file_iterator< char_t > iterator_t
void operator()(iterator_t iStr, iterator_t iStrEnd) const
doEndCurve(stdair::BomRoot &, FRAT5Struct &)
const std::string describe() const
FRAT5FileParser(stdair::BomRoot &ioBomRoot, const stdair::Filename_T &iFilename)
void operator()(int iDTD) const