Evaluate this expression (hzNumexpForm instance) to a single atomic value. A hzNumexpForm instance is created by an expression parser when the expression amounts to a 'term operator term' rather than only a single term. hzNumexpForm Evaluation is thus always a matter of evaluating both terms and applying the operator. Where the terms are themselves hzNumexpForm instances, this function recurses. Arguments: None
| Return Type | Function name | Arguments |
|---|---|---|
| double | hzNumexpForm::Evaluate | (void) |
Declared in file: hzNumexp.h
Defined in file : hzNumexp.cpp
Function Logic:
Function body:
double hzNumexpForm::Evaluate (void)
{
// Evaluate this expression (hzNumexpForm instance) to a single atomic value. A hzNumexpForm instance is created by an expression parser when the
// expression amounts to a 'term operator term' rather than only a single term. hzNumexpForm Evaluation is thus always a matter of evaluating
// both terms and applying the operator. Where the terms are themselves hzNumexpForm instances, this function recurses.
//
// Arguments: None
// Returns: Value - the numeric result
_hzfunc("hzNumexpForm::Evaluate_a") ;
double A ; // Term A
double B ; // Term B
A = m_pA->Evaluate() ;
B = m_pB->Evaluate() ;
switch (m_eBinary)
{
// case OP_ASSIGN: break ;
case OP_EQUAL: m_Result = (A == B) ; break ;
case OP_GT: m_Result = (A > B) ; break ;
case OP_LT: m_Result = (A < B) ; break ;
case OP_GTEQ: m_Result = (A >&eq; B) ; break ;
case OP_LTEQ: m_Result = (A <&eq; B) ; break ;
case OP_PLUS: m_Result = A ; m_Result += B ; break ;
case OP_MINUS: m_Result = A ; m_Result -= B ; break ;
case OP_MULT: m_Result = A ; m_Result *= B ; break ;
case OP_DIVIDE: m_Result = A ; m_Result /= B ; break ;
// case OP_AND: m_Result = A ; m_Result &= B ; break ;
// case OP_OR: m_Result = A ; m_Result |= B ; break ;
}
return m_Result ;
}