The blo Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
blo::Array3D< T > Class Template Reference

3D array. More...

#include <Array3D.h>

Classes

class  Dim1Proxy
 Array first dimension proxy. More...
 

Public Member Functions

 Array3D ()=default
 Default constructor.
 
 Array3D (int size1, int size2, int size3)
 Constructs array of specified size.
 
 Array3D (int size1, int size2, int size3, const T &val)
 Constructs array of specified size and value.
 
 Array3D (const Array3D &rhs)
 Copy constructor.
 
 Array3D (Array3D &&rhs) noexcept
 Move constructor.
 
virtual ~Array3D ()
 Destructor.
 
Array3D & operator= (const Array3D &rhs)
 Copy assignment operator.
 
Array3D & operator= (Array3D &&rhs) noexcept
 Move assignment operator.
 
Dim1Proxy operator[] (int i)
 Index first dimension of array.
 
const Dim1Proxy operator[] (int i) const
 Index first dimension of array.
 
bool empty () const
 Tests if the array is empty.
 
void resize (int size1, int size2, int size3)
 Resizes array.
 
void clear ()
 Resizes array to zero rows and zero columns.
 
int size1 () const
 Size of first dimension of array.
 
int size2 () const
 Size of second dimension of array.
 
int size3 () const
 Size of third dimension of array.
 
T * ptrData ()
 Retrieves the pointer to the beginning of the array.
 
const T * ptrData () const
 Retrieves the pointer to the beginning of the array.
 
int stride1 () const
 Stride in bytes through the first dimension of the array.
 
int stride2 () const
 Stride in bytes through the second dimension of the array.
 
void swap (Array3D &rhs)
 Swaps this array with another one.
 
void set (const T &val)
 Sets array elements to a value.
 

Static Public Member Functions

static int stride3 ()
 Stride in bytes through the third dimension of the array.
 

Detailed Description

template<typename T>
class blo::Array3D< T >

3D array.

Template Parameters
TData type.

Constructor & Destructor Documentation

◆ Array3D() [1/5]

template<typename T >
blo::Array3D< T >::Array3D ( )
default

Default constructor.

◆ Array3D() [2/5]

template<typename T >
blo::Array3D< T >::Array3D ( int  size1,
int  size2,
int  size3 
)

Constructs array of specified size.

Parameters
size1Size of first dimension of array.
size2Size of second dimension of array.
size3Size of third dimension of array.

◆ Array3D() [3/5]

template<typename T >
blo::Array3D< T >::Array3D ( int  size1,
int  size2,
int  size3,
const T &  val 
)

Constructs array of specified size and value.

Parameters
size1Size of first dimension of array.
size2Size of second dimension of array.
size3Size of third dimension of array.
valConstant value to assign to each element in the array.

◆ Array3D() [4/5]

template<typename T >
blo::Array3D< T >::Array3D ( const Array3D< T > &  rhs)

Copy constructor.

◆ Array3D() [5/5]

template<typename T >
blo::Array3D< T >::Array3D ( Array3D< T > &&  rhs)
noexcept

Move constructor.

◆ ~Array3D()

template<typename T >
virtual blo::Array3D< T >::~Array3D ( )
virtual

Destructor.

Member Function Documentation

◆ clear()

template<typename T >
void blo::Array3D< T >::clear ( )

Resizes array to zero rows and zero columns.

◆ empty()

template<typename T >
bool blo::Array3D< T >::empty ( ) const

Tests if the array is empty.

Returns
true if array is empty, false otherwise.

◆ operator=() [1/2]

template<typename T >
Array3D & blo::Array3D< T >::operator= ( Array3D< T > &&  rhs)
noexcept

Move assignment operator.

◆ operator=() [2/2]

template<typename T >
Array3D & blo::Array3D< T >::operator= ( const Array3D< T > &  rhs)

Copy assignment operator.

◆ operator[]() [1/2]

template<typename T >
Dim1Proxy blo::Array3D< T >::operator[] ( int  i)

Index first dimension of array.

Note
Index second dimension of array using array[i][j].
Parameters
iFirst dimension of the array.
Returns
Proxy of the first dimension.

◆ operator[]() [2/2]

template<typename T >
const Dim1Proxy blo::Array3D< T >::operator[] ( int  i) const

Index first dimension of array.

Note
Index second dimension of array using array[i][j].
Parameters
iFirst dimension of the array.
Returns
Proxy of the first dimension.

◆ ptrData() [1/2]

template<typename T >
T * blo::Array3D< T >::ptrData ( )

Retrieves the pointer to the beginning of the array.

Returns
Pointer to the beginning of the array.

◆ ptrData() [2/2]

template<typename T >
const T * blo::Array3D< T >::ptrData ( ) const

Retrieves the pointer to the beginning of the array.

Returns
Pointer to the beginning of the array.

◆ resize()

template<typename T >
void blo::Array3D< T >::resize ( int  size1,
int  size2,
int  size3 
)

Resizes array.

Parameters
size1Size of first dimension to resize array to.
size2Size of second dimension to resize array to.
size3Size of third dimension to resize array to.

◆ set()

template<typename T >
void blo::Array3D< T >::set ( const T &  val)

Sets array elements to a value.

Parameters
valConstant value to assign to each element in the array.

◆ size1()

template<typename T >
int blo::Array3D< T >::size1 ( ) const

Size of first dimension of array.

Returns
Size of first dimension of array.

◆ size2()

template<typename T >
int blo::Array3D< T >::size2 ( ) const

Size of second dimension of array.

Returns
Size of second dimension of array.

◆ size3()

template<typename T >
int blo::Array3D< T >::size3 ( ) const

Size of third dimension of array.

Returns
Size of third dimension of array.

◆ stride1()

template<typename T >
int blo::Array3D< T >::stride1 ( ) const

Stride in bytes through the first dimension of the array.

Returns
Stride in bytes through the first dimension of the array.

◆ stride2()

template<typename T >
int blo::Array3D< T >::stride2 ( ) const

Stride in bytes through the second dimension of the array.

Returns
Stride in bytes through the second dimension of the array.

◆ stride3()

template<typename T >
static int blo::Array3D< T >::stride3 ( )
static

Stride in bytes through the third dimension of the array.

Returns
Stride in bytes through the third dimension of the array.

◆ swap()

template<typename T >
void blo::Array3D< T >::swap ( Array3D< T > &  rhs)

Swaps this array with another one.


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