Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HArray< T > Class Template Reference
[Abstract Data Types]

#include <HArray.h>

Inheritance diagram for HArray< T >:

HObj

Detailed Description

template<class T>
class HArray< T >

The HArray template class is a classic "dynamic array".

Definition at line 26 of file HArray.h.

Public Types

typedef std::vector< T
>::iterator 
HArrayIterator

Public Member Functions

 HArray (uint32 uSize=0)
ErrCode Append (const T &tData)
 Add the given element to the end of the array, growing if needed.
bool Contains (const T &tData) const throw ()
 Evaluates to true if the data is already present in the list.
uint32 Find (const T &tData) const throw ()
 Evaluates to true if the data is already present in the list.
ErrCode InsertAt (uint32 udx, const T &tData, uint32 uCount=1)
 Inserts a element in the array, reordering the array as needed.
ErrCode RemoveAt (uint32 udx)
 Deletes a element, closing up the array as needed.
GetAt (uint32 udx) const throw ()
 Returns the nth elements in the array.
ErrCode SetAll (const T &tData) throw ()
 Sets all of the elements in the array.
T * GetPtr (uint32 udx=0) const
 Returns the address of the nth elements in the array.
uint32 GetSize (void) const
 Returns the number of elements in the array.
ErrCode SetAt (uint32 udx, const T &tData) throw ()
 Sets the nth elements in the array.
ErrCode SetSize (uint32 uSize)
 Sets the number of elements in the array.
bool IsEmpty (void) const
 Tests whether the list is empty (zero-length) or not.
bool IsNotEmpty (void) const
 Tests whether the list is not empty, i.e., has at least one element.
ErrCode RemoveAll (void)
 Removes all elements from the list.

Protected Member Functions

bool validIndex (uint32 udx) const
 Tests an index for validity.


Member Function Documentation

template<class T>
ErrCode HArray< T >::Append const T &  tData  ) 
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
tData Data value to be added

Definition at line 67 of file HArray.h.

template<class T>
bool HArray< T >::Contains const T &  tData  )  const throw ()
 

Returns:
TRUE if element found, false otherwise
Parameters:
tData Data to find

Definition at line 90 of file HArray.h.

template<class T>
uint32 HArray< T >::Find const T &  tData  )  const throw ()
 

Returns:
Index to element if found, Humble::BAD_INDEX otherwise
Parameters:
tData Data to find

Definition at line 101 of file HArray.h.

template<class T>
ErrCode HArray< T >::InsertAt uint32  udx,
const T &  tData,
uint32  uCount = 1
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
udx Index of element to insert
tData Data to insert
uCount Count (defaults to 1)

Definition at line 124 of file HArray.h.

template<class T>
ErrCode HArray< T >::RemoveAt uint32  udx  ) 
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
udx Index of element to delete

Definition at line 143 of file HArray.h.

template<class T>
T HArray< T >::GetAt uint32  udx  )  const throw ()
 

Returns:
Element
Parameters:
udx Desired index

Definition at line 165 of file HArray.h.

template<class T>
ErrCode HArray< T >::SetAll const T &  tData  )  throw ()
 

Returns:
Always NO_ERROR
Parameters:
tData Element to copy into the array

Definition at line 172 of file HArray.h.

template<class T>
T* HArray< T >::GetPtr uint32  udx = 0  )  const
 

Returns:
Element
Parameters:
udx Desired index

Definition at line 193 of file HArray.h.

template<class T>
uint32 HArray< T >::GetSize void   )  const
 

Returns:
Count of elements

Definition at line 199 of file HArray.h.

template<class T>
ErrCode HArray< T >::SetAt uint32  udx,
const T &  tData
throw ()
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
udx Desired index
tData Element to copy into the array

Definition at line 207 of file HArray.h.

template<class T>
ErrCode HArray< T >::SetSize uint32  uSize  ) 
 

This method resizes the array, discarding elements if the array is being shrunk. Calling this method with a zero size is functionally equivalent to calling RemoveAll().

Returns:
NO_ERROR on success, error code otherwise
Parameters:
uSize Desired size of array

Definition at line 228 of file HArray.h.

template<class T>
bool HArray< T >::IsEmpty void   )  const
 

Returns:
True if list is empty (contains no elements)

Definition at line 254 of file HArray.h.

template<class T>
bool HArray< T >::IsNotEmpty void   )  const
 

Returns:
True if list is not empty (contains at least 1 element)

Definition at line 258 of file HArray.h.

template<class T>
ErrCode HArray< T >::RemoveAll void   ) 
 

Returns:
NO_ERROR on success, error code otherwise

Definition at line 262 of file HArray.h.

template<class T>
bool HArray< T >::validIndex uint32  udx  )  const [protected]
 

Returns:
true if index is valid, false otherwise
Parameters:
udx Index to test for validity

Definition at line 268 of file HArray.h.


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

2006.01.09-16:37