Public Member Functions

DataStructures::List< list_type > Class Template Reference

Array based implementation of a list. More...

#include <DS_List.h>

Collaboration diagram for DataStructures::List< list_type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 List ()
 Default constructor.
 ~List ()
 List (const List &original_copy)
 Copy constructor.
Listoperator= (const List &original_copy)
 Assign one list to another.
list_type & operator[] (const unsigned int position) const
 Access an element by its index in the array.
list_type & Get (const unsigned int position) const
 Access an element by its index in the array.
void Push (const list_type &input, const char *file, unsigned int line)
 Push an element at the end of the stack.
list_type & Pop (void)
 Pop an element from the end of the stack.
void Insert (const list_type &input, const unsigned int position, const char *file, unsigned int line)
 Insert an element at position position in the list.
void Insert (const list_type &input, const char *file, unsigned int line)
 Insert at the end of the list.
void Replace (const list_type &input, const list_type filler, const unsigned int position, const char *file, unsigned int line)
 Replace the value at position by input.
void Replace (const list_type &input)
 Replace the last element of the list by input.
void RemoveAtIndex (const unsigned int position)
 Delete the element at position position.
void RemoveAtIndexFast (const unsigned int position)
 Delete the element at position position.
void RemoveFromEnd (const unsigned num=1)
 Delete the element at the end of the list.
unsigned int GetIndexOf (const list_type &input) const
 Returns the index of the specified item or MAX_UNSIGNED_LONG if not found.
unsigned int Size (void) const
void Clear (bool doNotDeallocateSmallBlocks, const char *file, unsigned int line)
 Clear the list.
void Preallocate (unsigned countNeeded, const char *file, unsigned int line)
 Preallocate the list, so it needs fewer reallocations at runtime.
void Compress (const char *file, unsigned int line)
 Frees overallocated members, to use the minimum memory necessary.

Detailed Description

template<class list_type>
class DataStructures::List< list_type >

Array based implementation of a list.

Note:
ONLY USE THIS FOR SHALLOW COPIES. I don't bother with operator= to improve performance.

Definition at line 29 of file DS_List.h.


Constructor & Destructor Documentation

template<class list_type >
DataStructures::List< list_type >::List (  ) 

Default constructor.

Definition at line 129 of file DS_List.h.

template<class list_type >
DataStructures::List< list_type >::~List (  ) 

Definition at line 137 of file DS_List.h.

Here is the call graph for this function:

template<class list_type >
DataStructures::List< list_type >::List ( const List< list_type > &  original_copy  ) 

Copy constructor.

Parameters:
[in] original_copy The list to duplicate

Definition at line 145 of file DS_List.h.


Member Function Documentation

template<class list_type >
void DataStructures::List< list_type >::Clear ( bool  doNotDeallocateSmallBlocks,
const char *  file,
unsigned int  line 
)

Clear the list.

Definition at line 444 of file DS_List.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class list_type >
void DataStructures::List< list_type >::Compress ( const char *  file,
unsigned int  line 
)

Frees overallocated members, to use the minimum memory necessary.

Attention:
This is a slow operation

Definition at line 459 of file DS_List.h.

Here is the call graph for this function:

template<class list_type >
list_type & DataStructures::List< list_type >::Get ( const 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.

Definition at line 214 of file DS_List.h.

Here is the caller graph for this function:

template<class list_type>
unsigned int DataStructures::List< list_type >::GetIndexOf ( const list_type &  input  )  const

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

Definition at line 428 of file DS_List.h.

Here is the caller graph for this function:

template<class list_type>
void DataStructures::List< list_type >::Insert ( const list_type &  input,
const unsigned int  position,
const char *  file,
unsigned int  line 
)

Insert an element at position position in the list.

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

Definition at line 236 of file DS_List.h.

Here is the call graph for this function:

template<class list_type>
void DataStructures::List< list_type >::Insert ( const list_type &  input,
const char *  file,
unsigned int  line 
)

Insert at the end of the list.

Parameters:
[in] input The new element.

Definition at line 287 of file DS_List.h.

Here is the call graph for this function:

template<class list_type >
List< list_type > & DataStructures::List< list_type >::operator= ( const List< list_type > &  original_copy  ) 

Assign one list to another.

Definition at line 169 of file DS_List.h.

Here is the call graph for this function:

template<class list_type >
list_type & DataStructures::List< list_type >::operator[] ( const 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.

Definition at line 201 of file DS_List.h.

template<class list_type >
list_type & DataStructures::List< list_type >::Pop ( void   )  [inline]

Pop an element from the end of the stack.

Precondition:
Size()>0
Returns:
The element at the end.

Definition at line 226 of file DS_List.h.

Here is the caller graph for this function:

template<class list_type >
void DataStructures::List< list_type >::Preallocate ( unsigned  countNeeded,
const char *  file,
unsigned int  line 
)

Preallocate the list, so it needs fewer reallocations at runtime.

Definition at line 482 of file DS_List.h.

Here is the call graph for this function:

template<class list_type>
void DataStructures::List< list_type >::Push ( const list_type &  input,
const char *  file,
unsigned int  line 
)

Push an element at the end of the stack.

Parameters:
[in] input The new element.

Definition at line 220 of file DS_List.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class list_type >
void DataStructures::List< list_type >::RemoveAtIndex ( const unsigned int  position  ) 

Delete the element at position position.

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

Definition at line 381 of file DS_List.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class list_type >
void DataStructures::List< list_type >::RemoveAtIndexFast ( const unsigned int  position  ) 

Delete the element at position position.

Note:
- swaps middle with end of list, only use if list order does not matter
Parameters:
[in] position The index of the element to delete

Definition at line 404 of file DS_List.h.

Here is the caller graph for this function:

template<class list_type >
void DataStructures::List< list_type >::RemoveFromEnd ( const unsigned  num = 1  )  [inline]

Delete the element at the end of the list.

Definition at line 418 of file DS_List.h.

Here is the caller graph for this function:

template<class list_type>
void DataStructures::List< list_type >::Replace ( const list_type &  input,
const list_type  filler,
const unsigned int  position,
const char *  file,
unsigned int  line 
) [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.

Definition at line 326 of file DS_List.h.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class list_type>
void DataStructures::List< list_type >::Replace ( const list_type &  input  )  [inline]

Replace the last element of the list by input.

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

Definition at line 374 of file DS_List.h.

template<class list_type >
unsigned int DataStructures::List< list_type >::Size ( void   )  const [inline]
Returns:
The number of elements in the list

Definition at line 438 of file DS_List.h.


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