Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions
WoopsiArray< T > Class Template Reference

#include <libwoopsi/include/woopsiarray.h>

List of all members.

Public Member Functions

 WoopsiArray (s32 initialReservedSize=0)
 ~WoopsiArray ()
const s32 size () const
void push_back (const T &value)
void insert (const s32 index, const T &value)
void pop_back ()
void erase (const s32 index)
T & at (const s32 index) const
bool empty () const
void clear ()
T & operator[] (const s32 index) const

Detailed Description

template<class T>
class WoopsiArray< T >

Class providing a dynamic array; that is, an array that will automatically grow to accommodate new data. It provides a fast way to randomly access a list of data. Essentially, it provides the most important functionality of the STL vector class without any of the overhead of including an STL class.

If the data to be stored will store a lot of data that will predominantly be read sequentially, consider using the LinkedList class instead. Resizing the list is an expensive operation that will occur frequently when filling the array with large amounts of data. Adding new data to the linked list is very inexpensive.


Constructor & Destructor Documentation

template<class T >
WoopsiArray< T >::WoopsiArray ( s32  initialReservedSize = 0) [inline]

Constructor.

Parameters:
initialReservedSizeThe initial capacity of the array.
template<class T >
WoopsiArray< T >::~WoopsiArray ( ) [inline]

Destructor.


Member Function Documentation

template<class T >
T & WoopsiArray< T >::at ( const s32  index) const [inline]

Get a value at the specified location. Does not perform bounds checking.

Parameters:
indexThe index of the desired value.
Returns:
The value at the specified index.
template<class T >
void WoopsiArray< T >::clear ( )

Remove all data.

template<class T >
bool WoopsiArray< T >::empty ( ) const [inline]

Check if the array has any data.

Returns:
True if the array is empty.
template<class T >
void WoopsiArray< T >::erase ( const s32  index)

Erase a single value at the specified index

template<class T>
void WoopsiArray< T >::insert ( const s32  index,
const T &  value 
)

Insert a value into the array.

Parameters:
indexThe index to insert into.
valueThe value to insert.
template<class T >
T & WoopsiArray< T >::operator[] ( const s32  index) const

Overload the [] operator to allow array-style access.

Parameters:
indexThe index to retrieve.
Returns:
The value at the specified index.
template<class T >
void WoopsiArray< T >::pop_back ( )

Remove the last element from the array.

template<class T>
void WoopsiArray< T >::push_back ( const T &  value)

Add a value to the end of the array.

Parameters:
valueThe value to add to the array.
template<class T >
const s32 WoopsiArray< T >::size ( ) const [inline]

Get the size of the array.

Returns:
The size of the array.

The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator