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

#include <evaluator_impl.h>

Inheritance diagram for EE_DeclareAssign:
Collaboration diagram for EE_DeclareAssign:

Public Member Functions

 EE_DeclareAssign (Var *var, MathParser::NameSpace *ns, ExpressionElement *pEE=0)
 
 ~EE_DeclareAssign (void)
 
TypedValue Eval (void) const
 
std::ostream & Output (std::ostream &out) const
 
- Public Member Functions inherited from ExpressionElement
virtual ~ExpressionElement (void)
 

Private Attributes

Varm_Var
 
MathParser::NameSpacem_ns
 
const ExpressionElementm_pEE
 
bool m_bEvaluated
 

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 568 of file evaluator_impl.h.

Constructor & Destructor Documentation

EE_DeclareAssign::EE_DeclareAssign ( Var var,
MathParser::NameSpace ns,
ExpressionElement pEE = 0 
)
inline

Definition at line 576 of file evaluator_impl.h.

576 : m_Var(var), m_ns(ns), m_pEE(pEE), m_bEvaluated(false) {};
const ExpressionElement * m_pEE
MathParser::NameSpace * m_ns
EE_DeclareAssign::~EE_DeclareAssign ( void  )
inline

Definition at line 577 of file evaluator_impl.h.

References m_pEE.

577 { if (m_pEE) { delete m_pEE; } };
const ExpressionElement * m_pEE

Member Function Documentation

TypedValue EE_DeclareAssign::Eval ( void  ) const
inlinevirtual

Implements ExpressionElement.

Definition at line 580 of file evaluator_impl.h.

References ExpressionElement::Eval(), NamedValue::GetName(), m_bEvaluated, m_pEE, m_Var, MBDYN_EXCEPT_ARGS, and Var::SetVal().

581  {
582  if (m_bEvaluated) {
583  silent_cerr(" variable " << m_Var->GetName() << " already declared" << std::endl);
585  }
586 
587  m_bEvaluated = true;
588 
589  if (m_pEE) {
590  TypedValue v(m_pEE->Eval());
591  m_Var->SetVal(v);
592  return v;
593  }
594 
595  return TypedValue(0, true);
596  };
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
const ExpressionElement * m_pEE
virtual TypedValue Eval(void) const =0
const char * GetName(void) const
Definition: mathp.cc:1751
void SetVal(const bool &b)
Definition: mathp.cc:1829

Here is the call graph for this function:

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

Implements ExpressionElement.

Definition at line 599 of file evaluator_impl.h.

References Var::Const(), NamedValue::GetName(), NamedValue::GetTypeName(), m_ns, m_pEE, m_Var, ExpressionElement::Output(), and MathParser::NameSpace::sGetName().

600  {
601  out << "(";
602  if (m_Var->Const()) {
603  out << "const ";
604  }
605 
606  out << m_Var->GetTypeName() << " ";
607 
608  if (m_ns) {
609  out << m_ns->sGetName() << "::";
610  }
611 
612  return out << m_Var->GetName() << " = ", m_pEE->Output(out) << ")";
613  };
bool Const(void) const
Definition: mathp.cc:1811
const ExpressionElement * m_pEE
virtual std::ostream & Output(std::ostream &out) const =0
virtual const std::string & sGetName(void) const
Definition: mathp.cc:2001
MathParser::NameSpace * m_ns
virtual const char *const GetTypeName(void) const
Definition: mathp.cc:1758
const char * GetName(void) const
Definition: mathp.cc:1751

Here is the call graph for this function:

Member Data Documentation

bool EE_DeclareAssign::m_bEvaluated
mutableprivate

Definition at line 573 of file evaluator_impl.h.

Referenced by Eval().

MathParser::NameSpace* EE_DeclareAssign::m_ns
private

Definition at line 571 of file evaluator_impl.h.

Referenced by Output().

const ExpressionElement* EE_DeclareAssign::m_pEE
private

Definition at line 572 of file evaluator_impl.h.

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

Var* EE_DeclareAssign::m_Var
mutableprivate

Definition at line 570 of file evaluator_impl.h.

Referenced by Eval(), and Output().


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