8#include <stdair/stdair_exceptions.hpp>
9#include <stdair/stdair_types.hpp>
10#include <stdair/bom/BomRoot.hpp>
11#include <stdair/service/Logger.hpp>
16namespace bsc = boost::spirit::classic;
40 const std::string lKey (iStr, iStrEnd);
63 const bool hasInsertBeenSuccessfull =
65 insert (stdair::FRAT5Curve_T::
66 value_type (
_frat5._dtd, iReal)).second;
67 if (hasInsertBeenSuccessfull ==
false) {
68 std::ostringstream oStr;
69 oStr <<
"The same DTD ('" <<
_frat5._dtd
70 <<
"') has probably been given twice";
71 STDAIR_LOG_ERROR (oStr.str());
72 throw stdair::KeyDuplicationException (oStr.str());
91 STDAIR_LOG_DEBUG (
"FRAT5: " <<
_frat5.describe());
122 template<
typename ScannerT>
130 bsc::lexeme_d[ bsc::comment_p(
"//") | bsc::comment_p(
"/*",
"*/")
156 BOOST_SPIRIT_DEBUG_NODE (
key);
157 BOOST_SPIRIT_DEBUG_NODE (
map);
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.");
FRAT5FileParser(stdair::BomRoot &ioBomRoot, const stdair::Filename_T &iFilename)
bool generateFRAT5Curves()
repeat_p_t key_p(chset_t("0-9A-Z").derived(), 1, 10)
boost::spirit::classic::impl::loop_traits< chset_t, unsignedint, unsignedint >::type repeat_p_t
boost::spirit::classic::chset< char_t > chset_t
boost::spirit::classic::file_iterator< char_t > iterator_t
boost::spirit::classic::rule< ScannerT > curve_end
boost::spirit::classic::rule< ScannerT > curve_list
boost::spirit::classic::rule< ScannerT > const & start() const
boost::spirit::classic::rule< ScannerT > value_pair
boost::spirit::classic::rule< ScannerT > key
boost::spirit::classic::rule< ScannerT > not_to_be_parsed
definition(FRAT5Parser const &self)
boost::spirit::classic::rule< ScannerT > map
boost::spirit::classic::rule< ScannerT > curve
FRAT5Parser(stdair::BomRoot &, FRAT5Struct &)
stdair::BomRoot & _bomRoot
ParserSemanticAction(FRAT5Struct &)
stdair::BomRoot & _bomRoot
void operator()(iterator_t iStr, iterator_t iStrEnd) const
doEndCurve(stdair::BomRoot &, FRAT5Struct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeCurveKey(FRAT5Struct &)
void operator()(int iDTD) const
storeFRAT5Value(FRAT5Struct &)
void operator()(double iReal) const