MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
EE_Func Class Reference

#include <evaluator_impl.h>

Inheritance diagram for EE_Func:
Collaboration diagram for EE_Func:

Public Member Functions

 EE_Func (MathParser *p, MathParser::MathFunc_t *f)
 
 ~EE_Func (void)
 
TypedValue Eval (void) const
 
std::ostream & Output (std::ostream &out) const
 
- Public Member Functions inherited from ExpressionElement
virtual ~ExpressionElement (void)
 

Private Attributes

MathParserm_p
 
MathParser::MathFunc_tm_f
 

Additional Inherited Members

- Public Types inherited from ExpressionElement
enum  EEFlags { EE_NONE = 0x0U, EE_CONSTIFY = 0x1U, EE_OPTIMIZE = EE_CONSTIFY }
 
- Static Public Member Functions inherited from ExpressionElement
static unsigned GetFlags (void)
 
static void SetFlag (EEFlags f)
 
static void ClearFlag (EEFlags f)
 
static bool IsFlag (EEFlags f)
 
- Static Protected Attributes inherited from ExpressionElement
static unsigned m_uEEFlags
 

Detailed Description

Definition at line 646 of file evaluator_impl.h.

Constructor & Destructor Documentation

EE_Func::EE_Func ( MathParser p,
MathParser::MathFunc_t f 
)
inline

Definition at line 653 of file evaluator_impl.h.

654  : m_p(p), m_f(f)
655  {
656  };
MathParser * m_p
MathParser::MathFunc_t * m_f
EE_Func::~EE_Func ( void  )
inline

Definition at line 658 of file evaluator_impl.h.

References MathParser::MathFunc_t::args, and m_f.

659  {
660  for (unsigned i = 0; i < m_f->args.size(); ++i) {
661  const ExpressionElement *ee = m_f->args[i]->GetExpr();
662  if (ee) {
663  delete ee;
664  }
665  }
666  delete m_f;
667  };
MathParser::MathFunc_t * m_f

Member Function Documentation

TypedValue EE_Func::Eval ( void  ) const
inlinevirtual

Implements ExpressionElement.

Definition at line 670 of file evaluator_impl.h.

References MathParser::MathFunc_t::args, DEBUGCERR, MathParser::MathFunc_t::errmsg, MathParser::NameSpace::EvalFunc(), MathParser::MathFunc_t::fname, m_f, m_p, MBDYN_EXCEPT_ARGS, MathParser::MathFunc_t::ns, MathParser::NameSpace::sGetName(), and MathParser::MathFunc_t::t.

671  {
672  // sure args[0] does not need to be evaluated: it's the return value
673  for (unsigned i = 1; i < m_f->args.size(); i++) {
674  m_f->args[i]->Eval();
675  }
676 
677  if (m_f->t != 0) {
678  if (m_f->t(m_f->args)) {
679  DEBUGCERR("error in function "
680  << m_f->ns->sGetName() << "::" << m_f->fname
681  << " " "(msg: " << m_f->errmsg << ")"
682  << " in EE_Func()" << std::endl);
684  m_f->fname + ": error " + m_f->errmsg);
685  }
686  }
687 
688  TypedValue val = m_f->ns->EvalFunc(m_f);
689 
690  return val;
691  };
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
std::string errmsg
Definition: mathp.h:172
MathParser * m_p
MathParser::MathFunc_t * m_f
#define DEBUGCERR(msg)
Definition: myassert.h:235
MathFuncTest_f t
Definition: mathp.h:171
virtual const std::string & sGetName(void) const
Definition: mathp.cc:2001
virtual TypedValue EvalFunc(MathParser::MathFunc_t *f) const =0
NameSpace * ns
Definition: mathp.h:168
std::string fname
Definition: mathp.h:167

Here is the call graph for this function:

std::ostream& EE_Func::Output ( std::ostream &  out) const
inlinevirtual

Implements ExpressionElement.

Definition at line 694 of file evaluator_impl.h.

References MathParser::MathFunc_t::args, MathParser::MathFunc_t::fname, m_f, MathParser::MathFunc_t::ns, ExpressionElement::Output(), and MathParser::NameSpace::sGetName().

695  {
696  if (m_f->ns) {
697  out << m_f->ns->sGetName() << "::";
698  }
699 
700  out << m_f->fname << "(";
701  const ExpressionElement *ee = m_f->args[1]->GetExpr();
702  if (ee != 0) {
703  ee->Output(out);
704  for (unsigned i = 2; i < m_f->args.size(); ++i) {
705  ee = m_f->args[i]->GetExpr();
706  if (ee == 0) {
707  break;
708  }
709  out << ", ", ee->Output(out);
710  }
711  }
712  out << ")";
713 
714  return out;
715  };
MathParser::MathFunc_t * m_f
virtual std::ostream & Output(std::ostream &out) const =0
virtual const std::string & sGetName(void) const
Definition: mathp.cc:2001
NameSpace * ns
Definition: mathp.h:168
std::string fname
Definition: mathp.h:167

Here is the call graph for this function:

Member Data Documentation

MathParser::MathFunc_t* EE_Func::m_f
private

Definition at line 650 of file evaluator_impl.h.

Referenced by Eval(), Output(), and ~EE_Func().

MathParser* EE_Func::m_p
private

Definition at line 649 of file evaluator_impl.h.

Referenced by Eval().


The documentation for this class was generated from the following file: