Workspace 6.21.5
Public Member Functions | List of all members
ArrayNdTyped< T > Class Template Referenceabstract

An interface to an ArrayNd object which contains data of a specific type.

#include <DataAnalysis/DataStructures/arraynd.h>

Inheritance diagram for ArrayNdTyped< T >:
[legend]

Public Member Functions

bool arrayAccessHint (const NamedDimensionRangeList &range) override=0
 
ArrayNdTypedclone () const override=0
 
virtual bool getData (const NamedDimensionRangeList &range, T *data) const =0
 
double getFillValue () const override=0
 
QVariant getFillValueAsVariant () const override=0
 
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=0
 
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
 
ArrayNdTypedoperator= (const ArrayNdTyped &other)=default
 
virtual bool setFillValue (const T &value)=0
 
void setHasFillValue (bool b) override=0
 
virtual T valueAt (const DimensionIndexList &indices) const =0
 
virtual T valueAt (size_type dim0, size_type dim1=0, size_type dim2=0, size_type dim3=0, size_type dim4=0) const =0
 
virtual bool writeData (const NamedDimensionRangeList &range, const T *const data)=0
 
- 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
 

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
 

Member Function Documentation

◆ arrayAccessHint()

bool arrayAccessHint ( const NamedDimensionRangeList range)
overridepure virtual
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.

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ clone()

ArrayNdTyped * clone ( ) const
overridepure virtual
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.

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ getData()

virtual bool getData ( const NamedDimensionRangeList range,
T *  data 
) const
pure virtual
Parameters
rangeThe bounded range from which we are reading data.
dataThe data store into which we will write the data that we are reading from the dataset.

Gets data from the underlying data structure, copying it into the provided data parameter. The exact dimensions of the read are specified by the range parameter.

Note
The data is assumed to be in column-major order, corresponding to the order of the dimensions in the object (not the order specified in the input range - the order in the input range is ignored). This means the dimension with the highest index will vary the most frequently.
Returns
true if the data was successfully retrieved from the dataset, false otherwise.
Precondition
The data argument is expected to point to a data store large enough to store sizeof(T) * SUM0,range.size(). Failure to properly allocate this data will result in buffer overflows.

Implemented in ArrayNdData< double >, ArrayNdData< T >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ getFillValue()

double getFillValue ( ) const
overridepure virtual
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.

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ getFillValueAsVariant()

QVariant getFillValueAsVariant ( ) const
overridepure virtual
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.

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ getValue() [1/2]

QVariant getValue ( const DimensionIndexList dimIndices) const
inlineoverridevirtual
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
inlineoverridevirtual
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
overridepure virtual
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.

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ operator()() [1/2]

double operator() ( const DimensionIndexList dimIndices) const
inlineoverridevirtual
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
inlineoverridevirtual
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=()

ArrayNdTyped & operator= ( const ArrayNdTyped< T > &  other)
default

◆ setFillValue()

virtual bool setFillValue ( const T &  value)
pure virtual
Parameters
valueThe fill value that we are setting.
Returns
True if the fill-value was successfully set, otherwise.

When the dimensions of a dataset are set (setDimensions), a fill-value is specified which will be used to populate the newly created cells. This function allows the fill-value to be overridden.

Implemented in ArrayNdData< double >, ArrayNdData< T >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ setHasFillValue()

void setHasFillValue ( bool  b)
overridepure virtual
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.

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ valueAt() [1/2]

virtual T valueAt ( const DimensionIndexList indices) const
pure virtual
Parameters
indicesThe specific indices of the dimensions we wish to access. By default, the indices in the list are assumed to be in the same order that they are in the dataset (e.g. indices[0] will index into getDimension(0)).
Returns
The specific data value that exists at the coordinates contained in indices.

Retrieve a single value from the datset using syntax similar to array subscript notation. This particular overload allows the caller to retrieve a value from a dataset with any number of dimensions.

Note
The indices.size() must match numDimensions().

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ valueAt() [2/2]

virtual T valueAt ( size_type  dim0,
size_type  dim1 = 0,
size_type  dim2 = 0,
size_type  dim3 = 0,
size_type  dim4 = 0 
) const
pure virtual
Parameters
dim0The index of the first dimension in the dataset.
dim1The index of the second dimension in the dataset.
dim2The index of the third dimension in the dataset.
dim3The index of the fourth dimension in the dataset.
dim4The index of the fifth dimension in the dataset.
Returns
The specific data value that exists at the coordinates contained in indices.

Retrieve a single value from the datset using syntax similar to array subscript notation. This particular overload allows the caller to retrieve a value from a dataset with 5 dimensions. Dimensions at indexes 5 and above (assuming they exist) will be be retrieved using index 0 for these dimensions.

Note
The indices.size() must match numDimensions().

Implemented in ArrayNdData< T >, ArrayNdData< double >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.

◆ writeData()

virtual bool writeData ( const NamedDimensionRangeList range,
const T *const  data 
)
pure virtual
Parameters
rangeThe bounded range to which we are writing the data. These dimensions must be specified in terms of the sliced dimensions, not the dimensions of the underlying base dataset.
dataThe data which we are going to write into the dataset.

Writes data to the underlying data structure, copying it from the provided data parameter. The exact dimensions of the write are specified by the range parameter.

Note
The data is assumed to be in row-major order, corresponding to the order of the dimensions in the object (not the order specified in the input range - the order in the input range is ignored). This means the dimension with the highest index will vary the most frequently. See https://en.wikipedia.org/wiki/Row-_and_column-major_order for example.
Returns
true if the data was added to the dataset successfully, false otherwise.
Precondition
The data argument is expected to point to a data store containing store sizeof(T) * SUM0,range.size() elements. If this is not the case, the application will attempt to read memory that is out-of-bounds.

Implemented in ArrayNdData< double >, ArrayNdData< T >, ArrayNdDimensionFilterTyped< T >, ArrayNdInterface< T >, ArrayNdPermutationTyped< T >, and ArrayNdSliceTyped< T >.