Array_t< T > Class Template Reference
Template dynamic sized circular array of T.
More...
#include <UTLists.h>
List of all members.
Detailed Description
template<class T>
class Array_t< T >
Template dynamic sized array class, implemented as a circular array of T. T must be a simple type: a basic type, struct, or typedef based on a basic type or struct because memmove will be used to move elements around in the list. Therefore, T cannot be a class which has a constructor or destructor.
Definition at line 37 of file UTLists.h.
Constructor & Destructor Documentation
Constructor for an empty array.
Definition at line 751 of file UTLists.h.
template<class T>
Array_t< T >::Array_t 
( 
T * 
stack_buffer, 


int 
stack_buffer_num_items_allcoated  

) 
  [inline] 
Constructor for an array which initially uses a stackallocated buffer of the specified size. If the required size grows beyond that size, the buffer will be reallocated from the heap.
Definition at line 762 of file UTLists.h.
Destructor. The internal buffer will be deleted unless a stack buffer was provided in the constructor and the buffer never grew to the point of having been reallocated from the heap.
Definition at line 773 of file UTLists.h.
Member Function Documentation
template<class T>
void Array_t< T >::InstallStackBuffer 
( 
T * 
stack_buffer, 


int 
stack_buffer_num_items_allcoated  

) 
  [inline] 
Installs a stack buffer into an empty but already constructed Array_t.
Definition at line 782 of file UTLists.h.
template<class T>
T Array_t< T >::AddHead 
( 
const T & 
item 
) 
[inline] 
Adds an item to the head of the list.
Definition at line 793 of file UTLists.h.
template<class T>
T Array_t< T >::AddTail 
( 
const T & 
item 
) 
[inline] 
Adds an item to the end of the list.
Definition at line 851 of file UTLists.h.
template<class T>
T Array_t< T >::AddItemAt 
( 
const T & 
item, 


int 
index  

) 
  [inline] 
Adds an item at the specified position, where the head is index 0. The specified index must be within the range of valid items, or the next index after the last valid item. That way, no gaps of invalid items can be generated. If index is 1, the item will be added at the tail.
Definition at line 912 of file UTLists.h.
template<class T >
T Array_t< T >::RemoveHead 
( 

) 
[inline] 
Removes and returns the item at the head of the list.
Definition at line 1232 of file UTLists.h.
template<class T >
T Array_t< T >::RemoveTail 
( 

) 
[inline] 
Removes and returns the item at the end of the list.
Definition at line 1253 of file UTLists.h.
template<class T >
T Array_t< T >::RemoveItemAt 
( 
int 
index 
) 
[inline] 
Removes and returns the item at the specified position in the list, where the head is index 0.
Definition at line 1273 of file UTLists.h.
template<class T >
int Array_t< T >::CountItems 
( 

) 
const [inline] 
Returns the number of items in the list.
Definition at line 1408 of file UTLists.h.
template<class T >
int Array_t< T >::AllocatedItems 
( 

) 
const [inline] 
Returns the number of allocated items in the underlying buffer, which is not necessarily the number of items which are valid.
Definition at line 1416 of file UTLists.h.
template<class T >
void Array_t< T >::SetNumValidItems 
( 
int 
count 
) 
[inline] 
Sets the number of valid items. This is used to flag items which were previously valid as now being invalid, as will be reflected by CountItems. The item count must be less than or equal to the previous number of valid items.
Definition at line 1424 of file UTLists.h.
template<class T >
void Array_t< T >::GrowIfNeeded 
( 
int 
min_allocated_items, 


bool 
expect_more_growth = false  

) 
  [inline] 
Increases the allocated size of the array if necessary. If expect_more_growth is true, it will allocate some spare, unoccupied items in the underlying array. The items are not considered valid, space for them is merely reserved in the underlying array.
Definition at line 1433 of file UTLists.h.
template<class T >
T Array_t< T >::Head 
( 

) 
const [inline] 
Returns the item at the head of the list.
Definition at line 1475 of file UTLists.h.
template<class T >
T Array_t< T >::Tail 
( 

) 
const [inline] 
Returns the item at the end of the list.
Definition at line 1485 of file UTLists.h.
template<class T >
T Array_t< T >::ItemAt 
( 
int 
index 
) 
const [inline] 
Returns the item at the specified position in the list, where the head is index 0. An item may only be accessed if it is a valid item. The item is returned by value, so the returned value is NOT a pointer to the internal storage allocated by Array_t. If that is needed, use operator [] instead.
Definition at line 1503 of file UTLists.h.
template<class T >
T & Array_t< T >::operator[] 
( 
int 
index 
) 
const [inline] 
template<class T>
void Array_t< T >::operator+= 
( 
const T & 
item 
) 
[inline] 
Adds an item to the end of the array.
Definition at line 1540 of file UTLists.h.
The documentation for this class was generated from the following file:
 D:/develop/svn/utlib/utlib/trunk/UT/src_UT/UTLists.h