OpenCurves  0.9
PlotUnaryOperatorT< Operator > Class Template Reference

A template unary operator, using a functional object to evaluate the expression. More...

#include <plotunaryoperator.h>

Inheritance diagram for PlotUnaryOperatorT< Operator >:
PlotUnaryOperator PlotExpression

Public Member Functions

 PlotUnaryOperatorT ()
 Default constructor: operand is null.
 
 PlotUnaryOperatorT (PlotExpression *operand)
 Constructor. More...
 
virtual double sample (double sampleTime) const
 Sample the operand and evaluate the Operator. More...
 
const QString & opStr () const
 Return the string used to prefix the operand. More...
 
void setOpStr (const QString &str)
 Sets the string used to prefix the operand. More...
 
virtual PlotExpressionclone () const
 Deep clone.
 
- Public Member Functions inherited from PlotUnaryOperator
 PlotUnaryOperator (PlotExpression *operand)
 Create a binary operator on the given left and right expressions. More...
 
 ~PlotUnaryOperator ()
 Destructor, destroying the child.
 
void setOperand (PlotExpression *operand)
 Set the operand expression. More...
 
const PlotExpressionoperand () const
 Get the operand expression. More...
 
virtual BindResult bind (const QList< PlotInstance * > &curves, PlotBindingTracker &bindTracker, PlotExpressionBindDomain &domain, bool repeatLastBinding=false)
 Binds the operand expression.
 
virtual void unbind ()
 Unbind the operand.
 
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

template<class Operator>
class PlotUnaryOperatorT< Operator >

A template unary operator, using a functional object to evaluate the expression.

This class extends the PlotUnaryOperator to create a concrete derivation which uses Operator evaluate the expression. The Operator type must be an object supporting the bracket operator accepting one double argument and returning a double. The operator performs the expression calculations. For example, std::negate<double>.

As a convenience, the object supports a opStr(), which is used when toString() is called. Essentially, the complete string is formed by: opStr() + operand()->toString().

Template Parameters
OperatorThe functional object used to evaluate the expression.

Constructor & Destructor Documentation

template<class Operator>
PlotUnaryOperatorT< Operator >::PlotUnaryOperatorT ( PlotExpression operand)
inline

Constructor.

Parameters
operandOperand expression.

Member Function Documentation

template<class Operator>
const QString& PlotUnaryOperatorT< Operator >::opStr ( ) const
inline

Return the string used to prefix the operand.

Returns
The operation string (e.g., "-" for negation).
template<class Operator>
virtual double PlotUnaryOperatorT< Operator >::sample ( double  sampleTime) const
inlinevirtual

Sample the operand and evaluate the Operator.

Evaluates operand at sampleTime, and passes the result to Operator for evaluation.

Parameters
sampleTimeThe time to sample at.
Returns
The operand samples filtered through Operator.

Implements PlotExpression.

template<class Operator>
void PlotUnaryOperatorT< Operator >::setOpStr ( const QString &  str)
inline

Sets the string used to prefix the operand.

Parameters
strThe operation string.

Referenced by PlotUnaryOperatorT< std::negate< double > >::clone().


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