LevelS C++ support library  3.83
Public Member Functions | List of all members
arr2T< T, storageManager > Class Template Reference

#include <arr.h>

Public Member Functions

 arr2T ()
 
 arr2T (tsize sz1, tsize sz2)
 
 arr2T (T *p, tsize sz1, tsize sz2)
 
 arr2T (const arr2T &orig)
 
 ~arr2T ()
 
tsize size1 () const
 
tsize size2 () const
 
tsize size () const
 
void alloc (tsize sz1, tsize sz2)
 
void allocAndFill (tsize sz1, tsize sz2, const T &inival)
 
void fast_alloc (tsize sz1, tsize sz2)
 
void dealloc ()
 
void fill (const T &val)
 
void scale (const T &val)
 
arr2Toperator= (const arr2T &orig)
 
template<typename T2 >
T * operator[] (T2 n)
 
template<typename T2 >
const T * operator[] (T2 n) const
 
template<typename T2 , typename T3 >
T & operator() (T2 n1, T3 n2)
 
template<typename T2 , typename T3 >
const T & operator() (T2 n1, T3 n2) const
 
void minmax (T &minv, T &maxv) const
 
void swap (arr2T &other)
 
template<typename T2 , typename T3 >
bool conformable (const arr2T< T2, T3 > &other) const
 

Detailed Description

template<typename T, typename storageManager>
class arr2T< T, storageManager >

Two-dimensional array type, with selectable storage management. The storage ordering is the same as in C. An entry is located by address arithmetic, not by double dereferencing. The indices start at zero.

Definition at line 347 of file arr.h.

Constructor & Destructor Documentation

◆ arr2T() [1/4]

template<typename T, typename storageManager>
arr2T< T, storageManager >::arr2T ( )
inline

Creates a zero-sized array.

Definition at line 355 of file arr.h.

◆ arr2T() [2/4]

template<typename T, typename storageManager>
arr2T< T, storageManager >::arr2T ( tsize  sz1,
tsize  sz2 
)
inline

Creates an array with the dimensions sz1 and sz2.

Definition at line 357 of file arr.h.

◆ arr2T() [3/4]

template<typename T, typename storageManager>
arr2T< T, storageManager >::arr2T ( T *  p,
tsize  sz1,
tsize  sz2 
)
inline

Creates an array with the dimensions sz1 and sz2 and initializes them with inival.
Creates an array with the dimensions sz1 and sz2 from existing pointer.

Definition at line 363 of file arr.h.

◆ arr2T() [4/4]

template<typename T, typename storageManager>
arr2T< T, storageManager >::arr2T ( const arr2T< T, storageManager > &  orig)
inline

Creates the array as a copy of orig.

Definition at line 369 of file arr.h.

◆ ~arr2T()

template<typename T, typename storageManager>
arr2T< T, storageManager >::~arr2T ( )
inline

Frees the memory associated with the array.

Definition at line 372 of file arr.h.

Member Function Documentation

◆ size1()

template<typename T, typename storageManager>
tsize arr2T< T, storageManager >::size1 ( ) const
inline

Returns the first array dimension.

Definition at line 375 of file arr.h.

◆ size2()

template<typename T, typename storageManager>
tsize arr2T< T, storageManager >::size2 ( ) const
inline

Returns the second array dimension.

Definition at line 377 of file arr.h.

◆ size()

template<typename T, typename storageManager>
tsize arr2T< T, storageManager >::size ( ) const
inline

Returns the total array size, i.e. the product of both dimensions.

Definition at line 379 of file arr.h.

◆ alloc()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::alloc ( tsize  sz1,
tsize  sz2 
)
inline

Allocates space for an array with sz1*sz2 elements. The content of the array is undefined on exit. sz1 or sz2 can be 0. If sz1*sz2 is the same as the currently allocated space, no reallocation is performed.

Definition at line 385 of file arr.h.

◆ allocAndFill()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::allocAndFill ( tsize  sz1,
tsize  sz2,
const T &  inival 
)
inline

Allocates space for an array with sz1*sz2 elements. All elements are set to inival. sz1 or sz2 can be 0. If sz1*sz2 is the same as the currently allocated space, no reallocation is performed.

Definition at line 395 of file arr.h.

◆ fast_alloc()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::fast_alloc ( tsize  sz1,
tsize  sz2 
)
inline

Allocates space for an array with sz1*sz2 elements. The content of the array is undefined on exit. sz1 or sz2 can be 0. If sz1*sz2 is smaller than the currently allocated space, no reallocation is performed.

Definition at line 401 of file arr.h.

◆ dealloc()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::dealloc ( )
inline

Deallocates the space and makes the array zero-sized.

Definition at line 409 of file arr.h.

◆ fill()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::fill ( const T &  val)
inline

Sets all array elements to val.

Definition at line 412 of file arr.h.

◆ scale()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::scale ( const T &  val)
inline

Multiplies all array elements by val.

Definition at line 416 of file arr.h.

◆ operator=()

template<typename T, typename storageManager>
arr2T& arr2T< T, storageManager >::operator= ( const arr2T< T, storageManager > &  orig)
inline

Changes the array to be a copy of orig.

Definition at line 420 of file arr.h.

◆ operator[]() [1/2]

template<typename T, typename storageManager>
template<typename T2 >
T* arr2T< T, storageManager >::operator[] ( T2  n)
inline

Returns a pointer to the beginning of slice n.

Definition at line 429 of file arr.h.

◆ operator[]() [2/2]

template<typename T, typename storageManager>
template<typename T2 >
const T* arr2T< T, storageManager >::operator[] ( T2  n) const
inline

Returns a constant pointer to the beginning of slice n.

Definition at line 431 of file arr.h.

◆ operator()() [1/2]

template<typename T, typename storageManager>
template<typename T2 , typename T3 >
T& arr2T< T, storageManager >::operator() ( T2  n1,
T3  n2 
)
inline

Returns a reference to the element with the indices n1 and n2.

Definition at line 434 of file arr.h.

◆ operator()() [2/2]

template<typename T, typename storageManager>
template<typename T2 , typename T3 >
const T& arr2T< T, storageManager >::operator() ( T2  n1,
T3  n2 
) const
inline

Returns a constant reference to the element with the indices n1 and n2.

Definition at line 438 of file arr.h.

◆ minmax()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::minmax ( T &  minv,
T &  maxv 
) const
inline

Returns the minimum and maximum entry in minv and maxv, respectively. Throws an exception if the array is zero-sized.

Definition at line 443 of file arr.h.

◆ swap()

template<typename T, typename storageManager>
void arr2T< T, storageManager >::swap ( arr2T< T, storageManager > &  other)
inline

Swaps contents and sizes with other.

Definition at line 456 of file arr.h.

◆ conformable()

template<typename T, typename storageManager>
template<typename T2 , typename T3 >
bool arr2T< T, storageManager >::conformable ( const arr2T< T2, T3 > &  other) const
inline

Returns true if the array and other have the same dimensions, else false.

Definition at line 466 of file arr.h.


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

Generated on Wed Nov 13 2024 12:18:16 for LevelS C++ support library