14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/expr/BinaryExpressionImpl.h"
17#include "arcane/expr/OperatorMng.h"
18#include "arcane/expr/BadOperationException.h"
29BinaryExpressionImpl(IExpressionImpl* first,IExpressionImpl* second,
30 eOperationType operation)
34, m_operation(operation)
41String BinaryExpressionImpl::
42operationName(eOperationType type)
46 case Add:
return "Add";
47 case Substract:
return "Substract";
48 case Multiply:
return "Multiply";
49 case Divide:
return "Divide";
50 case Minimum:
return "Minimum";
51 case Maximum:
return "Maximum";
52 case Pow:
return "Pow";
53 case LessThan:
return "LessThan";
54 case GreaterThan:
return "GreaterThan";
55 case LessOrEqualThan:
return "LessOrEqualThan";
56 case GreaterOrEqualThan:
return "GreaterOrEqualThan";
57 default:
return "Unknown";
64void BinaryExpressionImpl::
65apply(ExpressionResult* result)
73 ExpressionResult first_op(result->indices());
74 m_first->apply(&first_op);
75 ExpressionResult second_op(result->indices());
76 m_second->apply(&second_op);
79 VariantBase::eType type = first_op.data()->type();
80 BinaryOperator* op = m_op_mng->find(
this, type, m_operation);
82 throw BadOperationException(
"BinaryExpressionImpl::apply",
83 operationName(),type);
85 op->evaluate(result, first_op.data(), second_op.data());