2#define OPAL_ASUnary_HH 1
63 virtual void print(std::ostream&,
int precedence = 99)
const;
82 :
Scalar<
T>(rhs), fun(rhs.fun), opr(rhs.opr->clone()) {}
87 : fun(function), opr(oper) {}
100 const std::vector<T> arg = opr->evaluate();
101 T result = (*fun.function)(arg);
110 if (result ==
T(0))
return result;
124 bool isConst = oper->isConstant();
127 if (function.precedence != -2) {
141 if (fun.precedence >= 0) {
142 if (fun.precedence <= precedence) os <<
"(";
144 opr->print(os, fun.precedence);
145 if (fun.precedence <= precedence) os <<
")";
147 os << fun.name <<
"(";
A scalar expression with one array operand.
virtual void print(std::ostream &, int precedence=99) const
Print expression.
static PtrToScalar< T > make(const TFunction1< T, const std::vector< T > & > &function, PtrToArray< T > &oper)
Make new expression.
virtual T evaluate() const
Evaluate expression.
void operator=(const ASUnary &)
virtual Scalar< T > * clone() const
Make clone.
const TFunction1< T, const std::vector< T > & > & fun
A pointer to an array expression.
A pointer to a scalar expression.
A scalar constant expression.
Representation objects and parsers for attribute expressions.
A function of one U, returning a T.