6 #ifndef __PLOTSAMPLE_H_
7 #define __PLOTSAMPLE_H_
9 #include "plotsconfig.h"
11 #include "plotexpression.h"
33 inline PlotSampleId(
const QString &name = QString(),
char quote =
'\0',
bool regex =
false)
34 : name(name), quote(quote), regex(regex) {
fixQuote(); }
40 : name(name), quote(
'\0'), regex(regex) {
fixQuote(); }
45 : name(other.name), quote(other.quote), regex(other.regex) { }
49 inline operator bool()
const {
return !name.isEmpty(); }
53 inline bool operator !()
const {
return name.isEmpty(); }
101 PlotSample(
const QString &curveName,
bool curveRegularExpression =
false);
108 PlotSample(
const QString &curveName,
const QString &fileName,
bool curveRegularExpression =
false,
bool fileRegularExpression =
false);
129 virtual double sample(
double sampleTime)
const;
153 virtual QString stringExpression()
const;
173 static bool nameMatch(
const QString &name,
const QString &searchName,
const QRegExp *re =
nullptr);
179 mutable unsigned int _previousSample;
182 #endif // __PLOTSAMPLE_H_
virtual BindResult bind(const QList< PlotInstance * > &curves, PlotBindingTracker &bindTracker, PlotExpressionBindDomain &info, bool repeatLastBinding=false)
Attempts to bind to a curve mathcing curveName().
virtual PlotExpression * clone() const
Creates a deep copy of this object.
An adaptor class converting from PlotInstance data to QwtSeriesData.
Definition: plotinstancesampler.h:24
Supports multiple bindings of the same expression to different curves.
Definition: plotbindingtracker.h:34
PlotSample(const QString &curveName, bool curveRegularExpression=false)
Create a PlotSample which matches just a curve name in binding.
Details how an expression is referencing a plot sample.
Definition: plotsample.h:23
char quote
The quote char parsed to define the ID.
Definition: plotsample.h:26
bool regex
True if name is a regular expression.
Definition: plotsample.h:27
PlotSampleId(const QString &name=QString(), char quote= '\0', bool regex=false)
Constructor.
Definition: plotsample.h:33
Core data for binding a PlotExpression.
Definition: plotexpressionbinddomain.h:49
Holds data for a single curve.
Definition: plotinstance.h:43
BindResult
Return values for the PlotExpression::bind() method.
Definition: plotexpressionbinddomain.h:15
PlotSampleId(const PlotSampleId &other)
Copy constructor.
Definition: plotsample.h:44
QTextStream & operator<<(QTextStream &stream, const PlotSampleId &sid)
Stream operator for writing a PlotSampleId to QTextStream.
QString name
The plot name or regular expression.
Definition: plotsample.h:25
This expression class binds and references an existing curve.
Definition: plotsample.h:95
PlotSampleId(const QString &name, bool regex)
Constructor for unquoted references.
Definition: plotsample.h:39
bool operator!() const
Negation operator: true if not set.
Definition: plotsample.h:53
A PlotExpression represents an operation in a plot equation.
Definition: plotexpression.h:91
void fixQuote()
Ensures the quote character is set for regular expressions, defaulting to (').
Definition: plotsample.h:56
virtual void unbind()
Releases the current binding (if any).
virtual double sample(double sampleTime) const
Called to generate a sample at sampleTime.