Workspace 6.21.5
Public Member Functions | Static Public Member Functions | List of all members
ArrayNdEmpty Class Reference

An empty implementation of an ArrayNd object which will be created by default for all DataObjects.

#include <DataAnalysis/DataStructures/arraynd.h>

Inheritance diagram for ArrayNdEmpty:
[legend]

Public Member Functions

 ArrayNdEmpty ()
 
bool arrayAccessHint (const NamedDimensionRangeList &range) override
 
ArrayNdEmptyclone () const override
 
const DataCollectiongetAttributes () const override
 
const DataExecution::DataFactorygetDataFactory () const override
 
int getDimensionIndex (const QString &name) const override
 
ArrayNdDimensionLabels getDimensionLabels (const QString &dimName) const override
 
QString getDimensionName (int index) const override
 
size_type getDimensionSize (const QString &name) const override
 
size_type getDimensionSize (int index) const override
 
double getFillValue () const override
 
QVariant getFillValueAsVariant () const override
 
QVariant getValue (const DimensionIndexList &dimIndices) const override
 
QVariant getValue (size_type dim0, size_type dim1=0, size_type dim2=0, size_type dim3=0, size_type dim4=0) const override
 
bool hasFillValue () const override
 
bool isDimensionUnlimited (int index) const override
 
int numDimensions () const override
 
double operator() (const DimensionIndexList &dimIndices) const override
 
double operator() (size_type dim0, size_type dim1=0, size_type dim2=0, size_type dim3=0, size_type dim4=0) const override
 
ArrayNdEmptyoperator= (const ArrayNdEmpty &other)=default
 
bool setDimensions (const NamedDimensionRangeList &dimensions) override
 
void setHasFillValue (bool b) override
 
- Public Member Functions inherited from ArrayNd
 ArrayNd ()
 
 ~ArrayNd () override
 
virtual bool arrayAccessHint (const NamedDimensionRangeList &range)=0
 
const_iterator begin () const
 
ArrayNdclone () const override=0
 
const_iterator end () const
 
NamedDimensionRangeList getAllDimensions () const
 
virtual const DataCollectiongetAttributes () const =0
 
template<typename T >
bool getData (const NamedDimensionRangeList &range, T *data) const
 
virtual const DataExecution::DataFactorygetDataFactory () const =0
 
NamedDimensionRange getDimension (const QString &name) const
 
virtual int getDimensionIndex (const QString &name) const =0
 
virtual ArrayNdDimensionLabels getDimensionLabels (const QString &dimensionName) const =0
 
virtual QString getDimensionName (int index) const =0
 
virtual size_type getDimensionSize (const QString &name) const =0
 
virtual size_type getDimensionSize (int index) const =0
 
virtual double getFillValue () const =0
 
virtual QVariant getFillValueAsVariant () const =0
 
template<typename T >
ArrayNdTyped< T > * getTypedInterface ()
 
template<typename T >
const ArrayNdTyped< T > * getTypedInterface () const
 
virtual QVariant getValue (const DimensionIndexList &dimIndices) const =0
 
virtual QVariant getValue (size_type dim0, size_type dim1=0, size_type dim2=0, size_type dim3=0, size_type dim4=0) const =0
 
virtual bool hasFillValue () const =0
 
virtual bool isDimensionUnlimited (int index) const =0
 
virtual int numDimensions () const =0
 
virtual double operator() (const DimensionIndexList &dimIndices) const =0
 
virtual double operator() (size_type dim0, size_type dim1=0, size_type dim2=0, size_type dim3=0, size_type dim4=0) const =0
 
const_iterator_range range (const NamedDimensionRangeList &range) const
 
virtual bool setDimensions (const NamedDimensionRangeList &dimensions)=0
 
template<typename T >
bool setFillValue (const T &value)
 
virtual void setHasFillValue (bool b)=0
 
template<typename T >
bool writeData (const NamedDimensionRangeList &range, const T *data)
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 

Static Public Member Functions

static ArrayNdEmptynullObject ()
 

Additional Inherited Members

- Public Types inherited from ArrayNd
typedef NamedDimensionRange::size_type size_type
 
- Protected Member Functions inherited from ArrayNd
 ArrayNd (ArrayNd &&other)
 
 ArrayNd (const ArrayNd &other)
 
ArrayNdoperator= (const ArrayNd &other)=default
 

Constructor & Destructor Documentation

◆ ArrayNdEmpty()

Member Function Documentation

◆ arrayAccessHint()

bool arrayAccessHint ( const NamedDimensionRangeList range)
overridevirtual
Parameters
rangeThe range we are expecting to read from when using the getValue or operator() functions.
Returns
true if the hint is valid, false if the dimensions or ranges were out of range.

