OpenCurves  0.9
PlotIndexExpression Class Reference

An expression to index into an expression. More...

#include <plotindexexpression.h>

Inheritance diagram for PlotIndexExpression:
PlotBinaryOperator PlotExpression

Public Member Functions

 PlotIndexExpression (PlotExpression *indexee, PlotExpression *indexer)
 Creates an index expression using indexer to index into indexee. More...
 
virtual double sample (double sampleTime) const
 Samples the index expression for sampleTime. More...
 
virtual PlotExpressionclone () const
 Clones this expression. More...
 
- Public Member Functions inherited from PlotBinaryOperator
 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 PlotExpressionleft () const
 Get the left branch. More...
 
void setRight (PlotExpression *right)
 Set the right branch. More...
 
const PlotExpressionright () 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...
 
- Public Member Functions inherited from PlotExpression
 PlotExpression ()
 Empty constructor.
 
virtual ~PlotExpression ()
 Empty, virtual destructor.
 
QString toString () const
 Converts the PlotExpression into a parseable string form. More...
 

Detailed Description

An expression to index into an expression.

This essentially uses the results from one expression as the sample time for another. PlotBinaryOperator is derived for convenience and the right expression makes the index or sample value, while the left expression is the indexed expression.

Out of range sample times are returned as a zero value.

Constructor & Destructor Documentation

PlotIndexExpression::PlotIndexExpression ( PlotExpression indexee,
PlotExpression indexer 
)
inline

Creates an index expression using indexer to index into indexee.

Parameters
indexeeExpression to index into. Stored as left().
indexerExpression to calculate the index. Stored as right().

Member Function Documentation

virtual PlotExpression* PlotIndexExpression::clone ( ) const
virtual

Clones this expression.

Returns
A deep copy of this expression.

Implements PlotExpression.

virtual double PlotIndexExpression::sample ( double  sampleTime) const
virtual

Samples the index expression for sampleTime.

This resolves the value of right() using sampleTime and uses the result as a sample time into left().

Parameters
sampleTimeThe sample time to for right().
Returns
A sample, calculated as: left()->sample(right()->sample(sampleTime))

Implements PlotExpression.


The documentation for this class was generated from the following file: