OpenCurves  0.9
PlotBindingTracker Class Reference

Supports multiple bindings of the same expression to different curves. More...

#include <plotbindingtracker.h>

Public Member Functions

 PlotBindingTracker ()
 Create an empty biding.
 
PlotInstancefirstPlot () 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...
 

Detailed Description

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:

  • Setting firstPlot() as the first bound PlotInstance in the tree.
  • Associating an arbitrary marker with each PlotExpression in the tree.
  • Allowing a 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.

Member Function Documentation

bool PlotBindingTracker::clear ( const PlotExpression expr)

Clear marker and hold flag for expr.

Parameters
exprThe expression of interest.
bool PlotBindingTracker::contains ( const PlotExpression expr) const

Checks if a marker is present for expr.

Parameters
exprThe expression to search for a marker for.
Returns
True if there is a marker set for expr.
PlotInstance* PlotBindingTracker::firstPlot ( ) const
inline

Request the first bound PlotInstance in the tree.

Returns
The first bound PlotInstance.
bool PlotBindingTracker::isHeld ( const PlotExpression expr) const

Is expr being held?

Parameters
exprThe expression of interest.
Returns
True if held.
bool PlotBindingTracker::markerFor ( const PlotExpression expr,
unsigned &  marker 
) const

Request the marker value for expr.

Parameters
exprThe expression to get the marker for.
[out]markerSet to the marker value of expr if available.
Returns
True if a marker had been set and marker is valid.
void PlotBindingTracker::setFirstPlot ( PlotInstance plot)
inline

Set the first bound PlotInstance in the tree.

Prefer to use setFirstPlotIf().

Parameters
plotThe new plot.
void PlotBindingTracker::setFirstPlotIf ( PlotInstance plot)
inline

Set the first bound PlotInstance so long as it is not already set.

Parameters
plotThe new plot.
void PlotBindingTracker::setHold ( const PlotExpression expr,
bool  hold = true 
)

Set the flag indicating expr should not progress its marker.

Parameters
exprThe expression of interest.
holdTrue to hold, false to release.
void PlotBindingTracker::setMarker ( const PlotExpression expr,
unsigned  marker 
)

Set the arbitrary marker value for expr.

Parameters
exprThe expression to set the marker for.
markerThe marker value.

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