OpenCurves
0.9
|
Supports multiple bindings of the same expression to different curves. More...
#include <plotbindingtracker.h>
Public Member Functions | |
PlotBindingTracker () | |
Create an empty biding. | |
PlotInstance * | firstPlot () const |
Request the first bound PlotInstance in the tree. More... | |
void | setFirstPlot (PlotInstance *plot) |
Set the first bound PlotInstance in the tree. More... | |
void | setFirstPlotIf (PlotInstance *plot) |
Set the first bound PlotInstance so long as it is not already set. More... | |
void | clearFirstPlot () |
Clear firstPlot() . | |
void | setMarker (const PlotExpression *expr, unsigned marker) |
Set the arbitrary marker value for expr . More... | |
bool | markerFor (const PlotExpression *expr, unsigned &marker) const |
Request the marker value for expr . More... | |
bool | contains (const PlotExpression *expr) const |
Checks if a marker is present for expr . More... | |
void | setHold (const PlotExpression *expr, bool hold=true) |
Set the flag indicating expr should not progress its marker. More... | |
bool | isHeld (const PlotExpression *expr) const |
Is expr being held? More... | |
bool | clear (const PlotExpression *expr) |
Clear marker and hold flag for expr . More... | |
Supports multiple bindings of the same expression to different curves.
This class tracks the state of expressions supporting multiple bindings, allowing each expression to maintain its own binding marker, or index.
The class supports multiple binding by:
firstPlot()
as the first bound PlotInstance
in the tree.PlotExpression
in the tree.PlotExpression
to mark itself as "held", implying it should keep its binding and marker the same as for its last binding.The marker usage depends on the PlotExpression
implementation. A simple implementation is to use the marker as the index of the last curve bound in the PlotExpression::bind()
curves
argument. The marker should only be progressed if isHeld()
is false for an expression.
See PlotExpression
for further details on multi-binding.
bool PlotBindingTracker::clear | ( | const PlotExpression * | expr | ) |
Clear marker and hold flag for expr
.
expr | The expression of interest. |
bool PlotBindingTracker::contains | ( | const PlotExpression * | expr | ) | const |
Checks if a marker is present for expr
.
expr | The expression to search for a marker for. |
expr
.
|
inline |
Request the first bound PlotInstance
in the tree.
PlotInstance
. bool PlotBindingTracker::isHeld | ( | const PlotExpression * | expr | ) | const |
Is expr
being held?
expr | The expression of interest. |
bool PlotBindingTracker::markerFor | ( | const PlotExpression * | expr, |
unsigned & | marker | ||
) | const |
Request the marker value for expr
.
expr | The expression to get the marker for. | |
[out] | marker | Set to the marker value of expr if available. |
marker
is valid.
|
inline |
Set the first bound PlotInstance
in the tree.
Prefer to use setFirstPlotIf()
.
plot | The new plot. |
|
inline |
Set the first bound PlotInstance
so long as it is not already set.
plot | The new plot. |
void PlotBindingTracker::setHold | ( | const PlotExpression * | expr, |
bool | hold = true |
||
) |
Set the flag indicating expr
should not progress its marker.
expr | The expression of interest. |
hold | True to hold, false to release. |
void PlotBindingTracker::setMarker | ( | const PlotExpression * | expr, |
unsigned | marker | ||
) |
Set the arbitrary marker value for expr
.
expr | The expression to set the marker for. |
marker | The marker value. |