CArray3< T > Class Template Reference


Detailed Description

template<class T>
class CArray3< T >

Template class Array3 implements a dense three dimensional array.

Note that depending on compile options everything will be inlined, such that this is as high performance 3d-array implementation without error checking.

Definition at line 26 of file Array3.h.

Inheritance diagram for CArray3< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CArray3 ()
 CArray3 (int32_t dim1, int32_t dim2, int32_t dim3)
 CArray3 (T *p_array, int32_t dim1, int32_t dim2, int32_t dim3, bool p_free_array=true, bool p_copy_array=false)
 CArray3 (const T *p_array, int32_t dim1, int32_t dim2, int32_t dim3)
virtual ~CArray3 ()
void set_name (const char *p_name)
void get_array_size (int32_t &dim1, int32_t &dim2, int32_t &dim3)
int32_t get_dim1 ()
int32_t get_dim2 ()
int32_t get_dim3 ()
void zero ()
T * get_array ()
void set_array (T *p_array, int32_t dim1, int32_t dim2, int32_t dim3, bool p_free_array, bool copy_array=false)
bool resize_array (int32_t dim1, int32_t dim2, int32_t dim3)
get_element (int32_t idx1, int32_t idx2, int32_t idx3) const
bool set_element (T p_element, int32_t idx1, int32_t idx2, int32_t idx3)
const T & element (int32_t idx1, int32_t idx2, int32_t idx3) const
T & element (int32_t idx1, int32_t idx2, int32_t idx3)
T & element (T *p_array, int32_t idx1, int32_t idx2, int32_t idx3)
T & element (T *p_array, int32_t idx1, int32_t idx2, int32_t idx3, int32_t p_dim1_size, int32_t p_dim2_size)
CArray3< T > & operator= (const CArray3< T > &orig)
void display_size () const
void display_array () const
virtual const char * get_name ()

Protected Attributes

int32_t dim1_size
int32_t dim2_size
int32_t dim3_size

Constructor & Destructor Documentation

template<class T>
CArray3< T >::CArray3 (  ) 

default constructor

Definition at line 30 of file Array3.h.

template<class T>
CArray3< T >::CArray3 ( int32_t  dim1,
int32_t  dim2,
int32_t  dim3 
)

constructor

Parameters:
dim1 dimension 1
dim2 dimension 2
dim3 dimension 3

Definition at line 41 of file Array3.h.

template<class T>
CArray3< T >::CArray3 ( T *  p_array,
int32_t  dim1,
int32_t  dim2,
int32_t  dim3,
bool  p_free_array = true,
bool  p_copy_array = false 
)

constructor

Parameters:
p_array another array
dim1 dimension 1
dim2 dimension 2
dim3 dimension 3
p_free_array if array must be freed
p_copy_array if array must be copied

Definition at line 55 of file Array3.h.

template<class T>
CArray3< T >::CArray3 ( const T *  p_array,
int32_t  dim1,
int32_t  dim2,
int32_t  dim3 
)

constructor

Parameters:
p_array another array
dim1 dimension 1
dim2 dimension 2
dim3 dimension 3

Definition at line 70 of file Array3.h.

template<class T>
virtual CArray3< T >::~CArray3 (  )  [virtual]

Definition at line 76 of file Array3.h.


Member Function Documentation

template<class T>
void CArray3< T >::display_array (  )  const

display array

Reimplemented from CArray< T >.

Definition at line 283 of file Array3.h.

template<class T>
void CArray3< T >::display_size (  )  const

display array size

Reimplemented from CArray< T >.

Definition at line 277 of file Array3.h.

template<class T>
T& CArray3< T >::element ( T *  p_array,
int32_t  idx1,
int32_t  idx2,
int32_t  idx3,
int32_t  p_dim1_size,
int32_t  p_dim2_size 
)

get element of given array at given index

Parameters:
p_array another array
idx1 index 1
idx2 index 2
idx3 index 3
p_dim1_size size of dimension 1
p_dim2_size size of dimension 2
Returns:
element of given array at given index

Definition at line 251 of file Array3.h.

template<class T>
T& CArray3< T >::element ( T *  p_array,
int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
)

