Public Member Functions

zeus::TArrayList< T > Class Template Reference

#include <ArrayList.hpp>

Inheritance diagram for zeus::TArrayList< T >:
zeus::IArray< T > zeus::IList< T > zeus::IValueType

List of all members.

Public Member Functions

 TArrayList (Int iSize=20, EArrayCopyMode eCopyMode=etDeepCopy)
 TArrayList (const T *pArray, Int iSize, EArrayCopyMode eCopyMode, bool bAttachPointer=false)
 TArrayList (const T &rEmptyItem, Int iSize, EArrayCopyMode eCopyMode)
virtual ~TArrayList ()
 TArrayList (const TArrayList< T > &rList)
 Copy constructors.
 TArrayList (const IArray< T > *pList)
virtual T *MQUALIFIER getArray () const
virtual const T *MQUALIFIER getArrayConst () const
virtual Int MQUALIFIER getArraySize () const
virtual Retval MQUALIFIER setArray (const T *pArray, Int iSize, bool bAttachPointer=false)
virtual Retval MQUALIFIER appendArray (const T *pArray, Int iSize)
virtual Retval MQUALIFIER copyToArray (IArray< T > &rDest, Int iStart, Int iEnd) const
virtual EArrayCopyMode MQUALIFIER getCopyMode () const
virtual Retval MQUALIFIER overwrite (const IArray< T > &rSrc, Int iSrcStart, Int iSrcEnd, Int iDestStart)
virtual Int MQUALIFIER add (const T &rItem)
virtual Int MQUALIFIER addAll (const IList< T > &rlstItems)
virtual Int MQUALIFIER addEmptyItem ()
virtual void MQUALIFIER copyToList (IList< T > &rList) const
virtual void MQUALIFIER clear ()
virtual Retval MQUALIFIER deleteItem (Int iIndex)
virtual Retval MQUALIFIER remove (const T &rItem)
virtual Retval MQUALIFIER removeAll (const IList< T > &rlstItems)
virtual Int MQUALIFIER getCount () const
virtual T &MQUALIFIER getItem (Int iIndex)
virtual const T &MQUALIFIER getItemConst (Int iIndex) const
virtual bool MQUALIFIER equalsItem (Int iIndex, const T &rItem) const
virtual bool MQUALIFIER equals (const IList< T > &rList) const
virtual Int MQUALIFIER indexOf (const T &rItem) const
virtual Int MQUALIFIER insert (Int iIndex, const T &rItem)
virtual IListIterator< T >
*MQUALIFIER 
getIterator () const
virtual const IListIterator< T >
*MQUALIFIER 
getConstIterator () const
virtual void MQUALIFIER releaseIterator (const IListIterator< T > *pIterator) const
virtual bool MQUALIFIER isEmpty () const
virtual T &MQUALIFIER getFirstItem ()
virtual const T &MQUALIFIER getFirstItemConst () const
virtual T &MQUALIFIER getLastItem ()
virtual const T &MQUALIFIER getLastItemConst () const
virtual bool MQUALIFIER hasItem (const T &rItem) const
virtual bool MQUALIFIER hasAllItems (const IList< T > &rlstItems) const
T & operator[] (Int iIndex)
TArrayList< T > & operator= (const IList< T > &rList)
TArrayList< T > & operator= (const IList< T > *pList)
TArrayList< T > & operator= (const TArrayList< T > &rList)
TArrayList< T > & operator= (const TArrayList< T > *pList)
bool operator== (const TArrayList< T > &rList) const
bool operator!= (const TArrayList< T > &rList) const
void addEmptyItems (Int iCount)
T & getEmptyItem ()
Retval copyToArray (TArrayList< T > &rDest, Int iStart=0, Int iEnd=INVALID_INDEX) const
Retval copyToArray (T *pBuffer, Int iBufferSize, Int &rCopiedSize, Int iStart=0, Int iEnd=INVALID_INDEX) const
Retval setArray2 (const T *pArray, Int iSize, bool bAttachPointer=false)
void resize (Int iNewSize)
void clearSecure ()

Detailed Description

template<class T>
class zeus::TArrayList< T >

