cryph utilities [subset]  2.0
Subset of the full cryph package of mathematical utilities for points, vectors, and matrices
Public Member Functions | Static Public Member Functions | List of all members
cryph::Packed3DArray< T > Class Template Reference

Public Member Functions

 Packed3DArray (int dim1=2, int dim2=2, int dim3=2, const T *initBuf=nullptr)
 
 Packed3DArray (const Packed3DArray< T > &t3da)
 
virtual ~Packed3DArray ()
 
const T * getData () const
 
getDataElement (int i1, int i2, int i3) const
 
const T * getDataElementLoc (int i1, int i2, int i3) const
 
int getDim1 () const
 
int getDim2 () const
 
int getDim3 () const
 
T * getModifiableData ()
 
int getTotalNumberElements () const
 
void setDataElement (int i1, int i2, int i3, const T &elem)
 

Static Public Member Functions

static void setErrorReporting (bool r)
 
static void setOutOfBoundsValue (T defaultValue)
 

Constructor & Destructor Documentation

template<typename T >
cryph::Packed3DArray< T >::Packed3DArray ( int  dim1 = 2,
int  dim2 = 2,
int  dim3 = 2,
const T *  initBuf = nullptr 
)

Default constructor and a constructor that takes explicit dimensions.

Parameters
dim1the first dimension
dim2the second dimension
dim3the third dimension
initBufif non-null, populate the buffer with this initial data
template<typename T >
cryph::Packed3DArray< T >::Packed3DArray ( const Packed3DArray< T > &  t3da)

The copy constructor.

Parameters
t3dathe Packed3DArray instance to be copied
template<typename T >
cryph::Packed3DArray< T >::~Packed3DArray ( )
virtual

The destructor

Member Function Documentation

template<typename T>
const T* cryph::Packed3DArray< T >::getData ( ) const
inline

Returns a pointer to the actual internal array for read-only access

Returns
a read-only pointer to the start of the actual internal array
template<typename T >
T cryph::Packed3DArray< T >::getDataElement ( int  i1,
int  i2,
int  i3 
) const

Return an element at a specific location

Parameters
i1the first index
i2the second index
i3the third index
Returns
the element at the given location, if [i1][i2][i3] represents a valid array access. Otherwise returns an "out of bounds" value.
See also
setOutOfBoundsValue
template<typename T >
const T * cryph::Packed3DArray< T >::getDataElementLoc ( int  i1,
int  i2,
int  i3 
) const

Return a pointer to the item in the internal array at the given location

Parameters
i1the first index
i2the second index
i3the third index
Returns
a pointer into the internal array to the actual element, if [i1][i2][i3] represents a valid array access. nullptr otherwise.
template<typename T>
int cryph::Packed3DArray< T >::getDim1 ( ) const
inline

Return the first array dimension

Returns
the first dimension
template<typename T>
int cryph::Packed3DArray< T >::getDim2 ( ) const
inline

Return the second array dimension

Returns
the second dimension
template<typename T>
int cryph::Packed3DArray< T >::getDim3 ( ) const
inline

Return the third array dimension

Returns
the third dimension
template<typename T>
T* cryph::Packed3DArray< T >::getModifiableData ( )
inline

Return a pointer to the actual internal array for RW access

Returns
a RW pointer to the start of the actual internal array
template<typename T>
int cryph::Packed3DArray< T >::getTotalNumberElements ( ) const
inline

Return the total number of elements in this array

Returns
the total number of elements computed as the product of the three dimensions
template<typename T >
void cryph::Packed3DArray< T >::setDataElement ( int  i1,
int  i2,
int  i3,
const T &  elem 
)

Set a specific element of the array. If the indices are not valid, no change is made to the array.

Parameters
i1the first index
i2the second index
i3the third index
template<typename T>
static void cryph::Packed3DArray< T >::setErrorReporting ( bool  r)
inlinestatic

Specify whether errors such as invalid array accesses are reported to the console. By default, they are reported.

template<typename T>
static void cryph::Packed3DArray< T >::setOutOfBoundsValue ( defaultValue)
inlinestatic

Specify a specific value to be returned by getDataElement if invalid array indices are provided.


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