CArray< T > Class Template Reference

Inheritance diagram for CArray< T >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class T>
class CArray< T >

template class Array

Definition at line 74 of file Array.h.


Public Member Functions

 CArray (INT initial_size=1)
 CArray (T *p_array, INT p_array_size, bool p_free_array=true, bool p_copy_array=false)
 CArray (const T *p_array, INT p_array_size)
 ~CArray ()
const char * get_name () const
void set_name (const char *p_name)
INT get_array_size () const
INT get_dim1 ()
void zero ()
const T & get_element (INT index) const
bool set_element (const T &p_element, INT index)
const T & element (INT idx1) const
T & element (INT index)
T & element (T *p_array, INT index)
bool resize_array (INT n)
T * get_array ()
void set_array (T *p_array, INT p_array_size, bool p_free_array=true, bool copy_array=false)
void set_array (const T *p_array, INT p_array_size)
void clear_array ()
const T & operator[] (INT index) const
T & operator[] (INT index)
CArray< T > & operator= (const CArray< T > &orig)
void display_size () const
void display_array () const

Static Public Attributes

static CParallel parallel
static CIO io
static CVersion version

Protected Attributes

T * array
INT array_size
bool free_array
const char * name
 DECLARE_ARRAY_STATISTICS

Constructor & Destructor Documentation

template<class T>
CArray< T >::CArray ( INT  initial_size = 1  ) 

constructor

Parameters:
initial_size initial size of array

Definition at line 81 of file Array.h.

template<class T>
CArray< T >::CArray ( T *  p_array,
INT  p_array_size,
bool  p_free_array = true,
bool  p_copy_array = false 
)

constructor

Parameters:
p_array another array
p_array_size size of another array
p_free_array if array must be freed
p_copy_array if array must be copied

Definition at line 97 of file Array.h.

template<class T>
CArray< T >::CArray ( const T *  p_array,
INT  p_array_size 
)

constructor

Parameters:
p_array another array
p_array_size size of another array

Definition at line 110 of file Array.h.

template<class T>
CArray< T >::~CArray (  ) 

Definition at line 117 of file Array.h.


Member Function Documentation

template<class T>
const char* CArray< T >::get_name (  )  const

get name

Returns:
name

Definition at line 130 of file Array.h.

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

set name

Parameters:
p_name new name

Reimplemented in CArray2< T >, CArray3< T >, CArray2< CPlifBase * >, CArray2< double >, CArray2< int >, CArray2< char >, and CArray3< double >.

Definition at line 139 of file Array.h.

template<class T>
INT CArray< T >::get_array_size (  )  const

get array size (including granularity buffer)

Returns:
total array size

Definition at line 148 of file Array.h.

template<class T>
INT CArray< T >::get_dim1 (  ) 

get array size (including granularity buffer)

Returns:
total array size

Reimplemented in CArray2< T >, CArray3< T >, CArray2< CPlifBase * >, CArray2< double >, CArray2< int >, CArray2< char >, and CArray3< double >.

Definition at line 157 of file Array.h.

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

template<class T>
const T& CArray< T >::get_element ( INT  index  )  const

get array element at index

Parameters:
index index
Returns:
array element at index

Definition at line 174 of file Array.h.

template<class T>
bool CArray< T >::set_element ( const T &  p_element,
INT  index 
)

set array element at index 'index' return false in case of trouble

Parameters:
p_element array element to set
index index
Returns:
if setting was successful

Definition at line 187 of file Array.h.

template<class T>
const T& CArray< T >::element ( INT  idx1  )  const

get element at given index

Parameters:
idx1 index
Returns:
element at given index

Definition at line 200 of file Array.h.

template<class T>
T& CArray< T >::element ( INT  index  ) 

get element at given index

Parameters:
index index
Returns:
element at given index

Definition at line 211 of file Array.h.

template<class T>
T& CArray< T >::element ( T *  p_array,
INT  index 
)

get element of given array at given index

Parameters:
p_array another array
index index
Returns:
element of given array at given index

Definition at line 226 of file Array.h.

template<class T>
bool CArray< T >::resize_array ( INT  n  ) 

resize array

Parameters:
n new size
Returns:
if resizing was successful

Definition at line 239 of file Array.h.

template<class T>
T* CArray< T >::get_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 in CArray2< T >, CArray3< T >, CArray2< CPlifBase * >, CArray2< double >, CArray2< int >, CArray2< char >, and CArray3< double >.

Definition at line 260 of file Array.h.

template<class T>
void CArray< T >::set_array ( T *  p_array,
INT  p_array_size,
bool  p_free_array = true,
bool  copy_array = false 
)

set the array pointer and free previously allocated memory

Parameters:
p_array another array
p_array_size size of another array
p_free_array if array must be freed
copy_array if array must be copied

Definition at line 273 of file Array.h.

template<class T>
void CArray< T >::set_array ( const T *  p_array,
INT  p_array_size 
)

set the array pointer and free previously allocated memory

Parameters:
p_array another array
p_array_size size of another array

Definition at line 295 of file Array.h.

template<class T>
void CArray< T >::clear_array (  ) 

clear the array (with zeros)

Definition at line 306 of file Array.h.

template<class T>
const T& CArray< T >::operator[] ( INT  index  )  const

operator overload for array read only access use set_element() for write access (will also make the array dynamically grow)

DOES NOT DO ANY BOUNDS CHECKING

Parameters:
index 
Returns:
element at index

Definition at line 320 of file Array.h.

template<class T>
T& CArray< T >::operator[] ( INT  index  ) 

operator overload for array read only access

DOES NOT DO ANY BOUNDS CHECKING

Parameters:
index 
Returns:
element at index

Definition at line 333 of file Array.h.

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

operator overload for array assignment

Parameters:
orig original array
Returns:
new array

Definition at line 344 of file Array.h.

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

display array size

Reimplemented in CArray2< T >, CArray3< T >, CArray2< CPlifBase * >, CArray2< double >, CArray2< int >, CArray2< char >, and CArray3< double >.

Definition at line 353 of file Array.h.

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

display array

Reimplemented in CArray2< T >, CArray3< T >, CArray2< CPlifBase * >, CArray2< double >, CArray2< int >, CArray2< char >, and CArray3< double >.

Definition at line 360 of file Array.h.


Member Data Documentation

template<class T>
T* CArray< T >::array [protected]

memory for dynamic array

Definition at line 370 of file Array.h.

template<class T>
INT CArray< T >::array_size [protected]

the number of potentially used elements in array

Definition at line 372 of file Array.h.

template<class T>
bool CArray< T >::free_array [protected]

if array must be freed

Definition at line 374 of file Array.h.

template<class T>
const char* CArray< T >::name [protected]

array's name

Definition at line 376 of file Array.h.

template<class T>
CArray< T >::DECLARE_ARRAY_STATISTICS [protected]

array statistics

Definition at line 378 of file Array.h.

CParallel CSGObject::parallel [static, inherited]

Definition at line 105 of file SGObject.h.

CIO CSGObject::io [static, inherited]

Definition at line 106 of file SGObject.h.

CVersion CSGObject::version [static, inherited]

Definition at line 107 of file SGObject.h.


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

SHOGUN Machine Learning Toolbox - Documentation