7 #ifndef IGLOO_CONTRAINTOPERATOR_H 8 #define IGLOO_CONTRAINTOPERATOR_H 18 const std::string& Message()
const 23 std::string m_message;
30 virtual void PerformOperation(ResultStack& result) = 0;
31 virtual int Precedence()
const = 0;
33 template <
typename Constra
intListType,
typename ActualType>
34 static bool EvaluateElementAgainstRestOfExpression(ConstraintListType& list,
const ActualType& actual)
36 ResultStack innerResult;
37 OperatorStack innerOperators;
39 EvaluateConstraintList(list.m_tail, innerResult, innerOperators, actual);
40 EvaluateAllOperatorsOnStack(innerOperators, innerResult);
42 if(innerResult.empty())
44 throw InvalidExpressionException(
"The expression after \"" + snowhouse::Stringize(list.m_head) +
"\" operator does not yield any result");
47 return innerResult.top();
50 static void EvaluateOperatorsWithLessOrEqualPrecedence(
const ConstraintOperator& op, OperatorStack& operators, ResultStack& result)
52 while(!operators.empty())
56 if(op_from_stack->Precedence() > op.Precedence())
61 op_from_stack->PerformOperation(result);
66 static void EvaluateAllOperatorsOnStack(OperatorStack& operators, ResultStack& result)
68 while(!operators.empty())
71 op->PerformOperation(result);
Definition: constraintoperator.h:26
Definition: constraintoperator.h:12