OpenCurves  0.9
PlotSample Class Reference

This expression class binds and references an existing curve. More...

#include <plotsample.h>

Inheritance diagram for PlotSample:
PlotExpression

Public Member Functions

 PlotSample (const QString &curveName, bool curveRegularExpression=false)
 Create a PlotSample which matches just a curve name in binding. More...
 
 PlotSample (const QString &curveName, const QString &fileName, bool curveRegularExpression=false, bool fileRegularExpression=false)
 Create a PlotSample which matches a curve name and file name in binding. More...
 
 PlotSample (const PlotSampleId &curveId, const PlotSampleId &fileId=PlotSampleId())
 Create a PlotSample which matches a curve name and file name in binding. More...
 
 PlotSample (const PlotSample &other)
 Copy constructor, including copying the current binding. More...
 
 ~PlotSample ()
 Destructor.
 
virtual double sample (double sampleTime) const
 Called to generate a sample at sampleTime. More...
 
virtual BindResult bind (const QList< PlotInstance * > &curves, PlotBindingTracker &bindTracker, PlotExpressionBindDomain &info, bool repeatLastBinding=false)
 Attempts to bind to a curve mathcing curveName(). More...
 
virtual void unbind ()
 Releases the current binding (if any).
 
virtual PlotExpressionclone () const
 Creates a deep copy of this object. 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...
 
virtual bool explicitTime () const
 Is the curve generated with explicit time values? More...
 

Detailed Description

This expression class binds and references an existing curve.

This is the primary data source in the PlotExpression trees, where most other expressions modify existing expressions. This class binds and samples a PlotInstance.

The bind() method is implemented to bind the next appropriate PlotInstance and report its domain in a PlotExpressionBindDomain. Repeated binding is supported through the PlotBindTracker. The sample() method then returns data sampled from the currently bound PlotInstance object.

The binding logic may match just the curve name or the curve and source names. Source names will only match file sources. The binding logic may optionally use regular expression binding for either name or source. The minimal binding identification requires just the curve name match.

Uses PlotInstanceSampler for sampling.

A PlotSample object can only be bound to a single PlotInstance at a time.

Constructor & Destructor Documentation

PlotSample::PlotSample ( const QString &  curveName,
bool  curveRegularExpression = false 
)

Create a PlotSample which matches just a curve name in binding.

Parameters
curveNameThe curve name to match.
curveRegularExpressionTrue if curveName is a regular expression.
PlotSample::PlotSample ( const QString &  curveName,
const QString &  fileName,
bool  curveRegularExpression = false,
bool  fileRegularExpression = false 
)

Create a PlotSample which matches a curve name and file name in binding.

Parameters
curveNameThe curve name to match.
fileNameThe source name to match against available file sources.
curveRegularExpressionTrue if curveName is a regular expression.
fileRegularExpressionTrue if fileName is a regular expression.
PlotSample::PlotSample ( const PlotSampleId curveId,
const PlotSampleId fileId = PlotSampleId() 
)

Create a PlotSample which matches a curve name and file name in binding.

Parameters
curveIdThe curve ID to match.
fileIdThe source ID to match against available file sources.
PlotSample::PlotSample ( const PlotSample other)

Copy constructor, including copying the current binding.

Parameters
otherThe object to copy.

Member Function Documentation

virtual BindResult PlotSample::bind ( const QList< PlotInstance * > &  curves,
PlotBindingTracker bindTracker,
PlotExpressionBindDomain info,
bool  repeatLastBinding = false 
)
virtual

Attempts to bind to a curve mathcing curveName().

The binding supports regular expressions in both source and curve names, or exact matches, with the source name optional. In either case, only PlotSource::File type sources are accepted with sources of all other types ignored.

Repeated bindings are managed via the bindTracker.

Returns
True on successful binding. Do not call sample() unless binding succeeds.

Implements PlotExpression.

virtual PlotExpression* PlotSample::clone ( ) const
virtual

Creates a deep copy of this object.

Returns
A deep copy.

Implements PlotExpression.

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

Called to generate a sample at sampleTime.

The implementation is optimised for sequential sampling and provides linearly interpolated points between true sample points.

Parameters
sampleTimeThe time to sample the expression at.
Returns
The calculated sample at sampleTime.

Implements PlotExpression.


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