This template class implements an array based list of a type T. The array list uses two methods to copy arrays: the shallow copy is used to copy primitive data types. A memory copy function is used. The deep copy method uses the copy constructor of the class T. The array list is faster using the [] operator than other list implementations.


Constructor & Destructor Documentation

template<class T >
zeus::TArrayList< T >::TArrayList ( Int  iSize = 20,
EArrayCopyMode  eCopyMode = etDeepCopy 
)

Creates an array list.

Parameters:
iSize: Size of the array
eCopyMode: Copy mode of the array. Deep copy uses the copy constructor of the objects, shallow copy uses the memory copy function
template<class T>
zeus::TArrayList< T >::TArrayList ( const T *  pArray,
Int  iSize,
EArrayCopyMode  eCopyMode,
bool  bAttachPointer = false 
)

Creates an array list

Parameters:
pArray: Array to be wrapped
iSize: Size of the array
eCopyMode: Copy mode of the array. Deep copy uses the copy constructor of the objects, shallow copy uses the memory copy function
bAttachPointer: if this flag is set the pointer of the array will be attached (managed by the array class).
template<class T>
zeus::TArrayList< T >::TArrayList ( const T &  rEmptyItem,
Int  iSize,
EArrayCopyMode  eCopyMode 
)

Creates an array list. Using this constructor the empty item can be set. The empty element is returned if there is an index error

Parameters:
rEmptyItem: Empty element.
iSize: Size of the array list
eCopyMode: Copy mode of the array. Deep copy uses the copy constructor of the objects, shallow copy uses the memory copy function
template<class T >
zeus::TArrayList< T >::~TArrayList (  ) [virtual]

Destroys the array list

template<class T>
zeus::TArrayList< T >::TArrayList ( const TArrayList< T > &  rList )

Copy constructors.

Copy constructor

Parameters:
rList: ArrayList to copy
template<class T>
zeus::TArrayList< T >::TArrayList ( const IArray< T > *  pList )

Copy constructor

Parameters:
pList: ArrayList to copy

Member Function Documentation

template<class T>
Int MQUALIFIER zeus::TArrayList< T >::add ( const T &  rItem ) [virtual]
See also:
IList::add

Implements zeus::IList< T >.

template<class T>
Int MQUALIFIER zeus::TArrayList< T >::addAll ( const IList< T > &  rlstItems ) [virtual]
See also:
IList::addAll

Implements zeus::IList< T >.

template<class T >
Int MQUALIFIER zeus::TArrayList< T >::addEmptyItem (  ) [inline, virtual]
See also:
IList::addEmptyItem

Implements zeus::IList< T >.

template<class T >
void zeus::TArrayList< T >::addEmptyItems ( Int  iCount ) [inline]

adds empty items to an array

Parameters:
iCount: number of empty items to add
template<class T>
Retval MQUALIFIER zeus::TArrayList< T >::appendArray ( const T *  pArray,
Int  iSize 
) [virtual]
See also:
IArray::appendArray

Implements zeus::IArray< T >.

template<class T >
void MQUALIFIER zeus::TArrayList< T >::clear (  ) [virtual]
See also:
IList::clear

Implements zeus::IList< T >.

template<class T >
void zeus::TArrayList< T >::clearSecure (  ) [inline]

implements the secure clearing of memory arrays

template<class T>
Retval zeus::TArrayList< T >::copyToArray ( TArrayList< T > &  rDest,
Int  iStart = 0,
Int  iEnd = INVALID_INDEX 
) const

copies the data to an array list

Parameters:
rDest: Destination
iStart: Start index to copy from (default = 0)
iEnd: End index (default = INVALID_INDEX, copies to the end)
Return values:
RET_INVALID_PARAMETER: Invalid index iStart > iEnd
RET_REQUEST_FAILED: indices are out of bounds
RET_NOERROR: Array copied
template<class T>
Retval zeus::TArrayList< T >::copyToArray ( T *  pBuffer,
Int  iBufferSize,
Int &  rCopiedSize,
Int  iStart = 0,
Int  iEnd = INVALID_INDEX 
) const

