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);
62 const bool hasInsertBeenSuccessfull =
64 insert (stdair::FFDisutilityCurve_T::
66 if (hasInsertBeenSuccessfull ==
false) {
67 std::ostringstream oStr;
69 <<
"') has probably been given twice";
70 STDAIR_LOG_ERROR (oStr.str());
71 throw stdair::KeyDuplicationException (oStr.str());
90 STDAIR_LOG_DEBUG (
"FFDisutility: " <<
_ffDisutility.describe());
121 template<
typename ScannerT>
129 bsc::lexeme_d[ bsc::comment_p(
"//") | bsc::comment_p(
"/*",
"*/")
155 BOOST_SPIRIT_DEBUG_NODE (
key);
156 BOOST_SPIRIT_DEBUG_NODE (
map);
161 template<
typename ScannerT>
162 bsc::rule<ScannerT>
const&
178 const stdair::Filename_T& iFilename)
179 : _filename (iFilename), _bomRoot (ioBomRoot) {
184 void FFDisutilityFileParser::init() {
189 if (!_startIterator) {
190 std::ostringstream oMessage;
191 oMessage <<
"The file " << _filename <<
" can not be open." << std::endl;
192 STDAIR_LOG_ERROR (oMessage.str());
197 _endIterator = _startIterator.make_end();
202 bool oResult =
false;
204 STDAIR_LOG_DEBUG (
"Parsing FFDisutility input file: " << _filename);
212 bsc::parse_info<iterator_t> info = bsc::parse (_startIterator, _endIterator,
214 bsc::space_p - bsc::eol_p);
219 const bool isFull = info.full;
221 const std::string hasBeenFullyReadStr = (isFull ==
true)?
"":
"not ";
222 if (oResult ==
true && isFull ==
true) {
223 STDAIR_LOG_DEBUG (
"Parsing of FFDisutility input file: " << _filename
224 <<
" succeeded: read " << info.length
225 <<
" characters. The input file has "
226 << hasBeenFullyReadStr
227 <<
"been fully read. Stop point: " << info.stop);
230 STDAIR_LOG_ERROR (
"Parsing of FFDisutility input file: " << _filename
231 <<
" failed: read " << info.length
232 <<
" characters. The input file has "
233 << hasBeenFullyReadStr
234 <<
"been fully read. Stop point: " << info.stop);
bool generateFFDisutilityCurves()
FFDisutilityFileParser(stdair::BomRoot &ioBomRoot, const stdair::Filename_T &iFilename)
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 > value_pair
boost::spirit::classic::rule< ScannerT > not_to_be_parsed
definition(FFDisutilityParser const &self)
boost::spirit::classic::rule< ScannerT > curve_end
boost::spirit::classic::rule< ScannerT > const & start() const
boost::spirit::classic::rule< ScannerT > curve_list
boost::spirit::classic::rule< ScannerT > curve
boost::spirit::classic::rule< ScannerT > map
boost::spirit::classic::rule< ScannerT > key
stdair::BomRoot & _bomRoot
FFDisutilityStruct & _ffDisutility
FFDisutilityParser(stdair::BomRoot &, FFDisutilityStruct &)
FFDisutilityStruct & _ffDisutility
ParserSemanticAction(FFDisutilityStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
doEndCurve(stdair::BomRoot &, FFDisutilityStruct &)
stdair::BomRoot & _bomRoot
storeCurveKey(FFDisutilityStruct &)
void operator()(iterator_t iStr, iterator_t iStrEnd) const
storeDTD(FFDisutilityStruct &)
void operator()(int iDTD) const
storeFFDisutilityValue(FFDisutilityStruct &)
void operator()(double iReal) const