OpenCurves  0.9
Curves Class Reference

The data model for loaded plots and curves. More...

#include <curves.h>

Inheritance diagram for Curves:

Classes

class  CurveList
 A thread safe capture of a list of curves internal to a Curves object. More...
 

Public Slots

void newCurve (PlotInstance *curve)
 Add a new curve to the list of curves. More...
 
void completeLoading (PlotInstance *curve)
 Signals successful completion of curve. It is no longer in the loading state.
 
bool removeCurve (const PlotInstance *curve)
 Removes and deletes curve. More...
 
void invalidate (const PlotInstance *curve)
 Invalidates curve by raising the curveDataChanged() signal. More...
 
void invalidate (const PlotSource *source, bool invalidateCurves=false)
 Invalidates source by raising the curveSourceDataChanged() signal. More...
 
void clearCurves ()
 Clears all curve data.
 
bool migrateLoadingData ()
 Migrates data from the back buffer of loading curves into the main display buffer. More...
 

Signals

void curveAdded (PlotInstance *curve)
 Signals a curve is added (in the loading state). More...
 
void curveComplete (PlotInstance *curve)
 Signals that loading of a curve has finished. More...
 
void curveDataChanged (const PlotInstance *curve)
 Signals that a curve has changed its data content. More...
 
void curveRemoved (const PlotInstance *curve)
 Signals removal of a curve (and deletion). More...
 
void sourceDataChanged (const PlotSource *source)
 Signals that a PlotSource has changed its data content - generally it's timing data. More...
 
void curvesCleared ()
 Signals all curve data has been cleared.
 
void loadingComplete ()
 Signals that all loading curves have completed loading.
 

Public Member Functions

 Curves (QObject *parent=nullptr)
 Create a curves data model. More...
 
 ~Curves ()
 Destructor. Cleans up all owned curves.
 
CurveList curves () const
 Retrieve the complete list of curves, loading or loaded. More...
 
CurveList loadingCurves () const
 Retrieve the complete list of loading curves. More...
 
CurveList realTimeCurves () const
 Retrieve the complete list of real-time curves. More...
 
unsigned removeUsingExpression (const PlotExpression *expression)
 Remove all the curves which where generated from expression. More...
 
void enumerateFileSources (QStringList &filePaths) const
 Enumerates the source files from which curves have been loaded.
 
void enumerateSources (QList< PlotSource * > &sources, unsigned type) const
 Enumerates all sources of the requested type. More...
 
const VariantMap & curvePropertiesMap () const
 Retrieve the curve properties map for pending curves. More...
 
void setCurvePropertiesMap (VariantMap &map)
 Set the curve properties map. More...
 
bool isLoading (const PlotInstance *curve) const
 Checks if the given curve is loading. More...
 

Detailed Description

The data model for loaded plots and curves.

Curves are added in the loading state via newCurve() and are considered to be loading. Loading curves are expected to be populated in the background and data are migrated via PlotInstance::migrateBuffer().

Once loaded, a curve no longer has data migrated.

The Curves object is designed to be thread safe to support background loading. This includes delayed destruction of PlotInstance objects as they may be accessed from different threads.

Constructor & Destructor Documentation

Curves::Curves ( QObject *  parent = nullptr)

Create a curves data model.

Parameters
parentThe owning object.

Member Function Documentation

void Curves::curveAdded ( PlotInstance curve)
signal

Signals a curve is added (in the loading state).

Parameters
curveCurve of interest.
void Curves::curveComplete ( PlotInstance curve)
signal

Signals that loading of a curve has finished.

Parameters
curveCurve of interest.
void Curves::curveDataChanged ( const PlotInstance curve)
signal

Signals that a curve has changed its data content.

Parameters
curveCurve of interest.
const VariantMap& Curves::curvePropertiesMap ( ) const
inline

Retrieve the curve properties map for pending curves.

This is as a direct consequence of supporting the potential loading delay in bookmarks::restoreBookmark(). See that function for details.

Returns
The current properties map.
void Curves::curveRemoved ( const PlotInstance curve)
signal

Signals removal of a curve (and deletion).

Parameters
curveThe removed and deleted curve.
CurveList Curves::curves ( ) const

Retrieve the complete list of curves, loading or loaded.

Returns
The list of curves.
void Curves::enumerateSources ( QList< PlotSource * > &  sources,
unsigned  type 
) const

Enumerates all sources of the requested type.

Parameters
sourcesList to append to.
typeSource type to match.
void Curves::invalidate ( const PlotInstance curve)
slot

Invalidates curve by raising the curveDataChanged() signal.

Parameters
curveThe curve to invalidate.
void Curves::invalidate ( const PlotSource source,
bool  invalidateCurves = false 
)
slot

Invalidates source by raising the curveSourceDataChanged() signal.

May also invalidate the assocaited PlotInstance objects by calling invalidate(const PlotInstance *) for each one.

Parameters
sourceThe source to invalidate. Exits if null.
invalidateCurvesTrue to invalidate each associated PlotInstance.
bool Curves::isLoading ( const PlotInstance curve) const

Checks if the given curve is loading.

Parameters
curveThe curve of interest. Handles null.
Returns
True if curve is loading.
CurveList Curves::loadingCurves ( ) const

Retrieve the complete list of loading curves.

Returns
The list of loading curves.
bool Curves::migrateLoadingData ( )
slot

Migrates data from the back buffer of loading curves into the main display buffer.

Invokes PlotInstance::migrateBuffer() for each loading curve.

Returns
True if some data have been migrated, false when there is nothing to migrate.
void Curves::newCurve ( PlotInstance curve)
slot

Add a new curve to the list of curves.

The curve is considered to be in the loading state.

The curve is added to the curves() and loadingCurves() lists. This call must be followed by either by a call to curveComplete() or to removeCurve().

CurveList Curves::realTimeCurves ( ) const

Retrieve the complete list of real-time curves.

Returns
The list of real-time curves.
bool Curves::removeCurve ( const PlotInstance curve)
slot

Removes and deletes curve.

Parameters
curveThe curve to remove.
Returns
True if the curve was tracked and has been removed.
unsigned Curves::removeUsingExpression ( const PlotExpression expression)

Remove all the curves which where generated from expression.

Parameters
expressionThe expression to look for.
Returns
The number of curves removed.
void Curves::setCurvePropertiesMap ( VariantMap &  map)

Set the curve properties map.

Affects existing and future curves.

This is as a direct consequence of supporting the potential loading delay in bookmarks::restoreBookmark(). See that function for details.

Parameters
mapThe properties map.
void Curves::sourceDataChanged ( const PlotSource source)
signal

Signals that a PlotSource has changed its data content - generally it's timing data.

Parameters
sourcePlot source of interest.

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