copies the data to an array or buffer

Parameters:
pBuffer: Destination Buffer
iBufferSize: Size of the buffer
rCopiedSize: number of copied elements (out parameter)
iStart: Start index to copy from (default = 0)
iEnd: End index (default = INVALID_INDEX, copies to the end)
Return values:
RET_INVALID_PARAMETER: Invalid index iStart > iEnd
RET_REQUEST_FAILED: indices are out of bounds
RET_NOERROR: Array copied
template<class T>
Retval MQUALIFIER zeus::TArrayList< T >::copyToArray ( IArray< T > &  rDest,
Int  iStart,
Int  iEnd 
) const [virtual]
See also:
IArray::copyToArray

Implements zeus::IArray< T >.

template<class T>
void MQUALIFIER zeus::TArrayList< T >::copyToList ( IList< T > &  rList ) const [virtual]
See also:
IList::copyToList

Implements zeus::IList< T >.

template<class T >
Retval MQUALIFIER zeus::TArrayList< T >::deleteItem ( Int  iIndex ) [virtual]
See also:
IList::deleteItem

Implements zeus::IList< T >.

template<class T>
bool MQUALIFIER zeus::TArrayList< T >::equals ( const IList< T > &  rList ) const [virtual]
See also:
IList::equals

Implements zeus::IList< T >.

template<class T>
bool MQUALIFIER zeus::TArrayList< T >::equalsItem ( Int  iIndex,
const T &  rItem 
) const [inline, virtual]
See also:
IList::equalsItem

Implements zeus::IList< T >.

template<class T >
T *MQUALIFIER zeus::TArrayList< T >::getArray (  ) const [inline, virtual]
See also:
IArray::getArray

Implements zeus::IArray< T >.

template<class T >
const T *MQUALIFIER zeus::TArrayList< T >::getArrayConst (  ) const [inline, virtual]
template<class T >
Int MQUALIFIER zeus::TArrayList< T >::getArraySize (  ) const [inline, virtual]

This returns the allocated size of the array. The difference between the getCount() method and getArraySize() is, that getCount() returns the count of items in an array, and getArraySize() returns the size of the array, which is normaly bigger or equal to the count.

Returns:
array size:

Implements zeus::IArray< T >.

template<class T >
const IListIterator< T > *MQUALIFIER zeus::TArrayList< T >::getConstIterator (  ) const [inline, virtual]
template<class T >
EArrayCopyMode MQUALIFIER zeus::TArrayList< T >::getCopyMode (  ) const [inline, virtual]
See also:
IArray::getCopyMode

Implements zeus::IArray< T >.

template<class T >
Int MQUALIFIER zeus::TArrayList< T >::getCount (  ) const [inline, virtual]
See also:
IList::getCount

Implements zeus::IList< T >.

template<class T >
T & zeus::TArrayList< T >::getEmptyItem (  ) [inline]

Returns the empty data element

template<class T >
T &MQUALIFIER zeus::TArrayList< T >::getFirstItem (  ) [inline, virtual]
See also:
IList::getFirstItem

Implements zeus::IList< T >.

template<class T >
const T &MQUALIFIER zeus::TArrayList< T >::getFirstItemConst (  ) const [inline, virtual]
template<class T >
T &MQUALIFIER zeus::TArrayList< T >::getItem ( Int  iIndex ) [inline, virtual]
See also:
IList::getItem

Implements zeus::IList< T >.

template<class T >
const T &MQUALIFIER zeus::TArrayList< T >::getItemConst ( Int  iIndex ) const [inline, virtual]
See also:
IList::getItemConst

Implements zeus::IList< T >.

template<class T >
IListIterator< T > *MQUALIFIER zeus::TArrayList< T >::getIterator (  ) const [inline, virtual]
See also:
IList::getIterator

Implements zeus::IList< T >.

template<class T >
T &MQUALIFIER zeus::TArrayList< T >::getLastItem (  ) [inline, virtual]
See also:
IList::getLastItem

Implements zeus::IList< T >.

