LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
LLU::NumericArrayView Class Reference

Description

Simple, light-weight, non-owning, data-type-agnostic wrappper over MNumericArray.

Intended for use in functions that only need to access MNumericArray metadata, where it can alleviate the need for introducing template parameters for MNumericArray passing mode (like in GenericNumericArray) or data type (like in NumericArray class).

+ Inheritance diagram for LLU::NumericArrayView:
+ Collaboration diagram for LLU::NumericArrayView:

#include <NumericArray.hpp>

Public Member Functions

 NumericArrayView (const GenericNumericArray &gNA)
 Create a NumericArrayView from a GenericNumericArray. More...
 
 NumericArrayView (MNumericArray mna)
 Create a NumericArrayView from a raw MNumericArray. More...
 
mint getRank () const override
 Get rank. More...
 
mint const * getDimensions () const override
 Get dimensions. More...
 
mint getFlattenedLength () const override
 Get length. More...
 
numericarray_data_t type () const final
 Get the data type of this array. More...
 
void * rawData () const noexcept override
 Get access to the raw data. More...
 

Constructor & Destructor Documentation

◆ NumericArrayView() [1/2]

LLU::NumericArrayView::NumericArrayView ( const GenericNumericArray gNA)
inline

Create a NumericArrayView from a GenericNumericArray.

Parameters
gNA- a GenericNumericArray

◆ NumericArrayView() [2/2]

LLU::NumericArrayView::NumericArrayView ( MNumericArray  mna)
inline

Create a NumericArrayView from a raw MNumericArray.

Parameters
mna- a raw MNumericArray

Member Function Documentation

◆ getDimensions()

mint const* LLU::NumericArrayView::getDimensions ( ) const
inlineoverridevirtual

Get dimensions.

Returns
raw pointer to dimensions of the array
See also
http://reference.wolfram.com/language/LibraryLink/ref/callback/MNumericArray_getDimensions.html

Implements LLU::NumericArrayInterface.

◆ getFlattenedLength()

mint LLU::NumericArrayView::getFlattenedLength ( ) const
inlineoverridevirtual

◆ getRank()

mint LLU::NumericArrayView::getRank ( ) const
inlineoverridevirtual

◆ rawData()

void* LLU::NumericArrayView::rawData ( ) const
inlineoverridevirtualnoexcept

Get access to the raw data.

Use with caution.

Returns
pointer to the raw data
See also
http://reference.wolfram.com/language/LibraryLink/ref/callback/MNumericArray_getData.html

Implements LLU::NumericArrayInterface.

◆ type()

numericarray_data_t LLU::NumericArrayView::type ( ) const
inlinefinalvirtual

Get the data type of this array.

Returns
type of elements (see definition of numericarray_data_t)
See also
http://reference.wolfram.com/language/LibraryLink/ref/callback/MNumericArray_getDataType.html

Implements LLU::NumericArrayInterface.