iso::data::Array< Type > Class Template Reference

array class More...

#include <iso_data_array.h>

Collaboration diagram for iso::data::Array< Type >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Array ()
 default constructor
 Array (unsigned int pCount)
 parameter based constructor
 Array (unsigned int pCount, Type pValue)
 parameter based constructor
 Array (unsigned int pCount, Type *pValues)
 parameter based constructor
 Array (unsigned int pCount, double pValue1, double pValue2,...)
 parameter based constructor
 Array (const Array< Type > &pArray)
 copy constructor
virtual ~Array ()
 destructor
unsigned int dataCount () const
 return element count
Type * data ()
 return array values
const Type * data () const
 return array values
Type & operator[] (unsigned int pIndex) throw (base::Exception)
 access element
const Type & operator[] (unsigned int pIndex) const throw (base::Exception)
 access element
void clear ()
 set all array elements to 0
void resize (unsigned int pCount)
 change size of array
void set (Type pValue)
 set all array elements to pValue
void set (Type pValue, unsigned int pCount)
 resize array and set all array elements to pValue
void set (Type *pValues)
 set all array elements to the values in the pValues
void set (const Array< Type > &pArray, bool pResize=false) throw (base::Exception)
 copy all array elements from pArray
const Array< Type > & operator= (Type pValue)
 set all array elements to value
const Array< Type > & operator= (const Array< Type > &pArray) throw (base::Exception)
 copy all array elements from pArray
bool operator== (const Array< Type > &pArray) const
 array == array
bool operator!= (const Array< Type > &pArray) const
 array != array
base::String info () const
 print textual array information

Public Attributes

Type * e
 array elements

Protected Attributes

unsigned int mCount
 number of array elements

Friends

std::ostream & operator<< (std::ostream &pOstream, const Array< Type > &pArray)
 print array information

Detailed Description

template<typename Type>
class iso::data::Array< Type >

array class

one dimensional resizable array class that implements boundary checks

Created by Daniel Bisig on 7/16/06. Copyright 2006 Daniel Bisig All rights reserved.


Constructor & Destructor Documentation

template<typename Type>
iso::data::Array< Type >::Array (  ) 

default constructor

template<typename Type>
iso::data::Array< Type >::Array ( unsigned int  pCount  ) 

parameter based constructor

Parameters:
pCount number of array elements
sets value of all array elements to 0.0

template<typename Type>
iso::data::Array< Type >::Array ( unsigned int  pCount,
Type  pValue 
)

parameter based constructor

Parameters:
pCount number of array elements
pValue value of all array components
sets value of all array elements to pValue

template<typename Type>
iso::data::Array< Type >::Array ( unsigned int  pCount,
Type *  pValues 
)

parameter based constructor

Parameters:
pCount number of array elements
pValues array of values of vector components

template<typename Type>
iso::data::Array< Type >::Array ( unsigned int  pCount,
double  pValue1,
double  pValue2,
  ... 
)

parameter based constructor

Parameters:
pCount number of array elements
pValue1 first value of a series of values
pValue2 second value of a series of values

template<typename Type>
iso::data::Array< Type >::Array ( const Array< Type > &  pArray  ) 

copy constructor

Parameters:
pArray vector

template<typename Type>
iso::data::Array< Type >::~Array (  )  [virtual]

destructor


Member Function Documentation

template<typename Type>
unsigned int iso::data::Array< Type >::dataCount (  )  const [inline]

return element count

Returns:
element count

template<typename Type>
Type * iso::data::Array< Type >::data (  ) 

return array values

Returns:
array values

template<typename Type>
const Type * iso::data::Array< Type >::data (  )  const

return array values

Returns:
array values

template<typename Type>
Type & iso::data::Array< Type >::operator[] ( unsigned int  pIndex  )  throw (base::Exception) [inline]

access element

Parameters:
pIndex index of element
Returns:
component value
Exceptions:
Exception index out of range

template<typename Type>
const Type & iso::data::Array< Type >::operator[] ( unsigned int  pIndex  )  const throw (base::Exception) [inline]

access element

Parameters:
pIndex index of element
Returns:
component value
Exceptions:
Exception index out of range

template<typename Type>
void iso::data::Array< Type >::clear (  )  [inline]

set all array elements to 0

template<typename Type>
void iso::data::Array< Type >::resize ( unsigned int  pCount  ) 

change size of array

Parameters:
pCount new array size
original array values are preserved as far as possible. when array size increases, new array elements contain zero when array size decreases, previous values at positions that are beyond new array size are lost

template<typename Type>
void iso::data::Array< Type >::set ( Type  pValue  )  [inline]

set all array elements to pValue

Parameters:
pValue value

template<typename Type>
void iso::data::Array< Type >::set ( Type  pValue,
unsigned int  pCount 
) [inline]

resize array and set all array elements to pValue

Parameters:
pCount new array size
pValue value

template<typename Type>
void iso::data::Array< Type >::set ( Type *  pValues  )  [inline]

set all array elements to the values in the pValues

Parameters:
pValues values
make sure that the correct number of values is provided

template<typename Type>
void iso::data::Array< Type >::set ( const Array< Type > &  pArray,
bool  pResize = false 
) throw (base::Exception) [inline]

copy all array elements from pArray

Parameters:
pArray array
pResize resize array if size differs
Exceptions:
Exception arrays not of same size

template<typename Type>
const Array< Type > & iso::data::Array< Type >::operator= ( Type  pValue  )  [inline]

set all array elements to value

Parameters:
pValue value
Returns:
array

template<typename Type>
const Array< Type > & iso::data::Array< Type >::operator= ( const Array< Type > &  pArray  )  throw (base::Exception) [inline]

copy all array elements from pArray

Parameters:
pArray array
Returns:
array
Exceptions:
Exception arrays not of same size

template<typename Type>
bool iso::data::Array< Type >::operator== ( const Array< Type > &  pArray  )  const [inline]

array == array

Parameters:
pArray comparison array
Returns:
true if array sizes and all array elements are identical, false otherwise

template<typename Type>
bool iso::data::Array< Type >::operator!= ( const Array< Type > &  pArray  )  const [inline]

array != array

Parameters:
pArray comparison array
Returns:
true if array sizes and all array elements are not identical, false otherwise

template<typename Type>
base::String iso::data::Array< Type >::info (  )  const

print textual array information


Friends And Related Function Documentation

template<typename Type>
std::ostream& operator<< ( std::ostream &  pOstream,
const Array< Type > &  pArray 
) [friend]

print array information

Parameters:
pOstream output stream
pArray array


Member Data Documentation

template<typename Type>
Type* iso::data::Array< Type >::e

array elements

template<typename Type>
unsigned int iso::data::Array< Type >::mCount [protected]

number of array elements


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 13:57:33 2011 for iso_data by  doxygen 1.5.1