The range we are hinting that we're about to access repeatedly through individual indexed reads (i.e. using the operator() function).

See also
operator()

Implements ArrayNd.

◆ clone()

ArrayNdEmpty * clone ( ) const
overridevirtual
Returns
Return a clone of the ArrayNd object. This may or may not require copying all of the underlying data, depending on how it is stored / referenced (for example, an implementation that is copy-on-write will not need to replicate data until it is modified.

Implements ArrayNd.

◆ getAttributes()

const DataCollection & getAttributes ( ) const
overridevirtual
Returns
Returns a data collection containing top-level attribute data attached to the ArrayNd. These attributes may include elements such as "units", "cell dimensions", "description" etc.

Implements ArrayNd.

◆ getDataFactory()

const DataExecution::DataFactory * getDataFactory ( ) const
overridevirtual
Returns
The data factory for the datatype stored by this ArrayNd object.

Implements ArrayNd.

◆ getDimensionIndex()

int getDimensionIndex ( const QString &  name) const
overridevirtual
Parameters
nameThe name of the dimension for which we wish to rerieve its index.
Returns
The index of the dimension in the dataset.

Implements ArrayNd.

◆ getDimensionLabels()

ArrayNdDimensionLabels getDimensionLabels ( const QString &  dimensionName) const
overridevirtual
Parameters
dimensionNameThe name of the dimension for which we wish to retrieve its labels.
Returns
The list of labels associated with the specified dimension.

Implements ArrayNd.

◆ getDimensionName()

QString getDimensionName ( int  index) const
overridevirtual
Parameters
indexThe index of the dimension for which we wish to retrieve its name.
Returns
The name of the specified dimension.

Implements ArrayNd.

◆ getDimensionSize() [1/2]

ArrayNd::size_type getDimensionSize ( const QString &  name) const
overridevirtual
Parameters
nameThe name of the dimension for which we wish to retrieve its size, i.e. the number of elements in the specified dimension.
Returns
The number of elements in the specified dimension.

Implements ArrayNd.

◆ getDimensionSize() [2/2]

ArrayNd::size_type getDimensionSize ( int  index) const
overridevirtual
Parameters
indexThe index of the dimension for which we wish to retrieve its size, i.e. the number of elements in the specified dimension.
Returns
The number of elements in the specified dimension.

Implements ArrayNd.

◆ getFillValue()

double getFillValue ( ) const
overridevirtual
Returns
The fill value used by the dataset.

The Fill Value of the dataset is used to indicate an 'empty' cell. Cells that do not contain any valid data, or data outside the known / valid range, will contain the fill value.

See also
hasFillValue
setHasFillValue
getFillValueAsVariant

Implements ArrayNd.

◆ getFillValueAsVariant()

QVariant getFillValueAsVariant ( ) const
overridevirtual
Returns
The fill value used by the dataset contained within a QVariant.

The Fill Value of the dataset is used to indicate an 'empty' cell. Cells that do not contain any valid data, or data outside the known / valid range, will contain the fill value.

See also
hasFillValue
setHasFillValue
getFillValueAsVariant

Implements ArrayNd.

◆ getValue() [1/2]

QVariant getValue ( const DimensionIndexList dimIndices) const
overridevirtual
Parameters
dimIndicesThe set of coordinates at which we wish to inspect the value. The coordinate indices are assumed to be in the same order as they are stored in the dataset.
Returns
The data value for the specified cell, wrapping in a QVariant

Retrieve a single value from the underlying dataset using array subscript notation. The number of parameters supplied must match the underlying dataset. It is up to the developer to ensure that this always occurs.

The dimensions must be provided in the same order as they are stored in the dataset. This can be queried using getDimensionIndex() This version of the function returns a QVariant which contains the specific underlying type that matches the dataset.

See also
getDimensionIndex()
arrayAccessHint()
getTypedInterface()

Implements ArrayNd.

◆ getValue() [2/2]

QVariant getValue ( size_type  dim0,
size_type  dim1 = 0,
size_type  dim2 = 0,
size_type  dim3 = 0,
size_type  dim4 = 0 
) const
overridevirtual
Parameters
dim0The index in the first dimension
dim1The index in the second dimension
dim2The index in the third dimension
dim3The index in the fourth dimension
dim4The index in the fifth dimension
Returns
A QVariant containing the value at the target coordinates in the dataset.

Retrieve a single value from the underlying dataset using array subscript notation. The number of parameters supplied MUST match the underlying dataset. It is up to the developer to ensure that this always occurs.

The dimensions must be provided in the same order as they are stored in the dataset. This can be queried using getDimensionIndex().

Note
If there are more than 5 dimensions in the dataset, is is recommended that you use the other overload of this function. All unspecified dimensions (i.e. dimensions at index 5 and above will be assumed as index zero).
See also
getDimensionIndex()
arrayAccessHint
getTypedInterface()

Implements ArrayNd.

◆ hasFillValue()

bool hasFillValue ( ) const
overridevirtual
Returns
True if the dataset has a fill value defined, false otherwise.

The Fill Value of the dataset is used to indicate an 'empty' cell. Cells that do not contain any valid data, or data outside the known / valid range, will contain the fill value. This function returns a value indicating whether or not a fill value is being used.

See also
setHasFillValue
getFillValue
getFillValueAsVariant.

Implements ArrayNd.

◆ isDimensionUnlimited()

bool isDimensionUnlimited ( int  index) const
overridevirtual
Parameters
indexThe index of the dimension we are inspecting.
Returns
true if the dimension is unlimited, false otherwise. An unlimited dimension is one that can by dynamically expanded "on write". For example, a time dimension where we do not know (up front) how many times there are going to be in the dataset, so we can create an "unlimited" dimension, and then repeatedly add to it.
Note
Not all ArrayNd implementations support unlimited dimensions, so in the majority of cases, this function will return false.

Implements ArrayNd.

◆ nullObject()

static ArrayNdEmpty & nullObject ( )
inlinestatic

◆ numDimensions()

int numDimensions ( ) const
overridevirtual
Returns
The number of dimensions in the dataset.

Implements ArrayNd.

◆ operator()() [1/2]

double operator() ( const DimensionIndexList dimIndices) const
overridevirtual
Parameters
dimIndicesThe set of coordinates at which we wish to inspect the value. The coordinate indices are assumed to be in the same order as they are stored in the dataset.
Returns
The data value for the specified cell, wrapping in a QVariant

Retrieve a single value from the underlying dataset using array subscript notation. The number of parameters supplied must match the underlying dataset. It is up to the developer to ensure that this always occurs.

The dimensions must be provided in the same order as they are stored in the dataset. This can be queried using getDimensionIndex()

See also
getDimensionIndex()
arrayAccessHint()
getTypedInterface()

Implements ArrayNd.

◆ operator()() [2/2]

double operator() ( size_type  dim0,
size_type  dim1 = 0,
size_type  dim2 = 0,
size_type  dim3 = 0,
size_type  dim4 = 0 
) const
overridevirtual
Parameters
dim0The index in the first dimension
dim1The index in the second dimension
dim2The index in the third dimension
dim3The index in the fourth dimension
dim4The index in the fifth dimension
Returns
A QVariant containing the value at the target coordinates in the dataset.

Retrieve a single value from the underlying dataset using array subscript notation. The number of parameters supplied MUST match the underlying dataset. It is up to the developer to ensure that this always occurs.

The dimensions must be provided in the same order as they are stored in the dataset. This can be queried using getDimensionIndex().

Note
If there are more than 5 dimensions in the dataset, is is recommended that you use the other overload of this function. All unspecified dimensions (i.e. dimensions at index 5 and above will be assumed as index zero).
See also
getDimensionIndex()
arrayAccessHint
getTypedInterface()

Implements ArrayNd.

◆ operator=()

ArrayNdEmpty & operator= ( const ArrayNdEmpty other)
default

◆ setDimensions()

bool setDimensions ( const NamedDimensionRangeList dimensions)
overridevirtual
Parameters
dimensionsThe complete list of dimensions we want the dataset to have.
Returns
True if the dimensions of the dataset were successfully set.

Sets the dimensions of the dataset. This will result in the allocation of the underlying data storage. If the dataset previously contained data, this will result in a resize of the dataset, which may require the copying of data, the cost of which will vary greatly depending upon the implementation. For newly created cells in the dataset, a fill-value will be used (by default, this will be a default constructed object).

To avoid expensive copying, it is recommended to only invoke this function on an empty (i.e. uninitialized) dataset.

Note
Not all implementations may support this operation at all times. For example, some implementations may allow users to read from read-only datasets on disk.
See also
writeData
getData
setFillValue

Implements ArrayNd.

◆ setHasFillValue()

void setHasFillValue ( bool  b)
overridevirtual
Parameters
bWhether or not to use a fill value for this dataset. By default, the fill value will be the default constructed type of the underlying stored data.

The Fill Value of the dataset is used to indicate an 'empty' cell. Cells that do not contain any valid data, or data outside the known / valid range, will contain the fill value. This function allows the caller to indicate that a fill value is in use in the dataset.

See also
hasFillValue
getFillValue
getFillValueAsVariant

Implements ArrayNd.