get element of given array at given index

Parameters:
p_array another array
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 232 of file Array3.h.

template<class T>
T& CArray3< T >::element ( int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
)

get array element at index

Parameters:
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 216 of file Array3.h.

template<class T>
const T& CArray3< T >::element ( int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
) const

get array element at index

Parameters:
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 201 of file Array3.h.

template<class T>
T* CArray3< T >::get_array (  ) 

get the array call get_array just before messing with it DO NOT call any [],resize/delete functions after get_array(), the pointer may become invalid !

Returns:
the array

Reimplemented from CArray< T >.

Definition at line 129 of file Array3.h.

template<class T>
void CArray3< T >::get_array_size ( int32_t &  dim1,
int32_t &  dim2,
int32_t &  dim3 
)

return total array size (including granularity buffer)

Parameters:
dim1 dimension 1 will be stored here
dim2 dimension 2 will be stored here
dim3 dimension 3 will be stored here

Definition at line 93 of file Array3.h.

template<class T>
int32_t CArray3< T >::get_dim1 (  ) 

get dimension 1

Returns:
dimension 1

Reimplemented from CArray< T >.

Definition at line 104 of file Array3.h.

template<class T>
int32_t CArray3< T >::get_dim2 (  ) 

get dimension 2

Returns:
dimension 2

Definition at line 110 of file Array3.h.

template<class T>
int32_t CArray3< T >::get_dim3 (  ) 

get dimension 3

Returns:
dimension 3

Definition at line 116 of file Array3.h.

template<class T>
T CArray3< T >::get_element ( int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
) const

get array element at index

Parameters:
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
array element at index

Definition at line 170 of file Array3.h.

template<class T>
virtual const char* CArray3< T >::get_name (  )  [virtual]
Returns:
object name

Reimplemented from CArray< T >.

Definition at line 300 of file Array3.h.

template<class T>
CArray3<T>& CArray3< T >::operator= ( const CArray3< T > &  orig  ) 

operator overload for array assignment

Parameters:
orig original array
Returns:
new array

Reimplemented from CArray< T >.

Definition at line 267 of file Array3.h.

template<class T>
bool CArray3< T >::resize_array ( int32_t  dim1,
int32_t  dim2,
int32_t  dim3 
)

resize array

Parameters:
dim1 new dimension 1
dim2 new dimension 2
dim3 new dimension 3
Returns:
if resizing was successful

Definition at line 155 of file Array3.h.

template<class T>
void CArray3< T >::set_array ( T *  p_array,
int32_t  dim1,
int32_t  dim2,
int32_t  dim3,
bool  p_free_array,
bool  copy_array = false 
)

set the array pointer and free previously allocated memory

Parameters:
p_array another array
dim1 dimension 1
dim2 dimensino 2
dim3 dimensino 3
p_free_array if array must be freed
copy_array if array must be copied

Definition at line 140 of file Array3.h.

template<class T>
bool CArray3< T >::set_element ( p_element,
int32_t  idx1,
int32_t  idx2,
int32_t  idx3 
)

set array element at index 'index'

Parameters:
p_element array element
idx1 index 1
idx2 index 2
idx3 index 3
Returns:
if setting was successful

Definition at line 186 of file Array3.h.

template<class T>
void CArray3< T >::set_name ( const char *  p_name  ) 

set array's name

Parameters:
p_name new name

Reimplemented from CArray< T >.

Definition at line 82 of file Array3.h.

template<class T>
void CArray3< T >::zero (  ) 

zero array

Reimplemented from CArray< T >.

Definition at line 120 of file Array3.h.


Member Data Documentation

template<class T>
int32_t CArray3< T >::dim1_size [protected]

size of array's dimension 1

Definition at line 304 of file Array3.h.

template<class T>
int32_t CArray3< T >::dim2_size [protected]

size of array's dimension 2

Definition at line 306 of file Array3.h.

template<class T>
int32_t CArray3< T >::dim3_size [protected]

size of array's dimension 3

Definition at line 308 of file Array3.h.


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

SHOGUN Machine Learning Toolbox - Documentation