Workspace 6.21.5
Public Member Functions | List of all members
StandardDataSeries< T, Evaluator > Class Template Reference

Template subclass of DataSeries for things that act like std::vector. More...

#include <DataAnalysis/DataStructures/dataseries.h>

Inheritance diagram for StandardDataSeries< T, Evaluator >:
[legend]

Public Member Functions

 StandardDataSeries ()
 
 StandardDataSeries (const Evaluator &evaluator)
 
 StandardDataSeries (const StandardDataSeries &series)
 
 StandardDataSeries (T *array, bool ownsData)
 
 ~StandardDataSeries () override
 
StandardDataSeriesclone () const override
 
void destroy () override
 
bool empty () const override
 
double operator[] (int i) const override
 
void setData (T *d, bool ownsData)
 
unsigned size () const override
 
- Public Member Functions inherited from DataSeries
 ~DataSeries () override=default
 
double back () const
 
const_iterator begin () const
 
DataSeriesclone () const override=0
 
virtual void destroy ()=0
 
virtual bool empty () const =0
 
const_iterator end () const
 
double front () const
 
bool isInfinite () const
 
 operator QVector< double > () const
 
virtual double operator[] (int i) const =0
 
virtual unsigned size () const =0
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 

Detailed Description

template<typename T, typename Evaluator = DataSeriesEvaluator<typename T::value_type>>
class CSIRO::DataAnalysis::StandardDataSeries< T, Evaluator >
Template Parameters
TA std::vector-like type (QVector is also similar).
EvaluatorPolicy for how to get a double from a particular element of the array. The default will rely on the element type having an automatic conversion to double.

This class assumes that the template type T is similar to std::vector or QVector. It implements all the required functions of a DataSeries using only some common functions from those two types. The main benefit of using this class is that if the type T acts like a std::vector, then making it available as a DataSeries is as simple as instantiating this template with that type.

For some cases, the array might hold data types that do not have an automatic conversion to double. In such cases, the Evaluator can be set to a custom type that performs the conversion, or if the conversion makes sense in all cases, the DataSeriesEvaluator template class can be given an explicit specialization for that type.

Constructor & Destructor Documentation

◆ StandardDataSeries() [1/4]

StandardDataSeries ( )
inline

◆ StandardDataSeries() [2/4]

StandardDataSeries ( const Evaluator &  evaluator)
inline

◆ StandardDataSeries() [3/4]

StandardDataSeries ( const StandardDataSeries< T, Evaluator > &  series)
inline

◆ StandardDataSeries() [4/4]

StandardDataSeries ( T *  array,
bool  ownsData 
)
inline

◆ ~StandardDataSeries()

~StandardDataSeries ( )
inlineoverride

Member Function Documentation

◆ clone()

StandardDataSeries * clone ( ) const
inlineoverridevirtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

Note that this implementation of clone should not clone the underlying data of the series. Rather, just the interface to it should be cloned. This is important, because workspaces will frequently pass around clones of DataSeries objects like handles to the underlying data which could be expensive to copy.

Implements DataSeries.

◆ destroy()

void destroy ( )
inlineoverridevirtual

Implements DataSeries.

◆ empty()

bool empty ( ) const
inlineoverridevirtual

Implements DataSeries.

◆ operator[]()

double operator[] ( int  i) const
inlineoverridevirtual

Implements DataSeries.

◆ setData()

void setData ( T *  d,
bool  ownsData 
)
inline

◆ size()

unsigned size ( ) const
inlineoverridevirtual

Implements DataSeries.