template<class T >
const T &MQUALIFIER zeus::TArrayList< T >::getLastItemConst (  ) const [inline, virtual]
template<class T>
bool MQUALIFIER zeus::TArrayList< T >::hasAllItems ( const IList< T > &  rlstItems ) const [virtual]
See also:
IList::hasAllItems

Implements zeus::IList< T >.

template<class T>
bool MQUALIFIER zeus::TArrayList< T >::hasItem ( const T &  rItem ) const [inline, virtual]
See also:
IList::hasItem

Implements zeus::IList< T >.

template<class T>
Int MQUALIFIER zeus::TArrayList< T >::indexOf ( const T &  rItem ) const [virtual]
See also:
IList::indexOf

Implements zeus::IList< T >.

template<class T>
Int MQUALIFIER zeus::TArrayList< T >::insert ( Int  iIndex,
const T &  rItem 
) [virtual]
See also:
IList::insert

Implements zeus::IList< T >.

template<class T >
bool MQUALIFIER zeus::TArrayList< T >::isEmpty (  ) const [inline, virtual]
See also:
IList::isEmpty

Implements zeus::IList< T >.

template<class T>
bool zeus::TArrayList< T >::operator!= ( const TArrayList< T > &  rList ) const [inline]

Checks if two list are not equal

Parameters:
rList: list to check
template<class T>
TArrayList< T > & zeus::TArrayList< T >::operator= ( const IList< T > &  rList ) [inline]

operator copies a list into this list object

Parameters:
rList: source
Returns:
this list (target)
template<class T>
TArrayList< T > & zeus::TArrayList< T >::operator= ( const TArrayList< T > *  pList ) [inline]

operator copies a list into this list object

Parameters:
pList: source
Returns:
this list (target)
template<class T>
TArrayList< T > & zeus::TArrayList< T >::operator= ( const IList< T > *  pList ) [inline]

operator copies a list into this list object

Parameters:
pList: source
Returns:
this list (target)
template<class T>
TArrayList< T > & zeus::TArrayList< T >::operator= ( const TArrayList< T > &  rList ) [inline]

operator copies a list into this list object

Parameters:
rList: source
Returns:
this list (target)
template<class T>
bool zeus::TArrayList< T >::operator== ( const TArrayList< T > &  rList ) const [inline]

Operator to check equality of two lists

Parameters:
rList: list to check
Return values:
true: Equal
false: not equal
template<class T >
T & zeus::TArrayList< T >::operator[] ( Int  iIndex ) [inline]

Operator to index an item of the array

Parameters:
iIndex: Index of the requested item
Returns:
returns the item at index
template<class T>
Retval MQUALIFIER zeus::TArrayList< T >::overwrite ( const IArray< T > &  rSrc,
Int  iSrcStart,
Int  iSrcEnd,
Int  iDestStart 
) [virtual]
See also:
IArray::overwrite

Implements zeus::IArray< T >.

template<class T>
void MQUALIFIER zeus::TArrayList< T >::releaseIterator ( const IListIterator< T > *  pIterator ) const [virtual]
template<class T>
Retval MQUALIFIER zeus::TArrayList< T >::remove ( const T &  rItem ) [inline, virtual]
See also:
IList::remove

Implements zeus::IList< T >.

template<class T>
Retval MQUALIFIER zeus::TArrayList< T >::removeAll ( const IList< T > &  rlstItems ) [virtual]
See also:
IList::removeAll

Implements zeus::IList< T >.

template<class T >
void zeus::TArrayList< T >::resize ( Int  iNewSize )

Resizes the array. Note that if the resize is smaller than the current size, data will be lost.

Parameters:
iNewSize: New size of the array list
template<class T>
Retval MQUALIFIER zeus::TArrayList< T >::setArray ( const T *  pArray,
Int  iSize,
bool  bAttachPointer = false 
) [inline, virtual]
See also:
IArray::setArray

Implements zeus::IArray< T >.

template<class T>
Retval zeus::TArrayList< T >::setArray2 ( const T *  pArray,
Int  iSize,
bool  bAttachPointer = false 
)

sets an array

Parameters:
pArray: array to set
iSize: size of the array
bAttachPointer: Adopts the pointer given
See also:
IArray::setArray

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:32