BasicDataStructures::List< list_type > Class Template Reference

Array based implementation of a list. More...

#include <ArrayList.h>

List of all members.

Public Member Functions

 List ()
 Default constructor.
 ~List ()
 Destructor.
 List (const List &original_copy)
Listoperator= (const List &original_copy)
 Assign one list to another.
list_type & operator[] (unsigned int position) const
void insert (list_type input, unsigned int position)
void insert (list_type input)
void replace (list_type input, list_type filler, unsigned int position)
void replace (list_type input)
void del (unsigned int position)
void del ()
 Delete the element at the end of the list.
unsigned int getIndexOf (list_type input)
unsigned int size (void) const
void clear (void)
 Clear the list.
void compress (void)

Private Attributes

list_type * array
 An array of user values.
unsigned int list_size
 Number of elements in the list.
unsigned int allocation_size
 Size of array.


Detailed Description

template<class list_type>
class BasicDataStructures::List< list_type >

Array based implementation of a list.


Constructor & Destructor Documentation

template<class list_type>
BasicDataStructures::List< list_type >::List const List< list_type > &  original_copy  ) 
 

Copy constructor

Parameters:
[in] original_copy The list to duplicate


Member Function Documentation

template<class list_type>
void BasicDataStructures::List< list_type >::compress void   ) 
 

Frees overallocated members, to use the minimum memory necessary

Attention:
This is a slow operation

template<class list_type>
void BasicDataStructures::List< list_type >::del unsigned int  position  ) 
 

Delete the element at position position.

Parameters:
[in] position The index of the element to delete

template<class list_type>
unsigned int BasicDataStructures::List< list_type >::getIndexOf list_type  input  ) 
 

Returns the index of the specified item or MAX_UNSIGNED_LONG if not found

Parameters:
[in] input The element to check for
Returns:
The index or position of input in the list.
Return values:
MAX_UNSIGNED_LONG The object is not in the list
[Integer] The index of the element in the list

template<class list_type>
void BasicDataStructures::List< list_type >::insert list_type  input  ) 
 

Insert at the end of the list.

Parameters:
[in] input The new element.

template<class list_type>
void BasicDataStructures::List< list_type >::insert list_type  input,
unsigned int  position
 

Insert an element at position position in the list

Parameters:
[in] input The new element.
[in] position The position of the new element.

template<class list_type>
list_type & BasicDataStructures::List< list_type >::operator[] unsigned int  position  )  const [inline]
 

Access an element by its index in the array

Parameters:
[in] position The index into the array.
Returns:
The element at position position.

template<class list_type>
void BasicDataStructures::List< list_type >::replace list_type  input  )  [inline]
 

Replace the last element of the list by input .

Parameters:
[in] input The element used to replace the last element.

template<class list_type>
void BasicDataStructures::List< list_type >::replace list_type  input,
list_type  filler,
unsigned int  position
[inline]
 

Replace the value at position by input. If the size of the list is less than position, it increase the capacity of the list and fill slot with filler.

Parameters:
[in] input The element to replace at position position.
[in] filler The element use to fill new allocated capacity.
[in] position The position of input in the list.

template<class list_type>
unsigned int BasicDataStructures::List< list_type >::size void   )  const [inline]
 

Returns:
The number of elements in the list


The documentation for this class was generated from the following file:
Generated on Wed Apr 12 20:04:07 2006 for RakNet by  doxygen 1.4.6-NO