The abstract runtime interface for all operations (unary and binary). More...
#include <op_interface.hpp>
Public Types | |
typedef InterfaceType::numeric_type | numeric_type |
Public Member Functions | |
virtual | ~op_interface () |
virtual op_interface * | clone () const =0 |
The operator returns a pointer to a copy of itself. | |
virtual std::string | str () const =0 |
Returns an identification string describing the operator, e.g. exp, sin, cos, ... | |
virtual numeric_type | apply (numeric_type value) const |
Applys the operator to the provided value. Unary operators must overwrite this function. | |
virtual numeric_type | apply (numeric_type lhs, numeric_type rhs) const |
Applys the operator to the left hand side 'lhs' and the right hand side 'rhs'. Binary operators must overwrite this function. | |
virtual bool | is_unary () const |
A boolean flag that specifies whether the operator is an unary operator, i.e. taking one argument only. | |
virtual InterfaceType * | diff (const InterfaceType *e, const InterfaceType *diff_var) const |
Interface for differentation of a unary expression. | |
virtual InterfaceType * | diff (const InterfaceType *lhs, const InterfaceType *rhs, const InterfaceType *diff_var) const |
Interface for differentation of a binary expression. | |
virtual InterfaceType * | simplify (const InterfaceType *lhs, const InterfaceType *rhs) const =0 |
Interface for the simplification of a binary expression by passing the two operands. | |
virtual bool | can_simplify () const =0 |
Returns true if the unary expression can be simplified. | |
virtual bool | can_simplify (const InterfaceType *lhs, const InterfaceType *rhs) const |
Returns true if the binary expression can be simplified. | |
virtual bool | equal (const op_interface *other) const =0 |
Returns true if 'other' is the same operation as the respective object. |
The abstract runtime interface for all operations (unary and binary).
InterfaceType | The expression runtime interface. Usually rt_expression_interface, but extensions are possible. |
typedef InterfaceType::numeric_type numeric_type |
Reimplemented in op_binary< BinaryOperation, InterfaceType >, and op_unary< UnaryOperation, InterfaceType >.
virtual ~op_interface | ( | ) | [inline, virtual] |
virtual numeric_type apply | ( | numeric_type | value | ) | const [inline, virtual] |
Applys the operator to the provided value. Unary operators must overwrite this function.
Reimplemented in op_unary< UnaryOperation, InterfaceType >.
virtual numeric_type apply | ( | numeric_type | lhs, | |
numeric_type | rhs | |||
) | const [inline, virtual] |
Applys the operator to the left hand side 'lhs' and the right hand side 'rhs'. Binary operators must overwrite this function.
virtual bool can_simplify | ( | ) | const [pure virtual] |
Returns true if the unary expression can be simplified.
Implemented in op_binary< BinaryOperation, InterfaceType >, and op_unary< UnaryOperation, InterfaceType >.
virtual bool can_simplify | ( | const InterfaceType * | lhs, | |
const InterfaceType * | rhs | |||
) | const [inline, virtual] |
Returns true if the binary expression can be simplified.
Reimplemented in op_binary< BinaryOperation, InterfaceType >.
virtual op_interface* clone | ( | ) | const [pure virtual] |
The operator returns a pointer to a copy of itself.
Implemented in op_binary< BinaryOperation, InterfaceType >, and op_unary< UnaryOperation, InterfaceType >.
virtual InterfaceType* diff | ( | const InterfaceType * | lhs, | |
const InterfaceType * | rhs, | |||
const InterfaceType * | diff_var | |||
) | const [inline, virtual] |
Interface for differentation of a binary expression.
Reimplemented in op_binary< BinaryOperation, InterfaceType >.
virtual InterfaceType* diff | ( | const InterfaceType * | e, | |
const InterfaceType * | diff_var | |||
) | const [inline, virtual] |
Interface for differentation of a unary expression.
Reimplemented in op_unary< UnaryOperation, InterfaceType >.
virtual bool equal | ( | const op_interface< InterfaceType > * | other | ) | const [pure virtual] |
Returns true if 'other' is the same operation as the respective object.
virtual bool is_unary | ( | ) | const [inline, virtual] |
A boolean flag that specifies whether the operator is an unary operator, i.e. taking one argument only.
Reimplemented in op_binary< BinaryOperation, InterfaceType >, and op_unary< UnaryOperation, InterfaceType >.
virtual InterfaceType* simplify | ( | const InterfaceType * | lhs, | |
const InterfaceType * | rhs | |||
) | const [pure virtual] |
Interface for the simplification of a binary expression by passing the two operands.
Implemented in op_binary< BinaryOperation, InterfaceType >, and op_unary< UnaryOperation, InterfaceType >.
virtual std::string str | ( | ) | const [pure virtual] |
Returns an identification string describing the operator, e.g. exp, sin, cos, ...
Implemented in op_binary< BinaryOperation, InterfaceType >, and op_unary< UnaryOperation, InterfaceType >.