6 #ifndef PLOTBINARYOPERATOR_H_
7 #define PLOTBINARYOPERATOR_H_
9 #include "plotsconfig.h"
11 #include "plotexpression.h"
13 #include <QTextStream>
28 : _left(left), _right(right) {}
81 template <
class Operator>
103 virtual inline double sample(
double sampleTime)
const
110 inline const QString &
opStr()
const {
return _opStr; }
114 inline void setOpStr(
const QString &str) { _opStr = str; }
127 virtual QString stringExpression()
const
130 QTextStream stream(&str);
138 #endif // PLOTBINARYOPERATOR_H_
const PlotExpression * right() const
Get the right branch.
Definition: plotbinaryoperator.h:47
Supports multiple bindings of the same expression to different curves.
Definition: plotbindingtracker.h:34
virtual PlotExpression * clone() const
Deep clone.
Definition: plotbinaryoperator.h:117
void setLeft(PlotExpression *left)
Set the left branch.
Definition: plotbinaryoperator.h:35
virtual double sample(double sampleTime) const
Sample the branches and evaluate the results.
Definition: plotbinaryoperator.h:103
An extension of PlotExpression defining a binary operation.
Definition: plotbinaryoperator.h:21
virtual BindResult bind(const QList< PlotInstance * > &curves, PlotBindingTracker &bindTracker, PlotExpressionBindDomain &domain, bool repeatLastBinding=false)
Binds the left and right branch expressions.
Core data for binding a PlotExpression.
Definition: plotexpressionbinddomain.h:49
PlotBinaryOperatorT(PlotExpression *left, PlotExpression *right, const QString &opstr=QString())
Branched constructor.
Definition: plotbinaryoperator.h:92
bool explicitTime() const override
Is the generated expression sensitive to changes in the time domain?
virtual PlotExpression * clone() const =0
Performs a deep clone of the PlotExpression.
BindResult
Return values for the PlotExpression::bind() method.
Definition: plotexpressionbinddomain.h:15
PlotBinaryOperatorT()
Default constructor: left and right are null.
Definition: plotbinaryoperator.h:86
QString toString() const
Converts the PlotExpression into a parseable string form.
Definition: plotexpression.h:147
const PlotExpression * left() const
Get the left branch.
Definition: plotbinaryoperator.h:39
const QString & opStr() const
Return the string used to combine left and right branches.
Definition: plotbinaryoperator.h:110
A template binary operator, using a functional object to evaluate the expression. ...
Definition: plotbinaryoperator.h:82
virtual void unbind()
Unbind left and right branches.
virtual double sample(double sampleTime) const =0
Called to generate a sample at sampleTime.
void setOpStr(const QString &str)
Sets the string used to combine left and right branches.
Definition: plotbinaryoperator.h:114
A PlotExpression represents an operation in a plot equation.
Definition: plotexpression.h:91
~PlotBinaryOperator()
Destructor, destroying left and right.
PlotBinaryOperator(PlotExpression *left, PlotExpression *right)
Create a binary operator on the given left and right expressions.
Definition: plotbinaryoperator.h:27
void setRight(PlotExpression *right)
Set the right branch.
Definition: plotbinaryoperator.h:43