This is the common wrapper class for binary operations. More...
#include <binary_operators.hpp>
Public Types | |
typedef InterfaceType::numeric_type | numeric_type |
Public Member Functions | |
std::string | str () const |
Returns a textual representation of the binary operation. | |
op_interface< InterfaceType > * | clone () const |
Returns a copy of the operator. The caller must ensure the proper deletion of the returned pointer. | |
numeric_type | apply (numeric_type lhs, numeric_type rhs) const |
Applies the binary operation to the two values. | |
bool | is_unary () const |
Returns whether this operation is a unary operation (which is not the case...). | |
InterfaceType * | diff (const InterfaceType *lhs, const InterfaceType *rhs, const InterfaceType *diff_var) const |
Differentiates the unary operation acting on 'lhs' and 'rhs' with respect to the variable passed. | |
InterfaceType * | simplify (const InterfaceType *lhs, const InterfaceType *rhs) const |
Returns a simplified form of the unary expression (collect constants, remove trivial operations, etc.). The caller is responsible for deleting the pointer returned. | |
bool | can_simplify () const |
Returns true if (and only if) the underlying unary expression can be simplified (collect constants, remove trivial operations, etc.). | |
bool | can_simplify (const InterfaceType *lhs, const InterfaceType *rhs) const |
Returns true if the binary expression can be simplified. | |
bool | equal (const op_interface< InterfaceType > *other) const |
Returns true if the passed 'other' operation equals this operation. |
This is the common wrapper class for binary operations.
BinaryOperation | A tag encoding the binary operation. | |
InterfaceType | The expression runtime interface used for expression manipulation. |
typedef InterfaceType::numeric_type numeric_type |
Reimplemented from op_interface< InterfaceType >.
numeric_type apply | ( | numeric_type | lhs, | |
numeric_type | rhs | |||
) | const [inline] |
Applies the binary operation to the two values.
bool can_simplify | ( | const InterfaceType * | lhs, | |
const InterfaceType * | rhs | |||
) | const [inline, virtual] |
Returns true if the binary expression can be simplified.
Reimplemented from op_interface< InterfaceType >.
bool can_simplify | ( | ) | const [inline, virtual] |
Returns true if (and only if) the underlying unary expression can be simplified (collect constants, remove trivial operations, etc.).
Implements op_interface< InterfaceType >.
op_interface<InterfaceType>* clone | ( | ) | const [inline, virtual] |
Returns a copy of the operator. The caller must ensure the proper deletion of the returned pointer.
Implements op_interface< InterfaceType >.
InterfaceType* diff | ( | const InterfaceType * | lhs, | |
const InterfaceType * | rhs, | |||
const InterfaceType * | diff_var | |||
) | const [inline, virtual] |
Differentiates the unary operation acting on 'lhs' and 'rhs' with respect to the variable passed.
Reimplemented from op_interface< InterfaceType >.
bool equal | ( | const op_interface< InterfaceType > * | other | ) | const [inline] |
Returns true if the passed 'other' operation equals this operation.
bool is_unary | ( | ) | const [inline, virtual] |
Returns whether this operation is a unary operation (which is not the case...).
Reimplemented from op_interface< InterfaceType >.
InterfaceType* simplify | ( | const InterfaceType * | lhs, | |
const InterfaceType * | rhs | |||
) | const [inline, virtual] |
Returns a simplified form of the unary expression (collect constants, remove trivial operations, etc.). The caller is responsible for deleting the pointer returned.
Implements op_interface< InterfaceType >.
std::string str | ( | ) | const [inline, virtual] |
Returns a textual representation of the binary operation.
Implements op_interface< InterfaceType >.