OpenCurves
0.9
|
A template binary operator, using a functional object to evaluate the expression. More...
#include <plotbinaryoperator.h>
Public Member Functions | |
PlotBinaryOperatorT () | |
Default constructor: left and right are null. | |
PlotBinaryOperatorT (PlotExpression *left, PlotExpression *right, const QString &opstr=QString()) | |
Branched constructor. More... | |
virtual double | sample (double sampleTime) const |
Sample the branches and evaluate the results. More... | |
const QString & | opStr () const |
Return the string used to combine left and right branches. More... | |
void | setOpStr (const QString &str) |
Sets the string used to combine left and right branches. More... | |
virtual PlotExpression * | clone () const |
Deep clone. | |
![]() | |
PlotBinaryOperator (PlotExpression *left, PlotExpression *right) | |
Create a binary operator on the given left and right expressions. More... | |
~PlotBinaryOperator () | |
Destructor, destroying left and right. | |
void | setLeft (PlotExpression *left) |
Set the left branch. More... | |
const PlotExpression * | left () const |
Get the left branch. More... | |
void | setRight (PlotExpression *right) |
Set the right branch. More... | |
const PlotExpression * | right () const |
Get the right branch. More... | |
virtual BindResult | bind (const QList< PlotInstance * > &curves, PlotBindingTracker &bindTracker, PlotExpressionBindDomain &domain, bool repeatLastBinding=false) |
Binds the left and right branch expressions. More... | |
virtual void | unbind () |
Unbind left and right branches. | |
bool | explicitTime () const override |
Is the generated expression sensitive to changes in the time domain? More... | |
![]() | |
PlotExpression () | |
Empty constructor. | |
virtual | ~PlotExpression () |
Empty, virtual destructor. | |
QString | toString () const |
Converts the PlotExpression into a parseable string form. More... | |
A template binary operator, using a functional object to evaluate the expression.
This class extends the PlotBinaryOperator
to create a concrete derivation which uses Operator
evaluate the expression. The Operator
type must be an object supporting the bracket operator accepting two double
arguments and returning a double
. The operator performs the expression calculations. For example, std::plus<double>
.
As a convenience, the object supports a opStr()
, which is used when toString()
is called. Essentially, the complete string is formed by: left->toString() + opStr() + right->toString()
.
Operator | The functional object used to evaluate the expression. |
|
inline |
Branched constructor.
left | The left branch. |
right | The right branch. |
opstr | The string used to combine the branches when toString() is called. |
|
inline |
Return the string used to combine left and right branches.
|
inlinevirtual |
Sample the branches and evaluate the results.
Evaluates left
and right
branches at sampleTime
, and passes the results to Operator
for evaluation. Returns the result.
sampleTime | The time to sample at. |
Operator
. Implements PlotExpression.
|
inline |
Sets the string used to combine left and right branches.
str | The operation string. |
Referenced by PlotBinaryOperatorT< std::minus< double > >::clone().