Go to the documentation of this file.
   16 #define exprtk_disable_string_capabilities  // Workaround a bug in Ubuntu 
   20 #define exprtk_disable_enhanced_features 
   21 #define exprtk_disable_superscalar_unroll 
   22 #define exprtk_disable_rtl_vecops 
   23 #define exprtk_disable_rtl_io_file 
   24 #include <mrpt/otherlibs/exprtk.hpp> 
   53         const std::map<std::string, double>& variables,
 
   58         m_impl->m_original_expr_str = expression;
 
   60         exprtk::symbol_table<double> symbol_table;
 
   61         for (
const auto& 
v : variables)
 
   63                 double& var = 
const_cast<double&
>(
v.second);
 
   64                 symbol_table.add_variable(
v.first, var);
 
   66         symbol_table.add_constant(
"M_PI", 
M_PI);
 
   67         symbol_table.add_constants();
 
   69         m_impl->m_compiled_formula.register_symbol_table(symbol_table);
 
   72         exprtk::parser<double> parser;
 
   75                         m_impl->m_compiled_formula))
 
   77                         "Error compiling expression (name=`%s`): `%s`. Error: `%s`",
 
   78                         expr_name_for_error_reporting.c_str(), expression.c_str(),
 
   79                         parser.error().c_str());
 
   85         return m_impl->m_compiled_formula.value();
 
   92         const std::map<std::string, double*>& variables)
 
   94         exprtk::symbol_table<double> symbol_table;
 
   95         for (
const auto& 
v : variables)
 
   97                 double* var = 
const_cast<double*
>(
v.second);
 
   98                 symbol_table.add_variable(
v.first, *var);
 
  100         m_impl->m_compiled_formula.register_symbol_table(symbol_table);
 
  106         return m_impl->m_compiled_formula;
 
  112         return m_impl->m_compiled_formula;
 
  118         return m_impl->m_compiled_formula;
 
  122         return m_impl->m_original_expr_str;
 
  
bool is_compiled() const
Returns true if compile() was called and ended without errors.
 
void compile(const std::string &expression, const std::map< std::string, double > &variables=std::map< std::string, double >(), const std::string &expr_name_for_error_reporting=std::string())
Initializes the object by compiling an expression.
 
CRuntimeCompiledExpression()
Default ctor.
 
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
 
void register_symbol_table(const std::map< std::string, double * > &variables)
Can be used before calling compile() to register additional variables by means of pointers instead of...
 
#define ASSERT_(f)
Defines an assertion mechanism.
 
mrpt::pimpl< Impl > m_impl
 
A wrapper of exprtk runtime expression compiler: it takes a string representing an expression (from a...
 
~CRuntimeCompiledExpression()
 
double eval() const
Evaluates the current value of the precompiled formula.
 
pimpl< T > make_impl(Args &&... args)
 
const std::string & get_original_expression() const
Returns the original formula passed to compile(), or an empty string if still not compiled.
 
exprtk::expression< double > & get_raw_exprtk_expr()
Access raw exprtk expression object.
 
GLsizei const GLchar ** string
 
exprtk::expression< double > m_compiled_formula
 
std::string m_original_expr_str
 
   |  Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST |   |